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.

22730 lines
605KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrossover
  392. Split audio stream into several bands.
  393. This filter splits audio stream into two or more frequency ranges.
  394. Summing all streams back will give flat output.
  395. The filter accepts the following options:
  396. @table @option
  397. @item split
  398. Set split frequencies. Those must be positive and increasing.
  399. @item order
  400. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  401. Default is @var{4th}.
  402. @end table
  403. @section acrusher
  404. Reduce audio bit resolution.
  405. This filter is bit crusher with enhanced functionality. A bit crusher
  406. is used to audibly reduce number of bits an audio signal is sampled
  407. with. This doesn't change the bit depth at all, it just produces the
  408. effect. Material reduced in bit depth sounds more harsh and "digital".
  409. This filter is able to even round to continuous values instead of discrete
  410. bit depths.
  411. Additionally it has a D/C offset which results in different crushing of
  412. the lower and the upper half of the signal.
  413. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  414. Another feature of this filter is the logarithmic mode.
  415. This setting switches from linear distances between bits to logarithmic ones.
  416. The result is a much more "natural" sounding crusher which doesn't gate low
  417. signals for example. The human ear has a logarithmic perception,
  418. so this kind of crushing is much more pleasant.
  419. Logarithmic crushing is also able to get anti-aliased.
  420. The filter accepts the following options:
  421. @table @option
  422. @item level_in
  423. Set level in.
  424. @item level_out
  425. Set level out.
  426. @item bits
  427. Set bit reduction.
  428. @item mix
  429. Set mixing amount.
  430. @item mode
  431. Can be linear: @code{lin} or logarithmic: @code{log}.
  432. @item dc
  433. Set DC.
  434. @item aa
  435. Set anti-aliasing.
  436. @item samples
  437. Set sample reduction.
  438. @item lfo
  439. Enable LFO. By default disabled.
  440. @item lforange
  441. Set LFO range.
  442. @item lforate
  443. Set LFO rate.
  444. @end table
  445. @section acue
  446. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  447. filter.
  448. @section adeclick
  449. Remove impulsive noise from input audio.
  450. Samples detected as impulsive noise are replaced by interpolated samples using
  451. autoregressive modelling.
  452. @table @option
  453. @item w
  454. Set window size, in milliseconds. Allowed range is from @code{10} to
  455. @code{100}. Default value is @code{55} milliseconds.
  456. This sets size of window which will be processed at once.
  457. @item o
  458. Set window overlap, in percentage of window size. Allowed range is from
  459. @code{50} to @code{95}. Default value is @code{75} percent.
  460. Setting this to a very high value increases impulsive noise removal but makes
  461. whole process much slower.
  462. @item a
  463. Set autoregression order, in percentage of window size. Allowed range is from
  464. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  465. controls quality of interpolated samples using neighbour good samples.
  466. @item t
  467. Set threshold value. Allowed range is from @code{1} to @code{100}.
  468. Default value is @code{2}.
  469. This controls the strength of impulsive noise which is going to be removed.
  470. The lower value, the more samples will be detected as impulsive noise.
  471. @item b
  472. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  473. @code{10}. Default value is @code{2}.
  474. If any two samples deteced as noise are spaced less than this value then any
  475. sample inbetween those two samples will be also detected as noise.
  476. @item m
  477. Set overlap method.
  478. It accepts the following values:
  479. @table @option
  480. @item a
  481. Select overlap-add method. Even not interpolated samples are slightly
  482. changed with this method.
  483. @item s
  484. Select overlap-save method. Not interpolated samples remain unchanged.
  485. @end table
  486. Default value is @code{a}.
  487. @end table
  488. @section adeclip
  489. Remove clipped samples from input audio.
  490. Samples detected as clipped are replaced by interpolated samples using
  491. autoregressive modelling.
  492. @table @option
  493. @item w
  494. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  495. Default value is @code{55} milliseconds.
  496. This sets size of window which will be processed at once.
  497. @item o
  498. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  499. to @code{95}. Default value is @code{75} percent.
  500. @item a
  501. Set autoregression order, in percentage of window size. Allowed range is from
  502. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  503. quality of interpolated samples using neighbour good samples.
  504. @item t
  505. Set threshold value. Allowed range is from @code{1} to @code{100}.
  506. Default value is @code{10}. Higher values make clip detection less aggressive.
  507. @item n
  508. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  509. Default value is @code{1000}. Higher values make clip detection less aggressive.
  510. @item m
  511. Set overlap method.
  512. It accepts the following values:
  513. @table @option
  514. @item a
  515. Select overlap-add method. Even not interpolated samples are slightly changed
  516. with this method.
  517. @item s
  518. Select overlap-save method. Not interpolated samples remain unchanged.
  519. @end table
  520. Default value is @code{a}.
  521. @end table
  522. @section adelay
  523. Delay one or more audio channels.
  524. Samples in delayed channel are filled with silence.
  525. The filter accepts the following option:
  526. @table @option
  527. @item delays
  528. Set list of delays in milliseconds for each channel separated by '|'.
  529. Unused delays will be silently ignored. If number of given delays is
  530. smaller than number of channels all remaining channels will not be delayed.
  531. If you want to delay exact number of samples, append 'S' to number.
  532. If you want instead to delay in seconds, append 's' to number.
  533. @end table
  534. @subsection Examples
  535. @itemize
  536. @item
  537. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  538. the second channel (and any other channels that may be present) unchanged.
  539. @example
  540. adelay=1500|0|500
  541. @end example
  542. @item
  543. Delay second channel by 500 samples, the third channel by 700 samples and leave
  544. the first channel (and any other channels that may be present) unchanged.
  545. @example
  546. adelay=0|500S|700S
  547. @end example
  548. @end itemize
  549. @section aderivative, aintegral
  550. Compute derivative/integral of audio stream.
  551. Applying both filters one after another produces original audio.
  552. @section aecho
  553. Apply echoing to the input audio.
  554. Echoes are reflected sound and can occur naturally amongst mountains
  555. (and sometimes large buildings) when talking or shouting; digital echo
  556. effects emulate this behaviour and are often used to help fill out the
  557. sound of a single instrument or vocal. The time difference between the
  558. original signal and the reflection is the @code{delay}, and the
  559. loudness of the reflected signal is the @code{decay}.
  560. Multiple echoes can have different delays and decays.
  561. A description of the accepted parameters follows.
  562. @table @option
  563. @item in_gain
  564. Set input gain of reflected signal. Default is @code{0.6}.
  565. @item out_gain
  566. Set output gain of reflected signal. Default is @code{0.3}.
  567. @item delays
  568. Set list of time intervals in milliseconds between original signal and reflections
  569. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  570. Default is @code{1000}.
  571. @item decays
  572. Set list of loudness of reflected signals separated by '|'.
  573. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  574. Default is @code{0.5}.
  575. @end table
  576. @subsection Examples
  577. @itemize
  578. @item
  579. Make it sound as if there are twice as many instruments as are actually playing:
  580. @example
  581. aecho=0.8:0.88:60:0.4
  582. @end example
  583. @item
  584. If delay is very short, then it sound like a (metallic) robot playing music:
  585. @example
  586. aecho=0.8:0.88:6:0.4
  587. @end example
  588. @item
  589. A longer delay will sound like an open air concert in the mountains:
  590. @example
  591. aecho=0.8:0.9:1000:0.3
  592. @end example
  593. @item
  594. Same as above but with one more mountain:
  595. @example
  596. aecho=0.8:0.9:1000|1800:0.3|0.25
  597. @end example
  598. @end itemize
  599. @section aemphasis
  600. Audio emphasis filter creates or restores material directly taken from LPs or
  601. emphased CDs with different filter curves. E.g. to store music on vinyl the
  602. signal has to be altered by a filter first to even out the disadvantages of
  603. this recording medium.
  604. Once the material is played back the inverse filter has to be applied to
  605. restore the distortion of the frequency response.
  606. The filter accepts the following options:
  607. @table @option
  608. @item level_in
  609. Set input gain.
  610. @item level_out
  611. Set output gain.
  612. @item mode
  613. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  614. use @code{production} mode. Default is @code{reproduction} mode.
  615. @item type
  616. Set filter type. Selects medium. Can be one of the following:
  617. @table @option
  618. @item col
  619. select Columbia.
  620. @item emi
  621. select EMI.
  622. @item bsi
  623. select BSI (78RPM).
  624. @item riaa
  625. select RIAA.
  626. @item cd
  627. select Compact Disc (CD).
  628. @item 50fm
  629. select 50µs (FM).
  630. @item 75fm
  631. select 75µs (FM).
  632. @item 50kf
  633. select 50µs (FM-KF).
  634. @item 75kf
  635. select 75µs (FM-KF).
  636. @end table
  637. @end table
  638. @section aeval
  639. Modify an audio signal according to the specified expressions.
  640. This filter accepts one or more expressions (one for each channel),
  641. which are evaluated and used to modify a corresponding audio signal.
  642. It accepts the following parameters:
  643. @table @option
  644. @item exprs
  645. Set the '|'-separated expressions list for each separate channel. If
  646. the number of input channels is greater than the number of
  647. expressions, the last specified expression is used for the remaining
  648. output channels.
  649. @item channel_layout, c
  650. Set output channel layout. If not specified, the channel layout is
  651. specified by the number of expressions. If set to @samp{same}, it will
  652. use by default the same input channel layout.
  653. @end table
  654. Each expression in @var{exprs} can contain the following constants and functions:
  655. @table @option
  656. @item ch
  657. channel number of the current expression
  658. @item n
  659. number of the evaluated sample, starting from 0
  660. @item s
  661. sample rate
  662. @item t
  663. time of the evaluated sample expressed in seconds
  664. @item nb_in_channels
  665. @item nb_out_channels
  666. input and output number of channels
  667. @item val(CH)
  668. the value of input channel with number @var{CH}
  669. @end table
  670. Note: this filter is slow. For faster processing you should use a
  671. dedicated filter.
  672. @subsection Examples
  673. @itemize
  674. @item
  675. Half volume:
  676. @example
  677. aeval=val(ch)/2:c=same
  678. @end example
  679. @item
  680. Invert phase of the second channel:
  681. @example
  682. aeval=val(0)|-val(1)
  683. @end example
  684. @end itemize
  685. @anchor{afade}
  686. @section afade
  687. Apply fade-in/out effect to input audio.
  688. A description of the accepted parameters follows.
  689. @table @option
  690. @item type, t
  691. Specify the effect type, can be either @code{in} for fade-in, or
  692. @code{out} for a fade-out effect. Default is @code{in}.
  693. @item start_sample, ss
  694. Specify the number of the start sample for starting to apply the fade
  695. effect. Default is 0.
  696. @item nb_samples, ns
  697. Specify the number of samples for which the fade effect has to last. At
  698. the end of the fade-in effect the output audio will have the same
  699. volume as the input audio, at the end of the fade-out transition
  700. the output audio will be silence. Default is 44100.
  701. @item start_time, st
  702. Specify the start time of the fade effect. Default is 0.
  703. The value must be specified as a time duration; see
  704. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  705. for the accepted syntax.
  706. If set this option is used instead of @var{start_sample}.
  707. @item duration, d
  708. Specify the duration of the fade effect. See
  709. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  710. for the accepted syntax.
  711. At the end of the fade-in effect the output audio will have the same
  712. volume as the input audio, at the end of the fade-out transition
  713. the output audio will be silence.
  714. By default the duration is determined by @var{nb_samples}.
  715. If set this option is used instead of @var{nb_samples}.
  716. @item curve
  717. Set curve for fade transition.
  718. It accepts the following values:
  719. @table @option
  720. @item tri
  721. select triangular, linear slope (default)
  722. @item qsin
  723. select quarter of sine wave
  724. @item hsin
  725. select half of sine wave
  726. @item esin
  727. select exponential sine wave
  728. @item log
  729. select logarithmic
  730. @item ipar
  731. select inverted parabola
  732. @item qua
  733. select quadratic
  734. @item cub
  735. select cubic
  736. @item squ
  737. select square root
  738. @item cbr
  739. select cubic root
  740. @item par
  741. select parabola
  742. @item exp
  743. select exponential
  744. @item iqsin
  745. select inverted quarter of sine wave
  746. @item ihsin
  747. select inverted half of sine wave
  748. @item dese
  749. select double-exponential seat
  750. @item desi
  751. select double-exponential sigmoid
  752. @item losi
  753. select logistic sigmoid
  754. @end table
  755. @end table
  756. @subsection Examples
  757. @itemize
  758. @item
  759. Fade in first 15 seconds of audio:
  760. @example
  761. afade=t=in:ss=0:d=15
  762. @end example
  763. @item
  764. Fade out last 25 seconds of a 900 seconds audio:
  765. @example
  766. afade=t=out:st=875:d=25
  767. @end example
  768. @end itemize
  769. @section afftdn
  770. Denoise audio samples with FFT.
  771. A description of the accepted parameters follows.
  772. @table @option
  773. @item nr
  774. Set the noise reduction in dB, allowed range is 0.01 to 97.
  775. Default value is 12 dB.
  776. @item nf
  777. Set the noise floor in dB, allowed range is -80 to -20.
  778. Default value is -50 dB.
  779. @item nt
  780. Set the noise type.
  781. It accepts the following values:
  782. @table @option
  783. @item w
  784. Select white noise.
  785. @item v
  786. Select vinyl noise.
  787. @item s
  788. Select shellac noise.
  789. @item c
  790. Select custom noise, defined in @code{bn} option.
  791. Default value is white noise.
  792. @end table
  793. @item bn
  794. Set custom band noise for every one of 15 bands.
  795. Bands are separated by ' ' or '|'.
  796. @item rf
  797. Set the residual floor in dB, allowed range is -80 to -20.
  798. Default value is -38 dB.
  799. @item tn
  800. Enable noise tracking. By default is disabled.
  801. With this enabled, noise floor is automatically adjusted.
  802. @item tr
  803. Enable residual tracking. By default is disabled.
  804. @item om
  805. Set the output mode.
  806. It accepts the following values:
  807. @table @option
  808. @item i
  809. Pass input unchanged.
  810. @item o
  811. Pass noise filtered out.
  812. @item n
  813. Pass only noise.
  814. Default value is @var{o}.
  815. @end table
  816. @end table
  817. @subsection Commands
  818. This filter supports the following commands:
  819. @table @option
  820. @item sample_noise, sn
  821. Start or stop measuring noise profile.
  822. Syntax for the command is : "start" or "stop" string.
  823. After measuring noise profile is stopped it will be
  824. automatically applied in filtering.
  825. @item noise_reduction, nr
  826. Change noise reduction. Argument is single float number.
  827. Syntax for the command is : "@var{noise_reduction}"
  828. @item noise_floor, nf
  829. Change noise floor. Argument is single float number.
  830. Syntax for the command is : "@var{noise_floor}"
  831. @item output_mode, om
  832. Change output mode operation.
  833. Syntax for the command is : "i", "o" or "n" string.
  834. @end table
  835. @section afftfilt
  836. Apply arbitrary expressions to samples in frequency domain.
  837. @table @option
  838. @item real
  839. Set frequency domain real expression for each separate channel separated
  840. by '|'. Default is "re".
  841. If the number of input channels is greater than the number of
  842. expressions, the last specified expression is used for the remaining
  843. output channels.
  844. @item imag
  845. Set frequency domain imaginary expression for each separate channel
  846. separated by '|'. Default is "im".
  847. Each expression in @var{real} and @var{imag} can contain the following
  848. constants and functions:
  849. @table @option
  850. @item sr
  851. sample rate
  852. @item b
  853. current frequency bin number
  854. @item nb
  855. number of available bins
  856. @item ch
  857. channel number of the current expression
  858. @item chs
  859. number of channels
  860. @item pts
  861. current frame pts
  862. @item re
  863. current real part of frequency bin of current channel
  864. @item im
  865. current imaginary part of frequency bin of current channel
  866. @item real(b, ch)
  867. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  868. @item imag(b, ch)
  869. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  870. @end table
  871. @item win_size
  872. Set window size.
  873. It accepts the following values:
  874. @table @samp
  875. @item w16
  876. @item w32
  877. @item w64
  878. @item w128
  879. @item w256
  880. @item w512
  881. @item w1024
  882. @item w2048
  883. @item w4096
  884. @item w8192
  885. @item w16384
  886. @item w32768
  887. @item w65536
  888. @end table
  889. Default is @code{w4096}
  890. @item win_func
  891. Set window function. Default is @code{hann}.
  892. @item overlap
  893. Set window overlap. If set to 1, the recommended overlap for selected
  894. window function will be picked. Default is @code{0.75}.
  895. @end table
  896. @subsection Examples
  897. @itemize
  898. @item
  899. Leave almost only low frequencies in audio:
  900. @example
  901. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  902. @end example
  903. @end itemize
  904. @anchor{afir}
  905. @section afir
  906. Apply an arbitrary Frequency Impulse Response filter.
  907. This filter is designed for applying long FIR filters,
  908. up to 60 seconds long.
  909. It can be used as component for digital crossover filters,
  910. room equalization, cross talk cancellation, wavefield synthesis,
  911. auralization, ambiophonics, ambisonics and spatialization.
  912. This filter uses second stream as FIR coefficients.
  913. If second stream holds single channel, it will be used
  914. for all input channels in first stream, otherwise
  915. number of channels in second stream must be same as
  916. number of channels in first stream.
  917. It accepts the following parameters:
  918. @table @option
  919. @item dry
  920. Set dry gain. This sets input gain.
  921. @item wet
  922. Set wet gain. This sets final output gain.
  923. @item length
  924. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  925. @item gtype
  926. Enable applying gain measured from power of IR.
  927. Set which approach to use for auto gain measurement.
  928. @table @option
  929. @item none
  930. Do not apply any gain.
  931. @item peak
  932. select peak gain, very conservative approach. This is default value.
  933. @item dc
  934. select DC gain, limited application.
  935. @item gn
  936. select gain to noise approach, this is most popular one.
  937. @end table
  938. @item irgain
  939. Set gain to be applied to IR coefficients before filtering.
  940. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  941. @item irfmt
  942. Set format of IR stream. Can be @code{mono} or @code{input}.
  943. Default is @code{input}.
  944. @item maxir
  945. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  946. Allowed range is 0.1 to 60 seconds.
  947. @item response
  948. Show IR frequency reponse, magnitude(magenta) and phase(green) and group delay(yellow) in additional video stream.
  949. By default it is disabled.
  950. @item channel
  951. Set for which IR channel to display frequency response. By default is first channel
  952. displayed. This option is used only when @var{response} is enabled.
  953. @item size
  954. Set video stream size. This option is used only when @var{response} is enabled.
  955. @item rate
  956. Set video stream frame rate. This option is used only when @var{response} is enabled.
  957. @item minp
  958. Set minimal partition size used for convolution. Default is @var{8192}.
  959. Allowed range is from @var{16} to @var{32768}.
  960. Lower values decreases latency at cost of higher CPU usage.
  961. @item maxp
  962. Set maximal partition size used for convolution. Default is @var{8192}.
  963. Allowed range is from @var{16} to @var{32768}.
  964. Lower values may increase CPU usage.
  965. @end table
  966. @subsection Examples
  967. @itemize
  968. @item
  969. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  970. @example
  971. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  972. @end example
  973. @end itemize
  974. @anchor{aformat}
  975. @section aformat
  976. Set output format constraints for the input audio. The framework will
  977. negotiate the most appropriate format to minimize conversions.
  978. It accepts the following parameters:
  979. @table @option
  980. @item sample_fmts
  981. A '|'-separated list of requested sample formats.
  982. @item sample_rates
  983. A '|'-separated list of requested sample rates.
  984. @item channel_layouts
  985. A '|'-separated list of requested channel layouts.
  986. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  987. for the required syntax.
  988. @end table
  989. If a parameter is omitted, all values are allowed.
  990. Force the output to either unsigned 8-bit or signed 16-bit stereo
  991. @example
  992. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  993. @end example
  994. @section agate
  995. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  996. processing reduces disturbing noise between useful signals.
  997. Gating is done by detecting the volume below a chosen level @var{threshold}
  998. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  999. floor is set via @var{range}. Because an exact manipulation of the signal
  1000. would cause distortion of the waveform the reduction can be levelled over
  1001. time. This is done by setting @var{attack} and @var{release}.
  1002. @var{attack} determines how long the signal has to fall below the threshold
  1003. before any reduction will occur and @var{release} sets the time the signal
  1004. has to rise above the threshold to reduce the reduction again.
  1005. Shorter signals than the chosen attack time will be left untouched.
  1006. @table @option
  1007. @item level_in
  1008. Set input level before filtering.
  1009. Default is 1. Allowed range is from 0.015625 to 64.
  1010. @item range
  1011. Set the level of gain reduction when the signal is below the threshold.
  1012. Default is 0.06125. Allowed range is from 0 to 1.
  1013. @item threshold
  1014. If a signal rises above this level the gain reduction is released.
  1015. Default is 0.125. Allowed range is from 0 to 1.
  1016. @item ratio
  1017. Set a ratio by which the signal is reduced.
  1018. Default is 2. Allowed range is from 1 to 9000.
  1019. @item attack
  1020. Amount of milliseconds the signal has to rise above the threshold before gain
  1021. reduction stops.
  1022. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1023. @item release
  1024. Amount of milliseconds the signal has to fall below the threshold before the
  1025. reduction is increased again. Default is 250 milliseconds.
  1026. Allowed range is from 0.01 to 9000.
  1027. @item makeup
  1028. Set amount of amplification of signal after processing.
  1029. Default is 1. Allowed range is from 1 to 64.
  1030. @item knee
  1031. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1032. Default is 2.828427125. Allowed range is from 1 to 8.
  1033. @item detection
  1034. Choose if exact signal should be taken for detection or an RMS like one.
  1035. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1036. @item link
  1037. Choose if the average level between all channels or the louder channel affects
  1038. the reduction.
  1039. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1040. @end table
  1041. @section aiir
  1042. Apply an arbitrary Infinite Impulse Response filter.
  1043. It accepts the following parameters:
  1044. @table @option
  1045. @item z
  1046. Set numerator/zeros coefficients.
  1047. @item p
  1048. Set denominator/poles coefficients.
  1049. @item k
  1050. Set channels gains.
  1051. @item dry_gain
  1052. Set input gain.
  1053. @item wet_gain
  1054. Set output gain.
  1055. @item f
  1056. Set coefficients format.
  1057. @table @samp
  1058. @item tf
  1059. transfer function
  1060. @item zp
  1061. Z-plane zeros/poles, cartesian (default)
  1062. @item pr
  1063. Z-plane zeros/poles, polar radians
  1064. @item pd
  1065. Z-plane zeros/poles, polar degrees
  1066. @end table
  1067. @item r
  1068. Set kind of processing.
  1069. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  1070. @item e
  1071. Set filtering precision.
  1072. @table @samp
  1073. @item dbl
  1074. double-precision floating-point (default)
  1075. @item flt
  1076. single-precision floating-point
  1077. @item i32
  1078. 32-bit integers
  1079. @item i16
  1080. 16-bit integers
  1081. @end table
  1082. @item response
  1083. Show IR frequency reponse, magnitude and phase in additional video stream.
  1084. By default it is disabled.
  1085. @item channel
  1086. Set for which IR channel to display frequency response. By default is first channel
  1087. displayed. This option is used only when @var{response} is enabled.
  1088. @item size
  1089. Set video stream size. This option is used only when @var{response} is enabled.
  1090. @end table
  1091. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1092. order.
  1093. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1094. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1095. imaginary unit.
  1096. Different coefficients and gains can be provided for every channel, in such case
  1097. use '|' to separate coefficients or gains. Last provided coefficients will be
  1098. used for all remaining channels.
  1099. @subsection Examples
  1100. @itemize
  1101. @item
  1102. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  1103. @example
  1104. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  1105. @end example
  1106. @item
  1107. Same as above but in @code{zp} format:
  1108. @example
  1109. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  1110. @end example
  1111. @end itemize
  1112. @section alimiter
  1113. The limiter prevents an input signal from rising over a desired threshold.
  1114. This limiter uses lookahead technology to prevent your signal from distorting.
  1115. It means that there is a small delay after the signal is processed. Keep in mind
  1116. that the delay it produces is the attack time you set.
  1117. The filter accepts the following options:
  1118. @table @option
  1119. @item level_in
  1120. Set input gain. Default is 1.
  1121. @item level_out
  1122. Set output gain. Default is 1.
  1123. @item limit
  1124. Don't let signals above this level pass the limiter. Default is 1.
  1125. @item attack
  1126. The limiter will reach its attenuation level in this amount of time in
  1127. milliseconds. Default is 5 milliseconds.
  1128. @item release
  1129. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1130. Default is 50 milliseconds.
  1131. @item asc
  1132. When gain reduction is always needed ASC takes care of releasing to an
  1133. average reduction level rather than reaching a reduction of 0 in the release
  1134. time.
  1135. @item asc_level
  1136. Select how much the release time is affected by ASC, 0 means nearly no changes
  1137. in release time while 1 produces higher release times.
  1138. @item level
  1139. Auto level output signal. Default is enabled.
  1140. This normalizes audio back to 0dB if enabled.
  1141. @end table
  1142. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1143. with @ref{aresample} before applying this filter.
  1144. @section allpass
  1145. Apply a two-pole all-pass filter with central frequency (in Hz)
  1146. @var{frequency}, and filter-width @var{width}.
  1147. An all-pass filter changes the audio's frequency to phase relationship
  1148. without changing its frequency to amplitude relationship.
  1149. The filter accepts the following options:
  1150. @table @option
  1151. @item frequency, f
  1152. Set frequency in Hz.
  1153. @item width_type, t
  1154. Set method to specify band-width of filter.
  1155. @table @option
  1156. @item h
  1157. Hz
  1158. @item q
  1159. Q-Factor
  1160. @item o
  1161. octave
  1162. @item s
  1163. slope
  1164. @item k
  1165. kHz
  1166. @end table
  1167. @item width, w
  1168. Specify the band-width of a filter in width_type units.
  1169. @item channels, c
  1170. Specify which channels to filter, by default all available are filtered.
  1171. @end table
  1172. @subsection Commands
  1173. This filter supports the following commands:
  1174. @table @option
  1175. @item frequency, f
  1176. Change allpass frequency.
  1177. Syntax for the command is : "@var{frequency}"
  1178. @item width_type, t
  1179. Change allpass width_type.
  1180. Syntax for the command is : "@var{width_type}"
  1181. @item width, w
  1182. Change allpass width.
  1183. Syntax for the command is : "@var{width}"
  1184. @end table
  1185. @section aloop
  1186. Loop audio samples.
  1187. The filter accepts the following options:
  1188. @table @option
  1189. @item loop
  1190. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1191. Default is 0.
  1192. @item size
  1193. Set maximal number of samples. Default is 0.
  1194. @item start
  1195. Set first sample of loop. Default is 0.
  1196. @end table
  1197. @anchor{amerge}
  1198. @section amerge
  1199. Merge two or more audio streams into a single multi-channel stream.
  1200. The filter accepts the following options:
  1201. @table @option
  1202. @item inputs
  1203. Set the number of inputs. Default is 2.
  1204. @end table
  1205. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1206. the channel layout of the output will be set accordingly and the channels
  1207. will be reordered as necessary. If the channel layouts of the inputs are not
  1208. disjoint, the output will have all the channels of the first input then all
  1209. the channels of the second input, in that order, and the channel layout of
  1210. the output will be the default value corresponding to the total number of
  1211. channels.
  1212. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1213. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1214. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1215. first input, b1 is the first channel of the second input).
  1216. On the other hand, if both input are in stereo, the output channels will be
  1217. in the default order: a1, a2, b1, b2, and the channel layout will be
  1218. arbitrarily set to 4.0, which may or may not be the expected value.
  1219. All inputs must have the same sample rate, and format.
  1220. If inputs do not have the same duration, the output will stop with the
  1221. shortest.
  1222. @subsection Examples
  1223. @itemize
  1224. @item
  1225. Merge two mono files into a stereo stream:
  1226. @example
  1227. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1228. @end example
  1229. @item
  1230. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1231. @example
  1232. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  1233. @end example
  1234. @end itemize
  1235. @section amix
  1236. Mixes multiple audio inputs into a single output.
  1237. Note that this filter only supports float samples (the @var{amerge}
  1238. and @var{pan} audio filters support many formats). If the @var{amix}
  1239. input has integer samples then @ref{aresample} will be automatically
  1240. inserted to perform the conversion to float samples.
  1241. For example
  1242. @example
  1243. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1244. @end example
  1245. will mix 3 input audio streams to a single output with the same duration as the
  1246. first input and a dropout transition time of 3 seconds.
  1247. It accepts the following parameters:
  1248. @table @option
  1249. @item inputs
  1250. The number of inputs. If unspecified, it defaults to 2.
  1251. @item duration
  1252. How to determine the end-of-stream.
  1253. @table @option
  1254. @item longest
  1255. The duration of the longest input. (default)
  1256. @item shortest
  1257. The duration of the shortest input.
  1258. @item first
  1259. The duration of the first input.
  1260. @end table
  1261. @item dropout_transition
  1262. The transition time, in seconds, for volume renormalization when an input
  1263. stream ends. The default value is 2 seconds.
  1264. @item weights
  1265. Specify weight of each input audio stream as sequence.
  1266. Each weight is separated by space. By default all inputs have same weight.
  1267. @end table
  1268. @section amultiply
  1269. Multiply first audio stream with second audio stream and store result
  1270. in output audio stream. Multiplication is done by multiplying each
  1271. sample from first stream with sample at same position from second stream.
  1272. With this element-wise multiplication one can create amplitude fades and
  1273. amplitude modulations.
  1274. @section anequalizer
  1275. High-order parametric multiband equalizer for each channel.
  1276. It accepts the following parameters:
  1277. @table @option
  1278. @item params
  1279. This option string is in format:
  1280. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1281. Each equalizer band is separated by '|'.
  1282. @table @option
  1283. @item chn
  1284. Set channel number to which equalization will be applied.
  1285. If input doesn't have that channel the entry is ignored.
  1286. @item f
  1287. Set central frequency for band.
  1288. If input doesn't have that frequency the entry is ignored.
  1289. @item w
  1290. Set band width in hertz.
  1291. @item g
  1292. Set band gain in dB.
  1293. @item t
  1294. Set filter type for band, optional, can be:
  1295. @table @samp
  1296. @item 0
  1297. Butterworth, this is default.
  1298. @item 1
  1299. Chebyshev type 1.
  1300. @item 2
  1301. Chebyshev type 2.
  1302. @end table
  1303. @end table
  1304. @item curves
  1305. With this option activated frequency response of anequalizer is displayed
  1306. in video stream.
  1307. @item size
  1308. Set video stream size. Only useful if curves option is activated.
  1309. @item mgain
  1310. Set max gain that will be displayed. Only useful if curves option is activated.
  1311. Setting this to a reasonable value makes it possible to display gain which is derived from
  1312. neighbour bands which are too close to each other and thus produce higher gain
  1313. when both are activated.
  1314. @item fscale
  1315. Set frequency scale used to draw frequency response in video output.
  1316. Can be linear or logarithmic. Default is logarithmic.
  1317. @item colors
  1318. Set color for each channel curve which is going to be displayed in video stream.
  1319. This is list of color names separated by space or by '|'.
  1320. Unrecognised or missing colors will be replaced by white color.
  1321. @end table
  1322. @subsection Examples
  1323. @itemize
  1324. @item
  1325. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1326. for first 2 channels using Chebyshev type 1 filter:
  1327. @example
  1328. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1329. @end example
  1330. @end itemize
  1331. @subsection Commands
  1332. This filter supports the following commands:
  1333. @table @option
  1334. @item change
  1335. Alter existing filter parameters.
  1336. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1337. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1338. error is returned.
  1339. @var{freq} set new frequency parameter.
  1340. @var{width} set new width parameter in herz.
  1341. @var{gain} set new gain parameter in dB.
  1342. Full filter invocation with asendcmd may look like this:
  1343. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1344. @end table
  1345. @section anull
  1346. Pass the audio source unchanged to the output.
  1347. @section apad
  1348. Pad the end of an audio stream with silence.
  1349. This can be used together with @command{ffmpeg} @option{-shortest} to
  1350. extend audio streams to the same length as the video stream.
  1351. A description of the accepted options follows.
  1352. @table @option
  1353. @item packet_size
  1354. Set silence packet size. Default value is 4096.
  1355. @item pad_len
  1356. Set the number of samples of silence to add to the end. After the
  1357. value is reached, the stream is terminated. This option is mutually
  1358. exclusive with @option{whole_len}.
  1359. @item whole_len
  1360. Set the minimum total number of samples in the output audio stream. If
  1361. the value is longer than the input audio length, silence is added to
  1362. the end, until the value is reached. This option is mutually exclusive
  1363. with @option{pad_len}.
  1364. @item pad_dur
  1365. Specify the duration of samples of silence to add. See
  1366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1367. for the accepted syntax. Used only if set to non-zero value.
  1368. @item whole_dur
  1369. Specify the minimum total duration in the output audio stream. See
  1370. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1371. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1372. the input audio length, silence is added to the end, until the value is reached.
  1373. This option is mutually exclusive with @option{pad_dur}
  1374. @end table
  1375. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1376. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1377. the input stream indefinitely.
  1378. @subsection Examples
  1379. @itemize
  1380. @item
  1381. Add 1024 samples of silence to the end of the input:
  1382. @example
  1383. apad=pad_len=1024
  1384. @end example
  1385. @item
  1386. Make sure the audio output will contain at least 10000 samples, pad
  1387. the input with silence if required:
  1388. @example
  1389. apad=whole_len=10000
  1390. @end example
  1391. @item
  1392. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1393. video stream will always result the shortest and will be converted
  1394. until the end in the output file when using the @option{shortest}
  1395. option:
  1396. @example
  1397. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1398. @end example
  1399. @end itemize
  1400. @section aphaser
  1401. Add a phasing effect to the input audio.
  1402. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1403. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1404. A description of the accepted parameters follows.
  1405. @table @option
  1406. @item in_gain
  1407. Set input gain. Default is 0.4.
  1408. @item out_gain
  1409. Set output gain. Default is 0.74
  1410. @item delay
  1411. Set delay in milliseconds. Default is 3.0.
  1412. @item decay
  1413. Set decay. Default is 0.4.
  1414. @item speed
  1415. Set modulation speed in Hz. Default is 0.5.
  1416. @item type
  1417. Set modulation type. Default is triangular.
  1418. It accepts the following values:
  1419. @table @samp
  1420. @item triangular, t
  1421. @item sinusoidal, s
  1422. @end table
  1423. @end table
  1424. @section apulsator
  1425. Audio pulsator is something between an autopanner and a tremolo.
  1426. But it can produce funny stereo effects as well. Pulsator changes the volume
  1427. of the left and right channel based on a LFO (low frequency oscillator) with
  1428. different waveforms and shifted phases.
  1429. This filter have the ability to define an offset between left and right
  1430. channel. An offset of 0 means that both LFO shapes match each other.
  1431. The left and right channel are altered equally - a conventional tremolo.
  1432. An offset of 50% means that the shape of the right channel is exactly shifted
  1433. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1434. an autopanner. At 1 both curves match again. Every setting in between moves the
  1435. phase shift gapless between all stages and produces some "bypassing" sounds with
  1436. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1437. the 0.5) the faster the signal passes from the left to the right speaker.
  1438. The filter accepts the following options:
  1439. @table @option
  1440. @item level_in
  1441. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1442. @item level_out
  1443. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1444. @item mode
  1445. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1446. sawup or sawdown. Default is sine.
  1447. @item amount
  1448. Set modulation. Define how much of original signal is affected by the LFO.
  1449. @item offset_l
  1450. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1451. @item offset_r
  1452. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1453. @item width
  1454. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1455. @item timing
  1456. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1457. @item bpm
  1458. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1459. is set to bpm.
  1460. @item ms
  1461. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1462. is set to ms.
  1463. @item hz
  1464. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1465. if timing is set to hz.
  1466. @end table
  1467. @anchor{aresample}
  1468. @section aresample
  1469. Resample the input audio to the specified parameters, using the
  1470. libswresample library. If none are specified then the filter will
  1471. automatically convert between its input and output.
  1472. This filter is also able to stretch/squeeze the audio data to make it match
  1473. the timestamps or to inject silence / cut out audio to make it match the
  1474. timestamps, do a combination of both or do neither.
  1475. The filter accepts the syntax
  1476. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1477. expresses a sample rate and @var{resampler_options} is a list of
  1478. @var{key}=@var{value} pairs, separated by ":". See the
  1479. @ref{Resampler Options,,"Resampler Options" section in the
  1480. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1481. for the complete list of supported options.
  1482. @subsection Examples
  1483. @itemize
  1484. @item
  1485. Resample the input audio to 44100Hz:
  1486. @example
  1487. aresample=44100
  1488. @end example
  1489. @item
  1490. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1491. samples per second compensation:
  1492. @example
  1493. aresample=async=1000
  1494. @end example
  1495. @end itemize
  1496. @section areverse
  1497. Reverse an audio clip.
  1498. Warning: This filter requires memory to buffer the entire clip, so trimming
  1499. is suggested.
  1500. @subsection Examples
  1501. @itemize
  1502. @item
  1503. Take the first 5 seconds of a clip, and reverse it.
  1504. @example
  1505. atrim=end=5,areverse
  1506. @end example
  1507. @end itemize
  1508. @section asetnsamples
  1509. Set the number of samples per each output audio frame.
  1510. The last output packet may contain a different number of samples, as
  1511. the filter will flush all the remaining samples when the input audio
  1512. signals its end.
  1513. The filter accepts the following options:
  1514. @table @option
  1515. @item nb_out_samples, n
  1516. Set the number of frames per each output audio frame. The number is
  1517. intended as the number of samples @emph{per each channel}.
  1518. Default value is 1024.
  1519. @item pad, p
  1520. If set to 1, the filter will pad the last audio frame with zeroes, so
  1521. that the last frame will contain the same number of samples as the
  1522. previous ones. Default value is 1.
  1523. @end table
  1524. For example, to set the number of per-frame samples to 1234 and
  1525. disable padding for the last frame, use:
  1526. @example
  1527. asetnsamples=n=1234:p=0
  1528. @end example
  1529. @section asetrate
  1530. Set the sample rate without altering the PCM data.
  1531. This will result in a change of speed and pitch.
  1532. The filter accepts the following options:
  1533. @table @option
  1534. @item sample_rate, r
  1535. Set the output sample rate. Default is 44100 Hz.
  1536. @end table
  1537. @section ashowinfo
  1538. Show a line containing various information for each input audio frame.
  1539. The input audio is not modified.
  1540. The shown line contains a sequence of key/value pairs of the form
  1541. @var{key}:@var{value}.
  1542. The following values are shown in the output:
  1543. @table @option
  1544. @item n
  1545. The (sequential) number of the input frame, starting from 0.
  1546. @item pts
  1547. The presentation timestamp of the input frame, in time base units; the time base
  1548. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1549. @item pts_time
  1550. The presentation timestamp of the input frame in seconds.
  1551. @item pos
  1552. position of the frame in the input stream, -1 if this information in
  1553. unavailable and/or meaningless (for example in case of synthetic audio)
  1554. @item fmt
  1555. The sample format.
  1556. @item chlayout
  1557. The channel layout.
  1558. @item rate
  1559. The sample rate for the audio frame.
  1560. @item nb_samples
  1561. The number of samples (per channel) in the frame.
  1562. @item checksum
  1563. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1564. audio, the data is treated as if all the planes were concatenated.
  1565. @item plane_checksums
  1566. A list of Adler-32 checksums for each data plane.
  1567. @end table
  1568. @anchor{astats}
  1569. @section astats
  1570. Display time domain statistical information about the audio channels.
  1571. Statistics are calculated and displayed for each audio channel and,
  1572. where applicable, an overall figure is also given.
  1573. It accepts the following option:
  1574. @table @option
  1575. @item length
  1576. Short window length in seconds, used for peak and trough RMS measurement.
  1577. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1578. @item metadata
  1579. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1580. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1581. disabled.
  1582. Available keys for each channel are:
  1583. DC_offset
  1584. Min_level
  1585. Max_level
  1586. Min_difference
  1587. Max_difference
  1588. Mean_difference
  1589. RMS_difference
  1590. Peak_level
  1591. RMS_peak
  1592. RMS_trough
  1593. Crest_factor
  1594. Flat_factor
  1595. Peak_count
  1596. Bit_depth
  1597. Dynamic_range
  1598. Zero_crossings
  1599. Zero_crossings_rate
  1600. and for Overall:
  1601. DC_offset
  1602. Min_level
  1603. Max_level
  1604. Min_difference
  1605. Max_difference
  1606. Mean_difference
  1607. RMS_difference
  1608. Peak_level
  1609. RMS_level
  1610. RMS_peak
  1611. RMS_trough
  1612. Flat_factor
  1613. Peak_count
  1614. Bit_depth
  1615. Number_of_samples
  1616. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1617. this @code{lavfi.astats.Overall.Peak_count}.
  1618. For description what each key means read below.
  1619. @item reset
  1620. Set number of frame after which stats are going to be recalculated.
  1621. Default is disabled.
  1622. @end table
  1623. A description of each shown parameter follows:
  1624. @table @option
  1625. @item DC offset
  1626. Mean amplitude displacement from zero.
  1627. @item Min level
  1628. Minimal sample level.
  1629. @item Max level
  1630. Maximal sample level.
  1631. @item Min difference
  1632. Minimal difference between two consecutive samples.
  1633. @item Max difference
  1634. Maximal difference between two consecutive samples.
  1635. @item Mean difference
  1636. Mean difference between two consecutive samples.
  1637. The average of each difference between two consecutive samples.
  1638. @item RMS difference
  1639. Root Mean Square difference between two consecutive samples.
  1640. @item Peak level dB
  1641. @item RMS level dB
  1642. Standard peak and RMS level measured in dBFS.
  1643. @item RMS peak dB
  1644. @item RMS trough dB
  1645. Peak and trough values for RMS level measured over a short window.
  1646. @item Crest factor
  1647. Standard ratio of peak to RMS level (note: not in dB).
  1648. @item Flat factor
  1649. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1650. (i.e. either @var{Min level} or @var{Max level}).
  1651. @item Peak count
  1652. Number of occasions (not the number of samples) that the signal attained either
  1653. @var{Min level} or @var{Max level}.
  1654. @item Bit depth
  1655. Overall bit depth of audio. Number of bits used for each sample.
  1656. @item Dynamic range
  1657. Measured dynamic range of audio in dB.
  1658. @item Zero crossings
  1659. Number of points where the waveform crosses the zero level axis.
  1660. @item Zero crossings rate
  1661. Rate of Zero crossings and number of audio samples.
  1662. @end table
  1663. @section atempo
  1664. Adjust audio tempo.
  1665. The filter accepts exactly one parameter, the audio tempo. If not
  1666. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1667. be in the [0.5, 100.0] range.
  1668. Note that tempo greater than 2 will skip some samples rather than
  1669. blend them in. If for any reason this is a concern it is always
  1670. possible to daisy-chain several instances of atempo to achieve the
  1671. desired product tempo.
  1672. @subsection Examples
  1673. @itemize
  1674. @item
  1675. Slow down audio to 80% tempo:
  1676. @example
  1677. atempo=0.8
  1678. @end example
  1679. @item
  1680. To speed up audio to 300% tempo:
  1681. @example
  1682. atempo=3
  1683. @end example
  1684. @item
  1685. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1686. @example
  1687. atempo=sqrt(3),atempo=sqrt(3)
  1688. @end example
  1689. @end itemize
  1690. @section atrim
  1691. Trim the input so that the output contains one continuous subpart of the input.
  1692. It accepts the following parameters:
  1693. @table @option
  1694. @item start
  1695. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1696. sample with the timestamp @var{start} will be the first sample in the output.
  1697. @item end
  1698. Specify time of the first audio sample that will be dropped, i.e. the
  1699. audio sample immediately preceding the one with the timestamp @var{end} will be
  1700. the last sample in the output.
  1701. @item start_pts
  1702. Same as @var{start}, except this option sets the start timestamp in samples
  1703. instead of seconds.
  1704. @item end_pts
  1705. Same as @var{end}, except this option sets the end timestamp in samples instead
  1706. of seconds.
  1707. @item duration
  1708. The maximum duration of the output in seconds.
  1709. @item start_sample
  1710. The number of the first sample that should be output.
  1711. @item end_sample
  1712. The number of the first sample that should be dropped.
  1713. @end table
  1714. @option{start}, @option{end}, and @option{duration} are expressed as time
  1715. duration specifications; see
  1716. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1717. Note that the first two sets of the start/end options and the @option{duration}
  1718. option look at the frame timestamp, while the _sample options simply count the
  1719. samples that pass through the filter. So start/end_pts and start/end_sample will
  1720. give different results when the timestamps are wrong, inexact or do not start at
  1721. zero. Also note that this filter does not modify the timestamps. If you wish
  1722. to have the output timestamps start at zero, insert the asetpts filter after the
  1723. atrim filter.
  1724. If multiple start or end options are set, this filter tries to be greedy and
  1725. keep all samples that match at least one of the specified constraints. To keep
  1726. only the part that matches all the constraints at once, chain multiple atrim
  1727. filters.
  1728. The defaults are such that all the input is kept. So it is possible to set e.g.
  1729. just the end values to keep everything before the specified time.
  1730. Examples:
  1731. @itemize
  1732. @item
  1733. Drop everything except the second minute of input:
  1734. @example
  1735. ffmpeg -i INPUT -af atrim=60:120
  1736. @end example
  1737. @item
  1738. Keep only the first 1000 samples:
  1739. @example
  1740. ffmpeg -i INPUT -af atrim=end_sample=1000
  1741. @end example
  1742. @end itemize
  1743. @section bandpass
  1744. Apply a two-pole Butterworth band-pass filter with central
  1745. frequency @var{frequency}, and (3dB-point) band-width width.
  1746. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1747. instead of the default: constant 0dB peak gain.
  1748. The filter roll off at 6dB per octave (20dB per decade).
  1749. The filter accepts the following options:
  1750. @table @option
  1751. @item frequency, f
  1752. Set the filter's central frequency. Default is @code{3000}.
  1753. @item csg
  1754. Constant skirt gain if set to 1. Defaults to 0.
  1755. @item width_type, t
  1756. Set method to specify band-width of filter.
  1757. @table @option
  1758. @item h
  1759. Hz
  1760. @item q
  1761. Q-Factor
  1762. @item o
  1763. octave
  1764. @item s
  1765. slope
  1766. @item k
  1767. kHz
  1768. @end table
  1769. @item width, w
  1770. Specify the band-width of a filter in width_type units.
  1771. @item channels, c
  1772. Specify which channels to filter, by default all available are filtered.
  1773. @end table
  1774. @subsection Commands
  1775. This filter supports the following commands:
  1776. @table @option
  1777. @item frequency, f
  1778. Change bandpass frequency.
  1779. Syntax for the command is : "@var{frequency}"
  1780. @item width_type, t
  1781. Change bandpass width_type.
  1782. Syntax for the command is : "@var{width_type}"
  1783. @item width, w
  1784. Change bandpass width.
  1785. Syntax for the command is : "@var{width}"
  1786. @end table
  1787. @section bandreject
  1788. Apply a two-pole Butterworth band-reject filter with central
  1789. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1790. The filter roll off at 6dB per octave (20dB per decade).
  1791. The filter accepts the following options:
  1792. @table @option
  1793. @item frequency, f
  1794. Set the filter's central frequency. Default is @code{3000}.
  1795. @item width_type, t
  1796. Set method to specify band-width of filter.
  1797. @table @option
  1798. @item h
  1799. Hz
  1800. @item q
  1801. Q-Factor
  1802. @item o
  1803. octave
  1804. @item s
  1805. slope
  1806. @item k
  1807. kHz
  1808. @end table
  1809. @item width, w
  1810. Specify the band-width of a filter in width_type units.
  1811. @item channels, c
  1812. Specify which channels to filter, by default all available are filtered.
  1813. @end table
  1814. @subsection Commands
  1815. This filter supports the following commands:
  1816. @table @option
  1817. @item frequency, f
  1818. Change bandreject frequency.
  1819. Syntax for the command is : "@var{frequency}"
  1820. @item width_type, t
  1821. Change bandreject width_type.
  1822. Syntax for the command is : "@var{width_type}"
  1823. @item width, w
  1824. Change bandreject width.
  1825. Syntax for the command is : "@var{width}"
  1826. @end table
  1827. @section bass, lowshelf
  1828. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1829. shelving filter with a response similar to that of a standard
  1830. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1831. The filter accepts the following options:
  1832. @table @option
  1833. @item gain, g
  1834. Give the gain at 0 Hz. Its useful range is about -20
  1835. (for a large cut) to +20 (for a large boost).
  1836. Beware of clipping when using a positive gain.
  1837. @item frequency, f
  1838. Set the filter's central frequency and so can be used
  1839. to extend or reduce the frequency range to be boosted or cut.
  1840. The default value is @code{100} Hz.
  1841. @item width_type, t
  1842. Set method to specify band-width of filter.
  1843. @table @option
  1844. @item h
  1845. Hz
  1846. @item q
  1847. Q-Factor
  1848. @item o
  1849. octave
  1850. @item s
  1851. slope
  1852. @item k
  1853. kHz
  1854. @end table
  1855. @item width, w
  1856. Determine how steep is the filter's shelf transition.
  1857. @item channels, c
  1858. Specify which channels to filter, by default all available are filtered.
  1859. @end table
  1860. @subsection Commands
  1861. This filter supports the following commands:
  1862. @table @option
  1863. @item frequency, f
  1864. Change bass frequency.
  1865. Syntax for the command is : "@var{frequency}"
  1866. @item width_type, t
  1867. Change bass width_type.
  1868. Syntax for the command is : "@var{width_type}"
  1869. @item width, w
  1870. Change bass width.
  1871. Syntax for the command is : "@var{width}"
  1872. @item gain, g
  1873. Change bass gain.
  1874. Syntax for the command is : "@var{gain}"
  1875. @end table
  1876. @section biquad
  1877. Apply a biquad IIR filter with the given coefficients.
  1878. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1879. are the numerator and denominator coefficients respectively.
  1880. and @var{channels}, @var{c} specify which channels to filter, by default all
  1881. available are filtered.
  1882. @subsection Commands
  1883. This filter supports the following commands:
  1884. @table @option
  1885. @item a0
  1886. @item a1
  1887. @item a2
  1888. @item b0
  1889. @item b1
  1890. @item b2
  1891. Change biquad parameter.
  1892. Syntax for the command is : "@var{value}"
  1893. @end table
  1894. @section bs2b
  1895. Bauer stereo to binaural transformation, which improves headphone listening of
  1896. stereo audio records.
  1897. To enable compilation of this filter you need to configure FFmpeg with
  1898. @code{--enable-libbs2b}.
  1899. It accepts the following parameters:
  1900. @table @option
  1901. @item profile
  1902. Pre-defined crossfeed level.
  1903. @table @option
  1904. @item default
  1905. Default level (fcut=700, feed=50).
  1906. @item cmoy
  1907. Chu Moy circuit (fcut=700, feed=60).
  1908. @item jmeier
  1909. Jan Meier circuit (fcut=650, feed=95).
  1910. @end table
  1911. @item fcut
  1912. Cut frequency (in Hz).
  1913. @item feed
  1914. Feed level (in Hz).
  1915. @end table
  1916. @section channelmap
  1917. Remap input channels to new locations.
  1918. It accepts the following parameters:
  1919. @table @option
  1920. @item map
  1921. Map channels from input to output. The argument is a '|'-separated list of
  1922. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1923. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1924. channel (e.g. FL for front left) or its index in the input channel layout.
  1925. @var{out_channel} is the name of the output channel or its index in the output
  1926. channel layout. If @var{out_channel} is not given then it is implicitly an
  1927. index, starting with zero and increasing by one for each mapping.
  1928. @item channel_layout
  1929. The channel layout of the output stream.
  1930. @end table
  1931. If no mapping is present, the filter will implicitly map input channels to
  1932. output channels, preserving indices.
  1933. @subsection Examples
  1934. @itemize
  1935. @item
  1936. For example, assuming a 5.1+downmix input MOV file,
  1937. @example
  1938. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1939. @end example
  1940. will create an output WAV file tagged as stereo from the downmix channels of
  1941. the input.
  1942. @item
  1943. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1944. @example
  1945. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1946. @end example
  1947. @end itemize
  1948. @section channelsplit
  1949. Split each channel from an input audio stream into a separate output stream.
  1950. It accepts the following parameters:
  1951. @table @option
  1952. @item channel_layout
  1953. The channel layout of the input stream. The default is "stereo".
  1954. @item channels
  1955. A channel layout describing the channels to be extracted as separate output streams
  1956. or "all" to extract each input channel as a separate stream. The default is "all".
  1957. Choosing channels not present in channel layout in the input will result in an error.
  1958. @end table
  1959. @subsection Examples
  1960. @itemize
  1961. @item
  1962. For example, assuming a stereo input MP3 file,
  1963. @example
  1964. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1965. @end example
  1966. will create an output Matroska file with two audio streams, one containing only
  1967. the left channel and the other the right channel.
  1968. @item
  1969. Split a 5.1 WAV file into per-channel files:
  1970. @example
  1971. ffmpeg -i in.wav -filter_complex
  1972. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1973. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1974. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1975. side_right.wav
  1976. @end example
  1977. @item
  1978. Extract only LFE from a 5.1 WAV file:
  1979. @example
  1980. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1981. -map '[LFE]' lfe.wav
  1982. @end example
  1983. @end itemize
  1984. @section chorus
  1985. Add a chorus effect to the audio.
  1986. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1987. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1988. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1989. The modulation depth defines the range the modulated delay is played before or after
  1990. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1991. sound tuned around the original one, like in a chorus where some vocals are slightly
  1992. off key.
  1993. It accepts the following parameters:
  1994. @table @option
  1995. @item in_gain
  1996. Set input gain. Default is 0.4.
  1997. @item out_gain
  1998. Set output gain. Default is 0.4.
  1999. @item delays
  2000. Set delays. A typical delay is around 40ms to 60ms.
  2001. @item decays
  2002. Set decays.
  2003. @item speeds
  2004. Set speeds.
  2005. @item depths
  2006. Set depths.
  2007. @end table
  2008. @subsection Examples
  2009. @itemize
  2010. @item
  2011. A single delay:
  2012. @example
  2013. chorus=0.7:0.9:55:0.4:0.25:2
  2014. @end example
  2015. @item
  2016. Two delays:
  2017. @example
  2018. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2019. @end example
  2020. @item
  2021. Fuller sounding chorus with three delays:
  2022. @example
  2023. 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
  2024. @end example
  2025. @end itemize
  2026. @section compand
  2027. Compress or expand the audio's dynamic range.
  2028. It accepts the following parameters:
  2029. @table @option
  2030. @item attacks
  2031. @item decays
  2032. A list of times in seconds for each channel over which the instantaneous level
  2033. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2034. increase of volume and @var{decays} refers to decrease of volume. For most
  2035. situations, the attack time (response to the audio getting louder) should be
  2036. shorter than the decay time, because the human ear is more sensitive to sudden
  2037. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2038. a typical value for decay is 0.8 seconds.
  2039. If specified number of attacks & decays is lower than number of channels, the last
  2040. set attack/decay will be used for all remaining channels.
  2041. @item points
  2042. A list of points for the transfer function, specified in dB relative to the
  2043. maximum possible signal amplitude. Each key points list must be defined using
  2044. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2045. @code{x0/y0 x1/y1 x2/y2 ....}
  2046. The input values must be in strictly increasing order but the transfer function
  2047. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2048. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2049. function are @code{-70/-70|-60/-20|1/0}.
  2050. @item soft-knee
  2051. Set the curve radius in dB for all joints. It defaults to 0.01.
  2052. @item gain
  2053. Set the additional gain in dB to be applied at all points on the transfer
  2054. function. This allows for easy adjustment of the overall gain.
  2055. It defaults to 0.
  2056. @item volume
  2057. Set an initial volume, in dB, to be assumed for each channel when filtering
  2058. starts. This permits the user to supply a nominal level initially, so that, for
  2059. example, a very large gain is not applied to initial signal levels before the
  2060. companding has begun to operate. A typical value for audio which is initially
  2061. quiet is -90 dB. It defaults to 0.
  2062. @item delay
  2063. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2064. delayed before being fed to the volume adjuster. Specifying a delay
  2065. approximately equal to the attack/decay times allows the filter to effectively
  2066. operate in predictive rather than reactive mode. It defaults to 0.
  2067. @end table
  2068. @subsection Examples
  2069. @itemize
  2070. @item
  2071. Make music with both quiet and loud passages suitable for listening to in a
  2072. noisy environment:
  2073. @example
  2074. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2075. @end example
  2076. Another example for audio with whisper and explosion parts:
  2077. @example
  2078. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2079. @end example
  2080. @item
  2081. A noise gate for when the noise is at a lower level than the signal:
  2082. @example
  2083. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2084. @end example
  2085. @item
  2086. Here is another noise gate, this time for when the noise is at a higher level
  2087. than the signal (making it, in some ways, similar to squelch):
  2088. @example
  2089. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2090. @end example
  2091. @item
  2092. 2:1 compression starting at -6dB:
  2093. @example
  2094. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2095. @end example
  2096. @item
  2097. 2:1 compression starting at -9dB:
  2098. @example
  2099. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2100. @end example
  2101. @item
  2102. 2:1 compression starting at -12dB:
  2103. @example
  2104. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2105. @end example
  2106. @item
  2107. 2:1 compression starting at -18dB:
  2108. @example
  2109. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2110. @end example
  2111. @item
  2112. 3:1 compression starting at -15dB:
  2113. @example
  2114. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2115. @end example
  2116. @item
  2117. Compressor/Gate:
  2118. @example
  2119. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2120. @end example
  2121. @item
  2122. Expander:
  2123. @example
  2124. 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
  2125. @end example
  2126. @item
  2127. Hard limiter at -6dB:
  2128. @example
  2129. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2130. @end example
  2131. @item
  2132. Hard limiter at -12dB:
  2133. @example
  2134. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2135. @end example
  2136. @item
  2137. Hard noise gate at -35 dB:
  2138. @example
  2139. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2140. @end example
  2141. @item
  2142. Soft limiter:
  2143. @example
  2144. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2145. @end example
  2146. @end itemize
  2147. @section compensationdelay
  2148. Compensation Delay Line is a metric based delay to compensate differing
  2149. positions of microphones or speakers.
  2150. For example, you have recorded guitar with two microphones placed in
  2151. different location. Because the front of sound wave has fixed speed in
  2152. normal conditions, the phasing of microphones can vary and depends on
  2153. their location and interposition. The best sound mix can be achieved when
  2154. these microphones are in phase (synchronized). Note that distance of
  2155. ~30 cm between microphones makes one microphone to capture signal in
  2156. antiphase to another microphone. That makes the final mix sounding moody.
  2157. This filter helps to solve phasing problems by adding different delays
  2158. to each microphone track and make them synchronized.
  2159. The best result can be reached when you take one track as base and
  2160. synchronize other tracks one by one with it.
  2161. Remember that synchronization/delay tolerance depends on sample rate, too.
  2162. Higher sample rates will give more tolerance.
  2163. It accepts the following parameters:
  2164. @table @option
  2165. @item mm
  2166. Set millimeters distance. This is compensation distance for fine tuning.
  2167. Default is 0.
  2168. @item cm
  2169. Set cm distance. This is compensation distance for tightening distance setup.
  2170. Default is 0.
  2171. @item m
  2172. Set meters distance. This is compensation distance for hard distance setup.
  2173. Default is 0.
  2174. @item dry
  2175. Set dry amount. Amount of unprocessed (dry) signal.
  2176. Default is 0.
  2177. @item wet
  2178. Set wet amount. Amount of processed (wet) signal.
  2179. Default is 1.
  2180. @item temp
  2181. Set temperature degree in Celsius. This is the temperature of the environment.
  2182. Default is 20.
  2183. @end table
  2184. @section crossfeed
  2185. Apply headphone crossfeed filter.
  2186. Crossfeed is the process of blending the left and right channels of stereo
  2187. audio recording.
  2188. It is mainly used to reduce extreme stereo separation of low frequencies.
  2189. The intent is to produce more speaker like sound to the listener.
  2190. The filter accepts the following options:
  2191. @table @option
  2192. @item strength
  2193. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2194. This sets gain of low shelf filter for side part of stereo image.
  2195. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2196. @item range
  2197. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2198. This sets cut off frequency of low shelf filter. Default is cut off near
  2199. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2200. @item level_in
  2201. Set input gain. Default is 0.9.
  2202. @item level_out
  2203. Set output gain. Default is 1.
  2204. @end table
  2205. @section crystalizer
  2206. Simple algorithm to expand audio dynamic range.
  2207. The filter accepts the following options:
  2208. @table @option
  2209. @item i
  2210. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2211. (unchanged sound) to 10.0 (maximum effect).
  2212. @item c
  2213. Enable clipping. By default is enabled.
  2214. @end table
  2215. @section dcshift
  2216. Apply a DC shift to the audio.
  2217. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2218. in the recording chain) from the audio. The effect of a DC offset is reduced
  2219. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2220. a signal has a DC offset.
  2221. @table @option
  2222. @item shift
  2223. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2224. the audio.
  2225. @item limitergain
  2226. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2227. used to prevent clipping.
  2228. @end table
  2229. @section drmeter
  2230. Measure audio dynamic range.
  2231. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2232. is found in transition material. And anything less that 8 have very poor dynamics
  2233. and is very compressed.
  2234. The filter accepts the following options:
  2235. @table @option
  2236. @item length
  2237. Set window length in seconds used to split audio into segments of equal length.
  2238. Default is 3 seconds.
  2239. @end table
  2240. @section dynaudnorm
  2241. Dynamic Audio Normalizer.
  2242. This filter applies a certain amount of gain to the input audio in order
  2243. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2244. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2245. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2246. This allows for applying extra gain to the "quiet" sections of the audio
  2247. while avoiding distortions or clipping the "loud" sections. In other words:
  2248. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2249. sections, in the sense that the volume of each section is brought to the
  2250. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2251. this goal *without* applying "dynamic range compressing". It will retain 100%
  2252. of the dynamic range *within* each section of the audio file.
  2253. @table @option
  2254. @item f
  2255. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2256. Default is 500 milliseconds.
  2257. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2258. referred to as frames. This is required, because a peak magnitude has no
  2259. meaning for just a single sample value. Instead, we need to determine the
  2260. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2261. normalizer would simply use the peak magnitude of the complete file, the
  2262. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2263. frame. The length of a frame is specified in milliseconds. By default, the
  2264. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2265. been found to give good results with most files.
  2266. Note that the exact frame length, in number of samples, will be determined
  2267. automatically, based on the sampling rate of the individual input audio file.
  2268. @item g
  2269. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2270. number. Default is 31.
  2271. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2272. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2273. is specified in frames, centered around the current frame. For the sake of
  2274. simplicity, this must be an odd number. Consequently, the default value of 31
  2275. takes into account the current frame, as well as the 15 preceding frames and
  2276. the 15 subsequent frames. Using a larger window results in a stronger
  2277. smoothing effect and thus in less gain variation, i.e. slower gain
  2278. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2279. effect and thus in more gain variation, i.e. faster gain adaptation.
  2280. In other words, the more you increase this value, the more the Dynamic Audio
  2281. Normalizer will behave like a "traditional" normalization filter. On the
  2282. contrary, the more you decrease this value, the more the Dynamic Audio
  2283. Normalizer will behave like a dynamic range compressor.
  2284. @item p
  2285. Set the target peak value. This specifies the highest permissible magnitude
  2286. level for the normalized audio input. This filter will try to approach the
  2287. target peak magnitude as closely as possible, but at the same time it also
  2288. makes sure that the normalized signal will never exceed the peak magnitude.
  2289. A frame's maximum local gain factor is imposed directly by the target peak
  2290. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2291. It is not recommended to go above this value.
  2292. @item m
  2293. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2294. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2295. factor for each input frame, i.e. the maximum gain factor that does not
  2296. result in clipping or distortion. The maximum gain factor is determined by
  2297. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2298. additionally bounds the frame's maximum gain factor by a predetermined
  2299. (global) maximum gain factor. This is done in order to avoid excessive gain
  2300. factors in "silent" or almost silent frames. By default, the maximum gain
  2301. factor is 10.0, For most inputs the default value should be sufficient and
  2302. it usually is not recommended to increase this value. Though, for input
  2303. with an extremely low overall volume level, it may be necessary to allow even
  2304. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2305. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2306. Instead, a "sigmoid" threshold function will be applied. This way, the
  2307. gain factors will smoothly approach the threshold value, but never exceed that
  2308. value.
  2309. @item r
  2310. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2311. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2312. This means that the maximum local gain factor for each frame is defined
  2313. (only) by the frame's highest magnitude sample. This way, the samples can
  2314. be amplified as much as possible without exceeding the maximum signal
  2315. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2316. Normalizer can also take into account the frame's root mean square,
  2317. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2318. determine the power of a time-varying signal. It is therefore considered
  2319. that the RMS is a better approximation of the "perceived loudness" than
  2320. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2321. frames to a constant RMS value, a uniform "perceived loudness" can be
  2322. established. If a target RMS value has been specified, a frame's local gain
  2323. factor is defined as the factor that would result in exactly that RMS value.
  2324. Note, however, that the maximum local gain factor is still restricted by the
  2325. frame's highest magnitude sample, in order to prevent clipping.
  2326. @item n
  2327. Enable channels coupling. By default is enabled.
  2328. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2329. amount. This means the same gain factor will be applied to all channels, i.e.
  2330. the maximum possible gain factor is determined by the "loudest" channel.
  2331. However, in some recordings, it may happen that the volume of the different
  2332. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2333. In this case, this option can be used to disable the channel coupling. This way,
  2334. the gain factor will be determined independently for each channel, depending
  2335. only on the individual channel's highest magnitude sample. This allows for
  2336. harmonizing the volume of the different channels.
  2337. @item c
  2338. Enable DC bias correction. By default is disabled.
  2339. An audio signal (in the time domain) is a sequence of sample values.
  2340. In the Dynamic Audio Normalizer these sample values are represented in the
  2341. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2342. audio signal, or "waveform", should be centered around the zero point.
  2343. That means if we calculate the mean value of all samples in a file, or in a
  2344. single frame, then the result should be 0.0 or at least very close to that
  2345. value. If, however, there is a significant deviation of the mean value from
  2346. 0.0, in either positive or negative direction, this is referred to as a
  2347. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2348. Audio Normalizer provides optional DC bias correction.
  2349. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2350. the mean value, or "DC correction" offset, of each input frame and subtract
  2351. that value from all of the frame's sample values which ensures those samples
  2352. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2353. boundaries, the DC correction offset values will be interpolated smoothly
  2354. between neighbouring frames.
  2355. @item b
  2356. Enable alternative boundary mode. By default is disabled.
  2357. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2358. around each frame. This includes the preceding frames as well as the
  2359. subsequent frames. However, for the "boundary" frames, located at the very
  2360. beginning and at the very end of the audio file, not all neighbouring
  2361. frames are available. In particular, for the first few frames in the audio
  2362. file, the preceding frames are not known. And, similarly, for the last few
  2363. frames in the audio file, the subsequent frames are not known. Thus, the
  2364. question arises which gain factors should be assumed for the missing frames
  2365. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2366. to deal with this situation. The default boundary mode assumes a gain factor
  2367. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2368. "fade out" at the beginning and at the end of the input, respectively.
  2369. @item s
  2370. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2371. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2372. compression. This means that signal peaks will not be pruned and thus the
  2373. full dynamic range will be retained within each local neighbourhood. However,
  2374. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2375. normalization algorithm with a more "traditional" compression.
  2376. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2377. (thresholding) function. If (and only if) the compression feature is enabled,
  2378. all input frames will be processed by a soft knee thresholding function prior
  2379. to the actual normalization process. Put simply, the thresholding function is
  2380. going to prune all samples whose magnitude exceeds a certain threshold value.
  2381. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2382. value. Instead, the threshold value will be adjusted for each individual
  2383. frame.
  2384. In general, smaller parameters result in stronger compression, and vice versa.
  2385. Values below 3.0 are not recommended, because audible distortion may appear.
  2386. @end table
  2387. @section earwax
  2388. Make audio easier to listen to on headphones.
  2389. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2390. so that when listened to on headphones the stereo image is moved from
  2391. inside your head (standard for headphones) to outside and in front of
  2392. the listener (standard for speakers).
  2393. Ported from SoX.
  2394. @section equalizer
  2395. Apply a two-pole peaking equalisation (EQ) filter. With this
  2396. filter, the signal-level at and around a selected frequency can
  2397. be increased or decreased, whilst (unlike bandpass and bandreject
  2398. filters) that at all other frequencies is unchanged.
  2399. In order to produce complex equalisation curves, this filter can
  2400. be given several times, each with a different central frequency.
  2401. The filter accepts the following options:
  2402. @table @option
  2403. @item frequency, f
  2404. Set the filter's central frequency in Hz.
  2405. @item width_type, t
  2406. Set method to specify band-width of filter.
  2407. @table @option
  2408. @item h
  2409. Hz
  2410. @item q
  2411. Q-Factor
  2412. @item o
  2413. octave
  2414. @item s
  2415. slope
  2416. @item k
  2417. kHz
  2418. @end table
  2419. @item width, w
  2420. Specify the band-width of a filter in width_type units.
  2421. @item gain, g
  2422. Set the required gain or attenuation in dB.
  2423. Beware of clipping when using a positive gain.
  2424. @item channels, c
  2425. Specify which channels to filter, by default all available are filtered.
  2426. @end table
  2427. @subsection Examples
  2428. @itemize
  2429. @item
  2430. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2431. @example
  2432. equalizer=f=1000:t=h:width=200:g=-10
  2433. @end example
  2434. @item
  2435. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2436. @example
  2437. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2438. @end example
  2439. @end itemize
  2440. @subsection Commands
  2441. This filter supports the following commands:
  2442. @table @option
  2443. @item frequency, f
  2444. Change equalizer frequency.
  2445. Syntax for the command is : "@var{frequency}"
  2446. @item width_type, t
  2447. Change equalizer width_type.
  2448. Syntax for the command is : "@var{width_type}"
  2449. @item width, w
  2450. Change equalizer width.
  2451. Syntax for the command is : "@var{width}"
  2452. @item gain, g
  2453. Change equalizer gain.
  2454. Syntax for the command is : "@var{gain}"
  2455. @end table
  2456. @section extrastereo
  2457. Linearly increases the difference between left and right channels which
  2458. adds some sort of "live" effect to playback.
  2459. The filter accepts the following options:
  2460. @table @option
  2461. @item m
  2462. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2463. (average of both channels), with 1.0 sound will be unchanged, with
  2464. -1.0 left and right channels will be swapped.
  2465. @item c
  2466. Enable clipping. By default is enabled.
  2467. @end table
  2468. @section firequalizer
  2469. Apply FIR Equalization using arbitrary frequency response.
  2470. The filter accepts the following option:
  2471. @table @option
  2472. @item gain
  2473. Set gain curve equation (in dB). The expression can contain variables:
  2474. @table @option
  2475. @item f
  2476. the evaluated frequency
  2477. @item sr
  2478. sample rate
  2479. @item ch
  2480. channel number, set to 0 when multichannels evaluation is disabled
  2481. @item chid
  2482. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2483. multichannels evaluation is disabled
  2484. @item chs
  2485. number of channels
  2486. @item chlayout
  2487. channel_layout, see libavutil/channel_layout.h
  2488. @end table
  2489. and functions:
  2490. @table @option
  2491. @item gain_interpolate(f)
  2492. interpolate gain on frequency f based on gain_entry
  2493. @item cubic_interpolate(f)
  2494. same as gain_interpolate, but smoother
  2495. @end table
  2496. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2497. @item gain_entry
  2498. Set gain entry for gain_interpolate function. The expression can
  2499. contain functions:
  2500. @table @option
  2501. @item entry(f, g)
  2502. store gain entry at frequency f with value g
  2503. @end table
  2504. This option is also available as command.
  2505. @item delay
  2506. Set filter delay in seconds. Higher value means more accurate.
  2507. Default is @code{0.01}.
  2508. @item accuracy
  2509. Set filter accuracy in Hz. Lower value means more accurate.
  2510. Default is @code{5}.
  2511. @item wfunc
  2512. Set window function. Acceptable values are:
  2513. @table @option
  2514. @item rectangular
  2515. rectangular window, useful when gain curve is already smooth
  2516. @item hann
  2517. hann window (default)
  2518. @item hamming
  2519. hamming window
  2520. @item blackman
  2521. blackman window
  2522. @item nuttall3
  2523. 3-terms continuous 1st derivative nuttall window
  2524. @item mnuttall3
  2525. minimum 3-terms discontinuous nuttall window
  2526. @item nuttall
  2527. 4-terms continuous 1st derivative nuttall window
  2528. @item bnuttall
  2529. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2530. @item bharris
  2531. blackman-harris window
  2532. @item tukey
  2533. tukey window
  2534. @end table
  2535. @item fixed
  2536. If enabled, use fixed number of audio samples. This improves speed when
  2537. filtering with large delay. Default is disabled.
  2538. @item multi
  2539. Enable multichannels evaluation on gain. Default is disabled.
  2540. @item zero_phase
  2541. Enable zero phase mode by subtracting timestamp to compensate delay.
  2542. Default is disabled.
  2543. @item scale
  2544. Set scale used by gain. Acceptable values are:
  2545. @table @option
  2546. @item linlin
  2547. linear frequency, linear gain
  2548. @item linlog
  2549. linear frequency, logarithmic (in dB) gain (default)
  2550. @item loglin
  2551. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2552. @item loglog
  2553. logarithmic frequency, logarithmic gain
  2554. @end table
  2555. @item dumpfile
  2556. Set file for dumping, suitable for gnuplot.
  2557. @item dumpscale
  2558. Set scale for dumpfile. Acceptable values are same with scale option.
  2559. Default is linlog.
  2560. @item fft2
  2561. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2562. Default is disabled.
  2563. @item min_phase
  2564. Enable minimum phase impulse response. Default is disabled.
  2565. @end table
  2566. @subsection Examples
  2567. @itemize
  2568. @item
  2569. lowpass at 1000 Hz:
  2570. @example
  2571. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2572. @end example
  2573. @item
  2574. lowpass at 1000 Hz with gain_entry:
  2575. @example
  2576. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2577. @end example
  2578. @item
  2579. custom equalization:
  2580. @example
  2581. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2582. @end example
  2583. @item
  2584. higher delay with zero phase to compensate delay:
  2585. @example
  2586. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2587. @end example
  2588. @item
  2589. lowpass on left channel, highpass on right channel:
  2590. @example
  2591. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2592. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2593. @end example
  2594. @end itemize
  2595. @section flanger
  2596. Apply a flanging effect to the audio.
  2597. The filter accepts the following options:
  2598. @table @option
  2599. @item delay
  2600. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2601. @item depth
  2602. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2603. @item regen
  2604. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2605. Default value is 0.
  2606. @item width
  2607. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2608. Default value is 71.
  2609. @item speed
  2610. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2611. @item shape
  2612. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2613. Default value is @var{sinusoidal}.
  2614. @item phase
  2615. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2616. Default value is 25.
  2617. @item interp
  2618. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2619. Default is @var{linear}.
  2620. @end table
  2621. @section haas
  2622. Apply Haas effect to audio.
  2623. Note that this makes most sense to apply on mono signals.
  2624. With this filter applied to mono signals it give some directionality and
  2625. stretches its stereo image.
  2626. The filter accepts the following options:
  2627. @table @option
  2628. @item level_in
  2629. Set input level. By default is @var{1}, or 0dB
  2630. @item level_out
  2631. Set output level. By default is @var{1}, or 0dB.
  2632. @item side_gain
  2633. Set gain applied to side part of signal. By default is @var{1}.
  2634. @item middle_source
  2635. Set kind of middle source. Can be one of the following:
  2636. @table @samp
  2637. @item left
  2638. Pick left channel.
  2639. @item right
  2640. Pick right channel.
  2641. @item mid
  2642. Pick middle part signal of stereo image.
  2643. @item side
  2644. Pick side part signal of stereo image.
  2645. @end table
  2646. @item middle_phase
  2647. Change middle phase. By default is disabled.
  2648. @item left_delay
  2649. Set left channel delay. By default is @var{2.05} milliseconds.
  2650. @item left_balance
  2651. Set left channel balance. By default is @var{-1}.
  2652. @item left_gain
  2653. Set left channel gain. By default is @var{1}.
  2654. @item left_phase
  2655. Change left phase. By default is disabled.
  2656. @item right_delay
  2657. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2658. @item right_balance
  2659. Set right channel balance. By default is @var{1}.
  2660. @item right_gain
  2661. Set right channel gain. By default is @var{1}.
  2662. @item right_phase
  2663. Change right phase. By default is enabled.
  2664. @end table
  2665. @section hdcd
  2666. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2667. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2668. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2669. of HDCD, and detects the Transient Filter flag.
  2670. @example
  2671. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2672. @end example
  2673. When using the filter with wav, note the default encoding for wav is 16-bit,
  2674. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2675. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2676. @example
  2677. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2678. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2679. @end example
  2680. The filter accepts the following options:
  2681. @table @option
  2682. @item disable_autoconvert
  2683. Disable any automatic format conversion or resampling in the filter graph.
  2684. @item process_stereo
  2685. Process the stereo channels together. If target_gain does not match between
  2686. channels, consider it invalid and use the last valid target_gain.
  2687. @item cdt_ms
  2688. Set the code detect timer period in ms.
  2689. @item force_pe
  2690. Always extend peaks above -3dBFS even if PE isn't signaled.
  2691. @item analyze_mode
  2692. Replace audio with a solid tone and adjust the amplitude to signal some
  2693. specific aspect of the decoding process. The output file can be loaded in
  2694. an audio editor alongside the original to aid analysis.
  2695. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2696. Modes are:
  2697. @table @samp
  2698. @item 0, off
  2699. Disabled
  2700. @item 1, lle
  2701. Gain adjustment level at each sample
  2702. @item 2, pe
  2703. Samples where peak extend occurs
  2704. @item 3, cdt
  2705. Samples where the code detect timer is active
  2706. @item 4, tgm
  2707. Samples where the target gain does not match between channels
  2708. @end table
  2709. @end table
  2710. @section headphone
  2711. Apply head-related transfer functions (HRTFs) to create virtual
  2712. loudspeakers around the user for binaural listening via headphones.
  2713. The HRIRs are provided via additional streams, for each channel
  2714. one stereo input stream is needed.
  2715. The filter accepts the following options:
  2716. @table @option
  2717. @item map
  2718. Set mapping of input streams for convolution.
  2719. The argument is a '|'-separated list of channel names in order as they
  2720. are given as additional stream inputs for filter.
  2721. This also specify number of input streams. Number of input streams
  2722. must be not less than number of channels in first stream plus one.
  2723. @item gain
  2724. Set gain applied to audio. Value is in dB. Default is 0.
  2725. @item type
  2726. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2727. processing audio in time domain which is slow.
  2728. @var{freq} is processing audio in frequency domain which is fast.
  2729. Default is @var{freq}.
  2730. @item lfe
  2731. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2732. @item size
  2733. Set size of frame in number of samples which will be processed at once.
  2734. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2735. @item hrir
  2736. Set format of hrir stream.
  2737. Default value is @var{stereo}. Alternative value is @var{multich}.
  2738. If value is set to @var{stereo}, number of additional streams should
  2739. be greater or equal to number of input channels in first input stream.
  2740. Also each additional stream should have stereo number of channels.
  2741. If value is set to @var{multich}, number of additional streams should
  2742. be exactly one. Also number of input channels of additional stream
  2743. should be equal or greater than twice number of channels of first input
  2744. stream.
  2745. @end table
  2746. @subsection Examples
  2747. @itemize
  2748. @item
  2749. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2750. each amovie filter use stereo file with IR coefficients as input.
  2751. The files give coefficients for each position of virtual loudspeaker:
  2752. @example
  2753. 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"
  2754. output.wav
  2755. @end example
  2756. @item
  2757. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2758. but now in @var{multich} @var{hrir} format.
  2759. @example
  2760. 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"
  2761. output.wav
  2762. @end example
  2763. @end itemize
  2764. @section highpass
  2765. Apply a high-pass filter with 3dB point frequency.
  2766. The filter can be either single-pole, or double-pole (the default).
  2767. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2768. The filter accepts the following options:
  2769. @table @option
  2770. @item frequency, f
  2771. Set frequency in Hz. Default is 3000.
  2772. @item poles, p
  2773. Set number of poles. Default is 2.
  2774. @item width_type, t
  2775. Set method to specify band-width of filter.
  2776. @table @option
  2777. @item h
  2778. Hz
  2779. @item q
  2780. Q-Factor
  2781. @item o
  2782. octave
  2783. @item s
  2784. slope
  2785. @item k
  2786. kHz
  2787. @end table
  2788. @item width, w
  2789. Specify the band-width of a filter in width_type units.
  2790. Applies only to double-pole filter.
  2791. The default is 0.707q and gives a Butterworth response.
  2792. @item channels, c
  2793. Specify which channels to filter, by default all available are filtered.
  2794. @end table
  2795. @subsection Commands
  2796. This filter supports the following commands:
  2797. @table @option
  2798. @item frequency, f
  2799. Change highpass frequency.
  2800. Syntax for the command is : "@var{frequency}"
  2801. @item width_type, t
  2802. Change highpass width_type.
  2803. Syntax for the command is : "@var{width_type}"
  2804. @item width, w
  2805. Change highpass width.
  2806. Syntax for the command is : "@var{width}"
  2807. @end table
  2808. @section join
  2809. Join multiple input streams into one multi-channel stream.
  2810. It accepts the following parameters:
  2811. @table @option
  2812. @item inputs
  2813. The number of input streams. It defaults to 2.
  2814. @item channel_layout
  2815. The desired output channel layout. It defaults to stereo.
  2816. @item map
  2817. Map channels from inputs to output. The argument is a '|'-separated list of
  2818. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2819. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2820. can be either the name of the input channel (e.g. FL for front left) or its
  2821. index in the specified input stream. @var{out_channel} is the name of the output
  2822. channel.
  2823. @end table
  2824. The filter will attempt to guess the mappings when they are not specified
  2825. explicitly. It does so by first trying to find an unused matching input channel
  2826. and if that fails it picks the first unused input channel.
  2827. Join 3 inputs (with properly set channel layouts):
  2828. @example
  2829. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2830. @end example
  2831. Build a 5.1 output from 6 single-channel streams:
  2832. @example
  2833. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2834. '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'
  2835. out
  2836. @end example
  2837. @section ladspa
  2838. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2839. To enable compilation of this filter you need to configure FFmpeg with
  2840. @code{--enable-ladspa}.
  2841. @table @option
  2842. @item file, f
  2843. Specifies the name of LADSPA plugin library to load. If the environment
  2844. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2845. each one of the directories specified by the colon separated list in
  2846. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2847. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2848. @file{/usr/lib/ladspa/}.
  2849. @item plugin, p
  2850. Specifies the plugin within the library. Some libraries contain only
  2851. one plugin, but others contain many of them. If this is not set filter
  2852. will list all available plugins within the specified library.
  2853. @item controls, c
  2854. Set the '|' separated list of controls which are zero or more floating point
  2855. values that determine the behavior of the loaded plugin (for example delay,
  2856. threshold or gain).
  2857. Controls need to be defined using the following syntax:
  2858. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2859. @var{valuei} is the value set on the @var{i}-th control.
  2860. Alternatively they can be also defined using the following syntax:
  2861. @var{value0}|@var{value1}|@var{value2}|..., where
  2862. @var{valuei} is the value set on the @var{i}-th control.
  2863. If @option{controls} is set to @code{help}, all available controls and
  2864. their valid ranges are printed.
  2865. @item sample_rate, s
  2866. Specify the sample rate, default to 44100. Only used if plugin have
  2867. zero inputs.
  2868. @item nb_samples, n
  2869. Set the number of samples per channel per each output frame, default
  2870. is 1024. Only used if plugin have zero inputs.
  2871. @item duration, d
  2872. Set the minimum duration of the sourced audio. See
  2873. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2874. for the accepted syntax.
  2875. Note that the resulting duration may be greater than the specified duration,
  2876. as the generated audio is always cut at the end of a complete frame.
  2877. If not specified, or the expressed duration is negative, the audio is
  2878. supposed to be generated forever.
  2879. Only used if plugin have zero inputs.
  2880. @end table
  2881. @subsection Examples
  2882. @itemize
  2883. @item
  2884. List all available plugins within amp (LADSPA example plugin) library:
  2885. @example
  2886. ladspa=file=amp
  2887. @end example
  2888. @item
  2889. List all available controls and their valid ranges for @code{vcf_notch}
  2890. plugin from @code{VCF} library:
  2891. @example
  2892. ladspa=f=vcf:p=vcf_notch:c=help
  2893. @end example
  2894. @item
  2895. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2896. plugin library:
  2897. @example
  2898. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2899. @end example
  2900. @item
  2901. Add reverberation to the audio using TAP-plugins
  2902. (Tom's Audio Processing plugins):
  2903. @example
  2904. ladspa=file=tap_reverb:tap_reverb
  2905. @end example
  2906. @item
  2907. Generate white noise, with 0.2 amplitude:
  2908. @example
  2909. ladspa=file=cmt:noise_source_white:c=c0=.2
  2910. @end example
  2911. @item
  2912. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2913. @code{C* Audio Plugin Suite} (CAPS) library:
  2914. @example
  2915. ladspa=file=caps:Click:c=c1=20'
  2916. @end example
  2917. @item
  2918. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2919. @example
  2920. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2921. @end example
  2922. @item
  2923. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2924. @code{SWH Plugins} collection:
  2925. @example
  2926. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2927. @end example
  2928. @item
  2929. Attenuate low frequencies using Multiband EQ from Steve Harris
  2930. @code{SWH Plugins} collection:
  2931. @example
  2932. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2933. @end example
  2934. @item
  2935. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2936. (CAPS) library:
  2937. @example
  2938. ladspa=caps:Narrower
  2939. @end example
  2940. @item
  2941. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2942. @example
  2943. ladspa=caps:White:.2
  2944. @end example
  2945. @item
  2946. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2947. @example
  2948. ladspa=caps:Fractal:c=c1=1
  2949. @end example
  2950. @item
  2951. Dynamic volume normalization using @code{VLevel} plugin:
  2952. @example
  2953. ladspa=vlevel-ladspa:vlevel_mono
  2954. @end example
  2955. @end itemize
  2956. @subsection Commands
  2957. This filter supports the following commands:
  2958. @table @option
  2959. @item cN
  2960. Modify the @var{N}-th control value.
  2961. If the specified value is not valid, it is ignored and prior one is kept.
  2962. @end table
  2963. @section loudnorm
  2964. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2965. Support for both single pass (livestreams, files) and double pass (files) modes.
  2966. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2967. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2968. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2969. The filter accepts the following options:
  2970. @table @option
  2971. @item I, i
  2972. Set integrated loudness target.
  2973. Range is -70.0 - -5.0. Default value is -24.0.
  2974. @item LRA, lra
  2975. Set loudness range target.
  2976. Range is 1.0 - 20.0. Default value is 7.0.
  2977. @item TP, tp
  2978. Set maximum true peak.
  2979. Range is -9.0 - +0.0. Default value is -2.0.
  2980. @item measured_I, measured_i
  2981. Measured IL of input file.
  2982. Range is -99.0 - +0.0.
  2983. @item measured_LRA, measured_lra
  2984. Measured LRA of input file.
  2985. Range is 0.0 - 99.0.
  2986. @item measured_TP, measured_tp
  2987. Measured true peak of input file.
  2988. Range is -99.0 - +99.0.
  2989. @item measured_thresh
  2990. Measured threshold of input file.
  2991. Range is -99.0 - +0.0.
  2992. @item offset
  2993. Set offset gain. Gain is applied before the true-peak limiter.
  2994. Range is -99.0 - +99.0. Default is +0.0.
  2995. @item linear
  2996. Normalize linearly if possible.
  2997. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2998. to be specified in order to use this mode.
  2999. Options are true or false. Default is true.
  3000. @item dual_mono
  3001. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3002. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3003. If set to @code{true}, this option will compensate for this effect.
  3004. Multi-channel input files are not affected by this option.
  3005. Options are true or false. Default is false.
  3006. @item print_format
  3007. Set print format for stats. Options are summary, json, or none.
  3008. Default value is none.
  3009. @end table
  3010. @section lowpass
  3011. Apply a low-pass filter with 3dB point frequency.
  3012. The filter can be either single-pole or double-pole (the default).
  3013. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3014. The filter accepts the following options:
  3015. @table @option
  3016. @item frequency, f
  3017. Set frequency in Hz. Default is 500.
  3018. @item poles, p
  3019. Set number of poles. Default is 2.
  3020. @item width_type, t
  3021. Set method to specify band-width of filter.
  3022. @table @option
  3023. @item h
  3024. Hz
  3025. @item q
  3026. Q-Factor
  3027. @item o
  3028. octave
  3029. @item s
  3030. slope
  3031. @item k
  3032. kHz
  3033. @end table
  3034. @item width, w
  3035. Specify the band-width of a filter in width_type units.
  3036. Applies only to double-pole filter.
  3037. The default is 0.707q and gives a Butterworth response.
  3038. @item channels, c
  3039. Specify which channels to filter, by default all available are filtered.
  3040. @end table
  3041. @subsection Examples
  3042. @itemize
  3043. @item
  3044. Lowpass only LFE channel, it LFE is not present it does nothing:
  3045. @example
  3046. lowpass=c=LFE
  3047. @end example
  3048. @end itemize
  3049. @subsection Commands
  3050. This filter supports the following commands:
  3051. @table @option
  3052. @item frequency, f
  3053. Change lowpass frequency.
  3054. Syntax for the command is : "@var{frequency}"
  3055. @item width_type, t
  3056. Change lowpass width_type.
  3057. Syntax for the command is : "@var{width_type}"
  3058. @item width, w
  3059. Change lowpass width.
  3060. Syntax for the command is : "@var{width}"
  3061. @end table
  3062. @section lv2
  3063. Load a LV2 (LADSPA Version 2) plugin.
  3064. To enable compilation of this filter you need to configure FFmpeg with
  3065. @code{--enable-lv2}.
  3066. @table @option
  3067. @item plugin, p
  3068. Specifies the plugin URI. You may need to escape ':'.
  3069. @item controls, c
  3070. Set the '|' separated list of controls which are zero or more floating point
  3071. values that determine the behavior of the loaded plugin (for example delay,
  3072. threshold or gain).
  3073. If @option{controls} is set to @code{help}, all available controls and
  3074. their valid ranges are printed.
  3075. @item sample_rate, s
  3076. Specify the sample rate, default to 44100. Only used if plugin have
  3077. zero inputs.
  3078. @item nb_samples, n
  3079. Set the number of samples per channel per each output frame, default
  3080. is 1024. Only used if plugin have zero inputs.
  3081. @item duration, d
  3082. Set the minimum duration of the sourced audio. See
  3083. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3084. for the accepted syntax.
  3085. Note that the resulting duration may be greater than the specified duration,
  3086. as the generated audio is always cut at the end of a complete frame.
  3087. If not specified, or the expressed duration is negative, the audio is
  3088. supposed to be generated forever.
  3089. Only used if plugin have zero inputs.
  3090. @end table
  3091. @subsection Examples
  3092. @itemize
  3093. @item
  3094. Apply bass enhancer plugin from Calf:
  3095. @example
  3096. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3097. @end example
  3098. @item
  3099. Apply vinyl plugin from Calf:
  3100. @example
  3101. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3102. @end example
  3103. @item
  3104. Apply bit crusher plugin from ArtyFX:
  3105. @example
  3106. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3107. @end example
  3108. @end itemize
  3109. @section mcompand
  3110. Multiband Compress or expand the audio's dynamic range.
  3111. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3112. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3113. response when absent compander action.
  3114. It accepts the following parameters:
  3115. @table @option
  3116. @item args
  3117. This option syntax is:
  3118. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3119. For explanation of each item refer to compand filter documentation.
  3120. @end table
  3121. @anchor{pan}
  3122. @section pan
  3123. Mix channels with specific gain levels. The filter accepts the output
  3124. channel layout followed by a set of channels definitions.
  3125. This filter is also designed to efficiently remap the channels of an audio
  3126. stream.
  3127. The filter accepts parameters of the form:
  3128. "@var{l}|@var{outdef}|@var{outdef}|..."
  3129. @table @option
  3130. @item l
  3131. output channel layout or number of channels
  3132. @item outdef
  3133. output channel specification, of the form:
  3134. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3135. @item out_name
  3136. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3137. number (c0, c1, etc.)
  3138. @item gain
  3139. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3140. @item in_name
  3141. input channel to use, see out_name for details; it is not possible to mix
  3142. named and numbered input channels
  3143. @end table
  3144. If the `=' in a channel specification is replaced by `<', then the gains for
  3145. that specification will be renormalized so that the total is 1, thus
  3146. avoiding clipping noise.
  3147. @subsection Mixing examples
  3148. For example, if you want to down-mix from stereo to mono, but with a bigger
  3149. factor for the left channel:
  3150. @example
  3151. pan=1c|c0=0.9*c0+0.1*c1
  3152. @end example
  3153. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3154. 7-channels surround:
  3155. @example
  3156. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3157. @end example
  3158. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3159. that should be preferred (see "-ac" option) unless you have very specific
  3160. needs.
  3161. @subsection Remapping examples
  3162. The channel remapping will be effective if, and only if:
  3163. @itemize
  3164. @item gain coefficients are zeroes or ones,
  3165. @item only one input per channel output,
  3166. @end itemize
  3167. If all these conditions are satisfied, the filter will notify the user ("Pure
  3168. channel mapping detected"), and use an optimized and lossless method to do the
  3169. remapping.
  3170. For example, if you have a 5.1 source and want a stereo audio stream by
  3171. dropping the extra channels:
  3172. @example
  3173. pan="stereo| c0=FL | c1=FR"
  3174. @end example
  3175. Given the same source, you can also switch front left and front right channels
  3176. and keep the input channel layout:
  3177. @example
  3178. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3179. @end example
  3180. If the input is a stereo audio stream, you can mute the front left channel (and
  3181. still keep the stereo channel layout) with:
  3182. @example
  3183. pan="stereo|c1=c1"
  3184. @end example
  3185. Still with a stereo audio stream input, you can copy the right channel in both
  3186. front left and right:
  3187. @example
  3188. pan="stereo| c0=FR | c1=FR"
  3189. @end example
  3190. @section replaygain
  3191. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3192. outputs it unchanged.
  3193. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3194. @section resample
  3195. Convert the audio sample format, sample rate and channel layout. It is
  3196. not meant to be used directly.
  3197. @section rubberband
  3198. Apply time-stretching and pitch-shifting with librubberband.
  3199. To enable compilation of this filter, you need to configure FFmpeg with
  3200. @code{--enable-librubberband}.
  3201. The filter accepts the following options:
  3202. @table @option
  3203. @item tempo
  3204. Set tempo scale factor.
  3205. @item pitch
  3206. Set pitch scale factor.
  3207. @item transients
  3208. Set transients detector.
  3209. Possible values are:
  3210. @table @var
  3211. @item crisp
  3212. @item mixed
  3213. @item smooth
  3214. @end table
  3215. @item detector
  3216. Set detector.
  3217. Possible values are:
  3218. @table @var
  3219. @item compound
  3220. @item percussive
  3221. @item soft
  3222. @end table
  3223. @item phase
  3224. Set phase.
  3225. Possible values are:
  3226. @table @var
  3227. @item laminar
  3228. @item independent
  3229. @end table
  3230. @item window
  3231. Set processing window size.
  3232. Possible values are:
  3233. @table @var
  3234. @item standard
  3235. @item short
  3236. @item long
  3237. @end table
  3238. @item smoothing
  3239. Set smoothing.
  3240. Possible values are:
  3241. @table @var
  3242. @item off
  3243. @item on
  3244. @end table
  3245. @item formant
  3246. Enable formant preservation when shift pitching.
  3247. Possible values are:
  3248. @table @var
  3249. @item shifted
  3250. @item preserved
  3251. @end table
  3252. @item pitchq
  3253. Set pitch quality.
  3254. Possible values are:
  3255. @table @var
  3256. @item quality
  3257. @item speed
  3258. @item consistency
  3259. @end table
  3260. @item channels
  3261. Set channels.
  3262. Possible values are:
  3263. @table @var
  3264. @item apart
  3265. @item together
  3266. @end table
  3267. @end table
  3268. @section sidechaincompress
  3269. This filter acts like normal compressor but has the ability to compress
  3270. detected signal using second input signal.
  3271. It needs two input streams and returns one output stream.
  3272. First input stream will be processed depending on second stream signal.
  3273. The filtered signal then can be filtered with other filters in later stages of
  3274. processing. See @ref{pan} and @ref{amerge} filter.
  3275. The filter accepts the following options:
  3276. @table @option
  3277. @item level_in
  3278. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3279. @item threshold
  3280. If a signal of second stream raises above this level it will affect the gain
  3281. reduction of first stream.
  3282. By default is 0.125. Range is between 0.00097563 and 1.
  3283. @item ratio
  3284. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3285. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3286. Default is 2. Range is between 1 and 20.
  3287. @item attack
  3288. Amount of milliseconds the signal has to rise above the threshold before gain
  3289. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3290. @item release
  3291. Amount of milliseconds the signal has to fall below the threshold before
  3292. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3293. @item makeup
  3294. Set the amount by how much signal will be amplified after processing.
  3295. Default is 1. Range is from 1 to 64.
  3296. @item knee
  3297. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3298. Default is 2.82843. Range is between 1 and 8.
  3299. @item link
  3300. Choose if the @code{average} level between all channels of side-chain stream
  3301. or the louder(@code{maximum}) channel of side-chain stream affects the
  3302. reduction. Default is @code{average}.
  3303. @item detection
  3304. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3305. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3306. @item level_sc
  3307. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3308. @item mix
  3309. How much to use compressed signal in output. Default is 1.
  3310. Range is between 0 and 1.
  3311. @end table
  3312. @subsection Examples
  3313. @itemize
  3314. @item
  3315. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3316. depending on the signal of 2nd input and later compressed signal to be
  3317. merged with 2nd input:
  3318. @example
  3319. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3320. @end example
  3321. @end itemize
  3322. @section sidechaingate
  3323. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3324. filter the detected signal before sending it to the gain reduction stage.
  3325. Normally a gate uses the full range signal to detect a level above the
  3326. threshold.
  3327. For example: If you cut all lower frequencies from your sidechain signal
  3328. the gate will decrease the volume of your track only if not enough highs
  3329. appear. With this technique you are able to reduce the resonation of a
  3330. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3331. guitar.
  3332. It needs two input streams and returns one output stream.
  3333. First input stream will be processed depending on second stream signal.
  3334. The filter accepts the following options:
  3335. @table @option
  3336. @item level_in
  3337. Set input level before filtering.
  3338. Default is 1. Allowed range is from 0.015625 to 64.
  3339. @item range
  3340. Set the level of gain reduction when the signal is below the threshold.
  3341. Default is 0.06125. Allowed range is from 0 to 1.
  3342. @item threshold
  3343. If a signal rises above this level the gain reduction is released.
  3344. Default is 0.125. Allowed range is from 0 to 1.
  3345. @item ratio
  3346. Set a ratio about which the signal is reduced.
  3347. Default is 2. Allowed range is from 1 to 9000.
  3348. @item attack
  3349. Amount of milliseconds the signal has to rise above the threshold before gain
  3350. reduction stops.
  3351. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3352. @item release
  3353. Amount of milliseconds the signal has to fall below the threshold before the
  3354. reduction is increased again. Default is 250 milliseconds.
  3355. Allowed range is from 0.01 to 9000.
  3356. @item makeup
  3357. Set amount of amplification of signal after processing.
  3358. Default is 1. Allowed range is from 1 to 64.
  3359. @item knee
  3360. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3361. Default is 2.828427125. Allowed range is from 1 to 8.
  3362. @item detection
  3363. Choose if exact signal should be taken for detection or an RMS like one.
  3364. Default is rms. Can be peak or rms.
  3365. @item link
  3366. Choose if the average level between all channels or the louder channel affects
  3367. the reduction.
  3368. Default is average. Can be average or maximum.
  3369. @item level_sc
  3370. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3371. @end table
  3372. @section silencedetect
  3373. Detect silence in an audio stream.
  3374. This filter logs a message when it detects that the input audio volume is less
  3375. or equal to a noise tolerance value for a duration greater or equal to the
  3376. minimum detected noise duration.
  3377. The printed times and duration are expressed in seconds.
  3378. The filter accepts the following options:
  3379. @table @option
  3380. @item noise, n
  3381. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3382. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3383. @item duration, d
  3384. Set silence duration until notification (default is 2 seconds).
  3385. @item mono, m
  3386. Process each channel separately, instead of combined. By default is disabled.
  3387. @end table
  3388. @subsection Examples
  3389. @itemize
  3390. @item
  3391. Detect 5 seconds of silence with -50dB noise tolerance:
  3392. @example
  3393. silencedetect=n=-50dB:d=5
  3394. @end example
  3395. @item
  3396. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3397. tolerance in @file{silence.mp3}:
  3398. @example
  3399. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3400. @end example
  3401. @end itemize
  3402. @section silenceremove
  3403. Remove silence from the beginning, middle or end of the audio.
  3404. The filter accepts the following options:
  3405. @table @option
  3406. @item start_periods
  3407. This value is used to indicate if audio should be trimmed at beginning of
  3408. the audio. A value of zero indicates no silence should be trimmed from the
  3409. beginning. When specifying a non-zero value, it trims audio up until it
  3410. finds non-silence. Normally, when trimming silence from beginning of audio
  3411. the @var{start_periods} will be @code{1} but it can be increased to higher
  3412. values to trim all audio up to specific count of non-silence periods.
  3413. Default value is @code{0}.
  3414. @item start_duration
  3415. Specify the amount of time that non-silence must be detected before it stops
  3416. trimming audio. By increasing the duration, bursts of noises can be treated
  3417. as silence and trimmed off. Default value is @code{0}.
  3418. @item start_threshold
  3419. This indicates what sample value should be treated as silence. For digital
  3420. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3421. you may wish to increase the value to account for background noise.
  3422. Can be specified in dB (in case "dB" is appended to the specified value)
  3423. or amplitude ratio. Default value is @code{0}.
  3424. @item start_silence
  3425. Specify max duration of silence at beginning that will be kept after
  3426. trimming. Default is 0, which is equal to trimming all samples detected
  3427. as silence.
  3428. @item start_mode
  3429. Specify mode of detection of silence end in start of multi-channel audio.
  3430. Can be @var{any} or @var{all}. Default is @var{any}.
  3431. With @var{any}, any sample that is detected as non-silence will cause
  3432. stopped trimming of silence.
  3433. With @var{all}, only if all channels are detected as non-silence will cause
  3434. stopped trimming of silence.
  3435. @item stop_periods
  3436. Set the count for trimming silence from the end of audio.
  3437. To remove silence from the middle of a file, specify a @var{stop_periods}
  3438. that is negative. This value is then treated as a positive value and is
  3439. used to indicate the effect should restart processing as specified by
  3440. @var{start_periods}, making it suitable for removing periods of silence
  3441. in the middle of the audio.
  3442. Default value is @code{0}.
  3443. @item stop_duration
  3444. Specify a duration of silence that must exist before audio is not copied any
  3445. more. By specifying a higher duration, silence that is wanted can be left in
  3446. the audio.
  3447. Default value is @code{0}.
  3448. @item stop_threshold
  3449. This is the same as @option{start_threshold} but for trimming silence from
  3450. the end of audio.
  3451. Can be specified in dB (in case "dB" is appended to the specified value)
  3452. or amplitude ratio. Default value is @code{0}.
  3453. @item stop_silence
  3454. Specify max duration of silence at end that will be kept after
  3455. trimming. Default is 0, which is equal to trimming all samples detected
  3456. as silence.
  3457. @item stop_mode
  3458. Specify mode of detection of silence start in end of multi-channel audio.
  3459. Can be @var{any} or @var{all}. Default is @var{any}.
  3460. With @var{any}, any sample that is detected as non-silence will cause
  3461. stopped trimming of silence.
  3462. With @var{all}, only if all channels are detected as non-silence will cause
  3463. stopped trimming of silence.
  3464. @item detection
  3465. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3466. and works better with digital silence which is exactly 0.
  3467. Default value is @code{rms}.
  3468. @item window
  3469. Set duration in number of seconds used to calculate size of window in number
  3470. of samples for detecting silence.
  3471. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3472. @end table
  3473. @subsection Examples
  3474. @itemize
  3475. @item
  3476. The following example shows how this filter can be used to start a recording
  3477. that does not contain the delay at the start which usually occurs between
  3478. pressing the record button and the start of the performance:
  3479. @example
  3480. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3481. @end example
  3482. @item
  3483. Trim all silence encountered from beginning to end where there is more than 1
  3484. second of silence in audio:
  3485. @example
  3486. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3487. @end example
  3488. @end itemize
  3489. @section sofalizer
  3490. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3491. loudspeakers around the user for binaural listening via headphones (audio
  3492. formats up to 9 channels supported).
  3493. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3494. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3495. Austrian Academy of Sciences.
  3496. To enable compilation of this filter you need to configure FFmpeg with
  3497. @code{--enable-libmysofa}.
  3498. The filter accepts the following options:
  3499. @table @option
  3500. @item sofa
  3501. Set the SOFA file used for rendering.
  3502. @item gain
  3503. Set gain applied to audio. Value is in dB. Default is 0.
  3504. @item rotation
  3505. Set rotation of virtual loudspeakers in deg. Default is 0.
  3506. @item elevation
  3507. Set elevation of virtual speakers in deg. Default is 0.
  3508. @item radius
  3509. Set distance in meters between loudspeakers and the listener with near-field
  3510. HRTFs. Default is 1.
  3511. @item type
  3512. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3513. processing audio in time domain which is slow.
  3514. @var{freq} is processing audio in frequency domain which is fast.
  3515. Default is @var{freq}.
  3516. @item speakers
  3517. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3518. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3519. Each virtual loudspeaker is described with short channel name following with
  3520. azimuth and elevation in degrees.
  3521. Each virtual loudspeaker description is separated by '|'.
  3522. For example to override front left and front right channel positions use:
  3523. 'speakers=FL 45 15|FR 345 15'.
  3524. Descriptions with unrecognised channel names are ignored.
  3525. @item lfegain
  3526. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3527. @item framesize
  3528. Set custom frame size in number of samples. Default is 1024.
  3529. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3530. is set to @var{freq}.
  3531. @item normalize
  3532. Should all IRs be normalized upon importing SOFA file.
  3533. By default is enabled.
  3534. @item interpolate
  3535. Should nearest IRs be interpolated with neighbor IRs if exact position
  3536. does not match. By default is disabled.
  3537. @item minphase
  3538. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3539. @item anglestep
  3540. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3541. @item radstep
  3542. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3543. @end table
  3544. @subsection Examples
  3545. @itemize
  3546. @item
  3547. Using ClubFritz6 sofa file:
  3548. @example
  3549. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3550. @end example
  3551. @item
  3552. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3553. @example
  3554. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3555. @end example
  3556. @item
  3557. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3558. and also with custom gain:
  3559. @example
  3560. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3561. @end example
  3562. @end itemize
  3563. @section stereotools
  3564. This filter has some handy utilities to manage stereo signals, for converting
  3565. M/S stereo recordings to L/R signal while having control over the parameters
  3566. or spreading the stereo image of master track.
  3567. The filter accepts the following options:
  3568. @table @option
  3569. @item level_in
  3570. Set input level before filtering for both channels. Defaults is 1.
  3571. Allowed range is from 0.015625 to 64.
  3572. @item level_out
  3573. Set output level after filtering for both channels. Defaults is 1.
  3574. Allowed range is from 0.015625 to 64.
  3575. @item balance_in
  3576. Set input balance between both channels. Default is 0.
  3577. Allowed range is from -1 to 1.
  3578. @item balance_out
  3579. Set output balance between both channels. Default is 0.
  3580. Allowed range is from -1 to 1.
  3581. @item softclip
  3582. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3583. clipping. Disabled by default.
  3584. @item mutel
  3585. Mute the left channel. Disabled by default.
  3586. @item muter
  3587. Mute the right channel. Disabled by default.
  3588. @item phasel
  3589. Change the phase of the left channel. Disabled by default.
  3590. @item phaser
  3591. Change the phase of the right channel. Disabled by default.
  3592. @item mode
  3593. Set stereo mode. Available values are:
  3594. @table @samp
  3595. @item lr>lr
  3596. Left/Right to Left/Right, this is default.
  3597. @item lr>ms
  3598. Left/Right to Mid/Side.
  3599. @item ms>lr
  3600. Mid/Side to Left/Right.
  3601. @item lr>ll
  3602. Left/Right to Left/Left.
  3603. @item lr>rr
  3604. Left/Right to Right/Right.
  3605. @item lr>l+r
  3606. Left/Right to Left + Right.
  3607. @item lr>rl
  3608. Left/Right to Right/Left.
  3609. @item ms>ll
  3610. Mid/Side to Left/Left.
  3611. @item ms>rr
  3612. Mid/Side to Right/Right.
  3613. @end table
  3614. @item slev
  3615. Set level of side signal. Default is 1.
  3616. Allowed range is from 0.015625 to 64.
  3617. @item sbal
  3618. Set balance of side signal. Default is 0.
  3619. Allowed range is from -1 to 1.
  3620. @item mlev
  3621. Set level of the middle signal. Default is 1.
  3622. Allowed range is from 0.015625 to 64.
  3623. @item mpan
  3624. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3625. @item base
  3626. Set stereo base between mono and inversed channels. Default is 0.
  3627. Allowed range is from -1 to 1.
  3628. @item delay
  3629. Set delay in milliseconds how much to delay left from right channel and
  3630. vice versa. Default is 0. Allowed range is from -20 to 20.
  3631. @item sclevel
  3632. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3633. @item phase
  3634. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3635. @item bmode_in, bmode_out
  3636. Set balance mode for balance_in/balance_out option.
  3637. Can be one of the following:
  3638. @table @samp
  3639. @item balance
  3640. Classic balance mode. Attenuate one channel at time.
  3641. Gain is raised up to 1.
  3642. @item amplitude
  3643. Similar as classic mode above but gain is raised up to 2.
  3644. @item power
  3645. Equal power distribution, from -6dB to +6dB range.
  3646. @end table
  3647. @end table
  3648. @subsection Examples
  3649. @itemize
  3650. @item
  3651. Apply karaoke like effect:
  3652. @example
  3653. stereotools=mlev=0.015625
  3654. @end example
  3655. @item
  3656. Convert M/S signal to L/R:
  3657. @example
  3658. "stereotools=mode=ms>lr"
  3659. @end example
  3660. @end itemize
  3661. @section stereowiden
  3662. This filter enhance the stereo effect by suppressing signal common to both
  3663. channels and by delaying the signal of left into right and vice versa,
  3664. thereby widening the stereo effect.
  3665. The filter accepts the following options:
  3666. @table @option
  3667. @item delay
  3668. Time in milliseconds of the delay of left signal into right and vice versa.
  3669. Default is 20 milliseconds.
  3670. @item feedback
  3671. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3672. effect of left signal in right output and vice versa which gives widening
  3673. effect. Default is 0.3.
  3674. @item crossfeed
  3675. Cross feed of left into right with inverted phase. This helps in suppressing
  3676. the mono. If the value is 1 it will cancel all the signal common to both
  3677. channels. Default is 0.3.
  3678. @item drymix
  3679. Set level of input signal of original channel. Default is 0.8.
  3680. @end table
  3681. @section superequalizer
  3682. Apply 18 band equalizer.
  3683. The filter accepts the following options:
  3684. @table @option
  3685. @item 1b
  3686. Set 65Hz band gain.
  3687. @item 2b
  3688. Set 92Hz band gain.
  3689. @item 3b
  3690. Set 131Hz band gain.
  3691. @item 4b
  3692. Set 185Hz band gain.
  3693. @item 5b
  3694. Set 262Hz band gain.
  3695. @item 6b
  3696. Set 370Hz band gain.
  3697. @item 7b
  3698. Set 523Hz band gain.
  3699. @item 8b
  3700. Set 740Hz band gain.
  3701. @item 9b
  3702. Set 1047Hz band gain.
  3703. @item 10b
  3704. Set 1480Hz band gain.
  3705. @item 11b
  3706. Set 2093Hz band gain.
  3707. @item 12b
  3708. Set 2960Hz band gain.
  3709. @item 13b
  3710. Set 4186Hz band gain.
  3711. @item 14b
  3712. Set 5920Hz band gain.
  3713. @item 15b
  3714. Set 8372Hz band gain.
  3715. @item 16b
  3716. Set 11840Hz band gain.
  3717. @item 17b
  3718. Set 16744Hz band gain.
  3719. @item 18b
  3720. Set 20000Hz band gain.
  3721. @end table
  3722. @section surround
  3723. Apply audio surround upmix filter.
  3724. This filter allows to produce multichannel output from audio stream.
  3725. The filter accepts the following options:
  3726. @table @option
  3727. @item chl_out
  3728. Set output channel layout. By default, this is @var{5.1}.
  3729. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3730. for the required syntax.
  3731. @item chl_in
  3732. Set input channel layout. By default, this is @var{stereo}.
  3733. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3734. for the required syntax.
  3735. @item level_in
  3736. Set input volume level. By default, this is @var{1}.
  3737. @item level_out
  3738. Set output volume level. By default, this is @var{1}.
  3739. @item lfe
  3740. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3741. @item lfe_low
  3742. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3743. @item lfe_high
  3744. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3745. @item fc_in
  3746. Set front center input volume. By default, this is @var{1}.
  3747. @item fc_out
  3748. Set front center output volume. By default, this is @var{1}.
  3749. @item lfe_in
  3750. Set LFE input volume. By default, this is @var{1}.
  3751. @item lfe_out
  3752. Set LFE output volume. By default, this is @var{1}.
  3753. @end table
  3754. @section treble, highshelf
  3755. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3756. shelving filter with a response similar to that of a standard
  3757. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3758. The filter accepts the following options:
  3759. @table @option
  3760. @item gain, g
  3761. Give the gain at whichever is the lower of ~22 kHz and the
  3762. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3763. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3764. @item frequency, f
  3765. Set the filter's central frequency and so can be used
  3766. to extend or reduce the frequency range to be boosted or cut.
  3767. The default value is @code{3000} Hz.
  3768. @item width_type, t
  3769. Set method to specify band-width of filter.
  3770. @table @option
  3771. @item h
  3772. Hz
  3773. @item q
  3774. Q-Factor
  3775. @item o
  3776. octave
  3777. @item s
  3778. slope
  3779. @item k
  3780. kHz
  3781. @end table
  3782. @item width, w
  3783. Determine how steep is the filter's shelf transition.
  3784. @item channels, c
  3785. Specify which channels to filter, by default all available are filtered.
  3786. @end table
  3787. @subsection Commands
  3788. This filter supports the following commands:
  3789. @table @option
  3790. @item frequency, f
  3791. Change treble frequency.
  3792. Syntax for the command is : "@var{frequency}"
  3793. @item width_type, t
  3794. Change treble width_type.
  3795. Syntax for the command is : "@var{width_type}"
  3796. @item width, w
  3797. Change treble width.
  3798. Syntax for the command is : "@var{width}"
  3799. @item gain, g
  3800. Change treble gain.
  3801. Syntax for the command is : "@var{gain}"
  3802. @end table
  3803. @section tremolo
  3804. Sinusoidal amplitude modulation.
  3805. The filter accepts the following options:
  3806. @table @option
  3807. @item f
  3808. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3809. (20 Hz or lower) will result in a tremolo effect.
  3810. This filter may also be used as a ring modulator by specifying
  3811. a modulation frequency higher than 20 Hz.
  3812. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3813. @item d
  3814. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3815. Default value is 0.5.
  3816. @end table
  3817. @section vibrato
  3818. Sinusoidal phase modulation.
  3819. The filter accepts the following options:
  3820. @table @option
  3821. @item f
  3822. Modulation frequency in Hertz.
  3823. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3824. @item d
  3825. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3826. Default value is 0.5.
  3827. @end table
  3828. @section volume
  3829. Adjust the input audio volume.
  3830. It accepts the following parameters:
  3831. @table @option
  3832. @item volume
  3833. Set audio volume expression.
  3834. Output values are clipped to the maximum value.
  3835. The output audio volume is given by the relation:
  3836. @example
  3837. @var{output_volume} = @var{volume} * @var{input_volume}
  3838. @end example
  3839. The default value for @var{volume} is "1.0".
  3840. @item precision
  3841. This parameter represents the mathematical precision.
  3842. It determines which input sample formats will be allowed, which affects the
  3843. precision of the volume scaling.
  3844. @table @option
  3845. @item fixed
  3846. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3847. @item float
  3848. 32-bit floating-point; this limits input sample format to FLT. (default)
  3849. @item double
  3850. 64-bit floating-point; this limits input sample format to DBL.
  3851. @end table
  3852. @item replaygain
  3853. Choose the behaviour on encountering ReplayGain side data in input frames.
  3854. @table @option
  3855. @item drop
  3856. Remove ReplayGain side data, ignoring its contents (the default).
  3857. @item ignore
  3858. Ignore ReplayGain side data, but leave it in the frame.
  3859. @item track
  3860. Prefer the track gain, if present.
  3861. @item album
  3862. Prefer the album gain, if present.
  3863. @end table
  3864. @item replaygain_preamp
  3865. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3866. Default value for @var{replaygain_preamp} is 0.0.
  3867. @item eval
  3868. Set when the volume expression is evaluated.
  3869. It accepts the following values:
  3870. @table @samp
  3871. @item once
  3872. only evaluate expression once during the filter initialization, or
  3873. when the @samp{volume} command is sent
  3874. @item frame
  3875. evaluate expression for each incoming frame
  3876. @end table
  3877. Default value is @samp{once}.
  3878. @end table
  3879. The volume expression can contain the following parameters.
  3880. @table @option
  3881. @item n
  3882. frame number (starting at zero)
  3883. @item nb_channels
  3884. number of channels
  3885. @item nb_consumed_samples
  3886. number of samples consumed by the filter
  3887. @item nb_samples
  3888. number of samples in the current frame
  3889. @item pos
  3890. original frame position in the file
  3891. @item pts
  3892. frame PTS
  3893. @item sample_rate
  3894. sample rate
  3895. @item startpts
  3896. PTS at start of stream
  3897. @item startt
  3898. time at start of stream
  3899. @item t
  3900. frame time
  3901. @item tb
  3902. timestamp timebase
  3903. @item volume
  3904. last set volume value
  3905. @end table
  3906. Note that when @option{eval} is set to @samp{once} only the
  3907. @var{sample_rate} and @var{tb} variables are available, all other
  3908. variables will evaluate to NAN.
  3909. @subsection Commands
  3910. This filter supports the following commands:
  3911. @table @option
  3912. @item volume
  3913. Modify the volume expression.
  3914. The command accepts the same syntax of the corresponding option.
  3915. If the specified expression is not valid, it is kept at its current
  3916. value.
  3917. @item replaygain_noclip
  3918. Prevent clipping by limiting the gain applied.
  3919. Default value for @var{replaygain_noclip} is 1.
  3920. @end table
  3921. @subsection Examples
  3922. @itemize
  3923. @item
  3924. Halve the input audio volume:
  3925. @example
  3926. volume=volume=0.5
  3927. volume=volume=1/2
  3928. volume=volume=-6.0206dB
  3929. @end example
  3930. In all the above example the named key for @option{volume} can be
  3931. omitted, for example like in:
  3932. @example
  3933. volume=0.5
  3934. @end example
  3935. @item
  3936. Increase input audio power by 6 decibels using fixed-point precision:
  3937. @example
  3938. volume=volume=6dB:precision=fixed
  3939. @end example
  3940. @item
  3941. Fade volume after time 10 with an annihilation period of 5 seconds:
  3942. @example
  3943. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3944. @end example
  3945. @end itemize
  3946. @section volumedetect
  3947. Detect the volume of the input video.
  3948. The filter has no parameters. The input is not modified. Statistics about
  3949. the volume will be printed in the log when the input stream end is reached.
  3950. In particular it will show the mean volume (root mean square), maximum
  3951. volume (on a per-sample basis), and the beginning of a histogram of the
  3952. registered volume values (from the maximum value to a cumulated 1/1000 of
  3953. the samples).
  3954. All volumes are in decibels relative to the maximum PCM value.
  3955. @subsection Examples
  3956. Here is an excerpt of the output:
  3957. @example
  3958. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3959. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3960. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3961. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3962. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3963. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3964. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3965. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3966. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3967. @end example
  3968. It means that:
  3969. @itemize
  3970. @item
  3971. The mean square energy is approximately -27 dB, or 10^-2.7.
  3972. @item
  3973. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3974. @item
  3975. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3976. @end itemize
  3977. In other words, raising the volume by +4 dB does not cause any clipping,
  3978. raising it by +5 dB causes clipping for 6 samples, etc.
  3979. @c man end AUDIO FILTERS
  3980. @chapter Audio Sources
  3981. @c man begin AUDIO SOURCES
  3982. Below is a description of the currently available audio sources.
  3983. @section abuffer
  3984. Buffer audio frames, and make them available to the filter chain.
  3985. This source is mainly intended for a programmatic use, in particular
  3986. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3987. It accepts the following parameters:
  3988. @table @option
  3989. @item time_base
  3990. The timebase which will be used for timestamps of submitted frames. It must be
  3991. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3992. @item sample_rate
  3993. The sample rate of the incoming audio buffers.
  3994. @item sample_fmt
  3995. The sample format of the incoming audio buffers.
  3996. Either a sample format name or its corresponding integer representation from
  3997. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3998. @item channel_layout
  3999. The channel layout of the incoming audio buffers.
  4000. Either a channel layout name from channel_layout_map in
  4001. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4002. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4003. @item channels
  4004. The number of channels of the incoming audio buffers.
  4005. If both @var{channels} and @var{channel_layout} are specified, then they
  4006. must be consistent.
  4007. @end table
  4008. @subsection Examples
  4009. @example
  4010. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4011. @end example
  4012. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4013. Since the sample format with name "s16p" corresponds to the number
  4014. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4015. equivalent to:
  4016. @example
  4017. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4018. @end example
  4019. @section aevalsrc
  4020. Generate an audio signal specified by an expression.
  4021. This source accepts in input one or more expressions (one for each
  4022. channel), which are evaluated and used to generate a corresponding
  4023. audio signal.
  4024. This source accepts the following options:
  4025. @table @option
  4026. @item exprs
  4027. Set the '|'-separated expressions list for each separate channel. In case the
  4028. @option{channel_layout} option is not specified, the selected channel layout
  4029. depends on the number of provided expressions. Otherwise the last
  4030. specified expression is applied to the remaining output channels.
  4031. @item channel_layout, c
  4032. Set the channel layout. The number of channels in the specified layout
  4033. must be equal to the number of specified expressions.
  4034. @item duration, d
  4035. Set the minimum duration of the sourced audio. See
  4036. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4037. for the accepted syntax.
  4038. Note that the resulting duration may be greater than the specified
  4039. duration, as the generated audio is always cut at the end of a
  4040. complete frame.
  4041. If not specified, or the expressed duration is negative, the audio is
  4042. supposed to be generated forever.
  4043. @item nb_samples, n
  4044. Set the number of samples per channel per each output frame,
  4045. default to 1024.
  4046. @item sample_rate, s
  4047. Specify the sample rate, default to 44100.
  4048. @end table
  4049. Each expression in @var{exprs} can contain the following constants:
  4050. @table @option
  4051. @item n
  4052. number of the evaluated sample, starting from 0
  4053. @item t
  4054. time of the evaluated sample expressed in seconds, starting from 0
  4055. @item s
  4056. sample rate
  4057. @end table
  4058. @subsection Examples
  4059. @itemize
  4060. @item
  4061. Generate silence:
  4062. @example
  4063. aevalsrc=0
  4064. @end example
  4065. @item
  4066. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4067. 8000 Hz:
  4068. @example
  4069. aevalsrc="sin(440*2*PI*t):s=8000"
  4070. @end example
  4071. @item
  4072. Generate a two channels signal, specify the channel layout (Front
  4073. Center + Back Center) explicitly:
  4074. @example
  4075. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4076. @end example
  4077. @item
  4078. Generate white noise:
  4079. @example
  4080. aevalsrc="-2+random(0)"
  4081. @end example
  4082. @item
  4083. Generate an amplitude modulated signal:
  4084. @example
  4085. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4086. @end example
  4087. @item
  4088. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4089. @example
  4090. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4091. @end example
  4092. @end itemize
  4093. @section anullsrc
  4094. The null audio source, return unprocessed audio frames. It is mainly useful
  4095. as a template and to be employed in analysis / debugging tools, or as
  4096. the source for filters which ignore the input data (for example the sox
  4097. synth filter).
  4098. This source accepts the following options:
  4099. @table @option
  4100. @item channel_layout, cl
  4101. Specifies the channel layout, and can be either an integer or a string
  4102. representing a channel layout. The default value of @var{channel_layout}
  4103. is "stereo".
  4104. Check the channel_layout_map definition in
  4105. @file{libavutil/channel_layout.c} for the mapping between strings and
  4106. channel layout values.
  4107. @item sample_rate, r
  4108. Specifies the sample rate, and defaults to 44100.
  4109. @item nb_samples, n
  4110. Set the number of samples per requested frames.
  4111. @end table
  4112. @subsection Examples
  4113. @itemize
  4114. @item
  4115. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4116. @example
  4117. anullsrc=r=48000:cl=4
  4118. @end example
  4119. @item
  4120. Do the same operation with a more obvious syntax:
  4121. @example
  4122. anullsrc=r=48000:cl=mono
  4123. @end example
  4124. @end itemize
  4125. All the parameters need to be explicitly defined.
  4126. @section flite
  4127. Synthesize a voice utterance using the libflite library.
  4128. To enable compilation of this filter you need to configure FFmpeg with
  4129. @code{--enable-libflite}.
  4130. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4131. The filter accepts the following options:
  4132. @table @option
  4133. @item list_voices
  4134. If set to 1, list the names of the available voices and exit
  4135. immediately. Default value is 0.
  4136. @item nb_samples, n
  4137. Set the maximum number of samples per frame. Default value is 512.
  4138. @item textfile
  4139. Set the filename containing the text to speak.
  4140. @item text
  4141. Set the text to speak.
  4142. @item voice, v
  4143. Set the voice to use for the speech synthesis. Default value is
  4144. @code{kal}. See also the @var{list_voices} option.
  4145. @end table
  4146. @subsection Examples
  4147. @itemize
  4148. @item
  4149. Read from file @file{speech.txt}, and synthesize the text using the
  4150. standard flite voice:
  4151. @example
  4152. flite=textfile=speech.txt
  4153. @end example
  4154. @item
  4155. Read the specified text selecting the @code{slt} voice:
  4156. @example
  4157. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4158. @end example
  4159. @item
  4160. Input text to ffmpeg:
  4161. @example
  4162. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4163. @end example
  4164. @item
  4165. Make @file{ffplay} speak the specified text, using @code{flite} and
  4166. the @code{lavfi} device:
  4167. @example
  4168. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4169. @end example
  4170. @end itemize
  4171. For more information about libflite, check:
  4172. @url{http://www.festvox.org/flite/}
  4173. @section anoisesrc
  4174. Generate a noise audio signal.
  4175. The filter accepts the following options:
  4176. @table @option
  4177. @item sample_rate, r
  4178. Specify the sample rate. Default value is 48000 Hz.
  4179. @item amplitude, a
  4180. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4181. is 1.0.
  4182. @item duration, d
  4183. Specify the duration of the generated audio stream. Not specifying this option
  4184. results in noise with an infinite length.
  4185. @item color, colour, c
  4186. Specify the color of noise. Available noise colors are white, pink, brown,
  4187. blue and violet. Default color is white.
  4188. @item seed, s
  4189. Specify a value used to seed the PRNG.
  4190. @item nb_samples, n
  4191. Set the number of samples per each output frame, default is 1024.
  4192. @end table
  4193. @subsection Examples
  4194. @itemize
  4195. @item
  4196. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4197. @example
  4198. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4199. @end example
  4200. @end itemize
  4201. @section hilbert
  4202. Generate odd-tap Hilbert transform FIR coefficients.
  4203. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4204. the signal by 90 degrees.
  4205. This is used in many matrix coding schemes and for analytic signal generation.
  4206. The process is often written as a multiplication by i (or j), the imaginary unit.
  4207. The filter accepts the following options:
  4208. @table @option
  4209. @item sample_rate, s
  4210. Set sample rate, default is 44100.
  4211. @item taps, t
  4212. Set length of FIR filter, default is 22051.
  4213. @item nb_samples, n
  4214. Set number of samples per each frame.
  4215. @item win_func, w
  4216. Set window function to be used when generating FIR coefficients.
  4217. @end table
  4218. @section sinc
  4219. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4220. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4221. The filter accepts the following options:
  4222. @table @option
  4223. @item sample_rate, r
  4224. Set sample rate, default is 44100.
  4225. @item nb_samples, n
  4226. Set number of samples per each frame. Default is 1024.
  4227. @item hp
  4228. Set high-pass frequency. Default is 0.
  4229. @item lp
  4230. Set low-pass frequency. Default is 0.
  4231. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4232. is higher than 0 then filter will create band-pass filter coefficients,
  4233. otherwise band-reject filter coefficients.
  4234. @item phase
  4235. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4236. @item beta
  4237. Set Kaiser window beta.
  4238. @item att
  4239. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4240. @item round
  4241. Enable rounding, by default is disabled.
  4242. @item hptaps
  4243. Set number of taps for high-pass filter.
  4244. @item lptaps
  4245. Set number of taps for low-pass filter.
  4246. @end table
  4247. @section sine
  4248. Generate an audio signal made of a sine wave with amplitude 1/8.
  4249. The audio signal is bit-exact.
  4250. The filter accepts the following options:
  4251. @table @option
  4252. @item frequency, f
  4253. Set the carrier frequency. Default is 440 Hz.
  4254. @item beep_factor, b
  4255. Enable a periodic beep every second with frequency @var{beep_factor} times
  4256. the carrier frequency. Default is 0, meaning the beep is disabled.
  4257. @item sample_rate, r
  4258. Specify the sample rate, default is 44100.
  4259. @item duration, d
  4260. Specify the duration of the generated audio stream.
  4261. @item samples_per_frame
  4262. Set the number of samples per output frame.
  4263. The expression can contain the following constants:
  4264. @table @option
  4265. @item n
  4266. The (sequential) number of the output audio frame, starting from 0.
  4267. @item pts
  4268. The PTS (Presentation TimeStamp) of the output audio frame,
  4269. expressed in @var{TB} units.
  4270. @item t
  4271. The PTS of the output audio frame, expressed in seconds.
  4272. @item TB
  4273. The timebase of the output audio frames.
  4274. @end table
  4275. Default is @code{1024}.
  4276. @end table
  4277. @subsection Examples
  4278. @itemize
  4279. @item
  4280. Generate a simple 440 Hz sine wave:
  4281. @example
  4282. sine
  4283. @end example
  4284. @item
  4285. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4286. @example
  4287. sine=220:4:d=5
  4288. sine=f=220:b=4:d=5
  4289. sine=frequency=220:beep_factor=4:duration=5
  4290. @end example
  4291. @item
  4292. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4293. pattern:
  4294. @example
  4295. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4296. @end example
  4297. @end itemize
  4298. @c man end AUDIO SOURCES
  4299. @chapter Audio Sinks
  4300. @c man begin AUDIO SINKS
  4301. Below is a description of the currently available audio sinks.
  4302. @section abuffersink
  4303. Buffer audio frames, and make them available to the end of filter chain.
  4304. This sink is mainly intended for programmatic use, in particular
  4305. through the interface defined in @file{libavfilter/buffersink.h}
  4306. or the options system.
  4307. It accepts a pointer to an AVABufferSinkContext structure, which
  4308. defines the incoming buffers' formats, to be passed as the opaque
  4309. parameter to @code{avfilter_init_filter} for initialization.
  4310. @section anullsink
  4311. Null audio sink; do absolutely nothing with the input audio. It is
  4312. mainly useful as a template and for use in analysis / debugging
  4313. tools.
  4314. @c man end AUDIO SINKS
  4315. @chapter Video Filters
  4316. @c man begin VIDEO FILTERS
  4317. When you configure your FFmpeg build, you can disable any of the
  4318. existing filters using @code{--disable-filters}.
  4319. The configure output will show the video filters included in your
  4320. build.
  4321. Below is a description of the currently available video filters.
  4322. @section alphaextract
  4323. Extract the alpha component from the input as a grayscale video. This
  4324. is especially useful with the @var{alphamerge} filter.
  4325. @section alphamerge
  4326. Add or replace the alpha component of the primary input with the
  4327. grayscale value of a second input. This is intended for use with
  4328. @var{alphaextract} to allow the transmission or storage of frame
  4329. sequences that have alpha in a format that doesn't support an alpha
  4330. channel.
  4331. For example, to reconstruct full frames from a normal YUV-encoded video
  4332. and a separate video created with @var{alphaextract}, you might use:
  4333. @example
  4334. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4335. @end example
  4336. Since this filter is designed for reconstruction, it operates on frame
  4337. sequences without considering timestamps, and terminates when either
  4338. input reaches end of stream. This will cause problems if your encoding
  4339. pipeline drops frames. If you're trying to apply an image as an
  4340. overlay to a video stream, consider the @var{overlay} filter instead.
  4341. @section amplify
  4342. Amplify differences between current pixel and pixels of adjacent frames in
  4343. same pixel location.
  4344. This filter accepts the following options:
  4345. @table @option
  4346. @item radius
  4347. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4348. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4349. @item factor
  4350. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4351. @item threshold
  4352. Set threshold for difference amplification. Any differrence greater or equal to
  4353. this value will not alter source pixel. Default is 10.
  4354. Allowed range is from 0 to 65535.
  4355. @item low
  4356. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4357. This option controls maximum possible value that will decrease source pixel value.
  4358. @item high
  4359. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4360. This option controls maximum possible value that will increase source pixel value.
  4361. @item planes
  4362. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4363. @end table
  4364. @section ass
  4365. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4366. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4367. Substation Alpha) subtitles files.
  4368. This filter accepts the following option in addition to the common options from
  4369. the @ref{subtitles} filter:
  4370. @table @option
  4371. @item shaping
  4372. Set the shaping engine
  4373. Available values are:
  4374. @table @samp
  4375. @item auto
  4376. The default libass shaping engine, which is the best available.
  4377. @item simple
  4378. Fast, font-agnostic shaper that can do only substitutions
  4379. @item complex
  4380. Slower shaper using OpenType for substitutions and positioning
  4381. @end table
  4382. The default is @code{auto}.
  4383. @end table
  4384. @section atadenoise
  4385. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4386. The filter accepts the following options:
  4387. @table @option
  4388. @item 0a
  4389. Set threshold A for 1st plane. Default is 0.02.
  4390. Valid range is 0 to 0.3.
  4391. @item 0b
  4392. Set threshold B for 1st plane. Default is 0.04.
  4393. Valid range is 0 to 5.
  4394. @item 1a
  4395. Set threshold A for 2nd plane. Default is 0.02.
  4396. Valid range is 0 to 0.3.
  4397. @item 1b
  4398. Set threshold B for 2nd plane. Default is 0.04.
  4399. Valid range is 0 to 5.
  4400. @item 2a
  4401. Set threshold A for 3rd plane. Default is 0.02.
  4402. Valid range is 0 to 0.3.
  4403. @item 2b
  4404. Set threshold B for 3rd plane. Default is 0.04.
  4405. Valid range is 0 to 5.
  4406. Threshold A is designed to react on abrupt changes in the input signal and
  4407. threshold B is designed to react on continuous changes in the input signal.
  4408. @item s
  4409. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4410. number in range [5, 129].
  4411. @item p
  4412. Set what planes of frame filter will use for averaging. Default is all.
  4413. @end table
  4414. @section avgblur
  4415. Apply average blur filter.
  4416. The filter accepts the following options:
  4417. @table @option
  4418. @item sizeX
  4419. Set horizontal radius size.
  4420. @item planes
  4421. Set which planes to filter. By default all planes are filtered.
  4422. @item sizeY
  4423. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4424. Default is @code{0}.
  4425. @end table
  4426. @section bbox
  4427. Compute the bounding box for the non-black pixels in the input frame
  4428. luminance plane.
  4429. This filter computes the bounding box containing all the pixels with a
  4430. luminance value greater than the minimum allowed value.
  4431. The parameters describing the bounding box are printed on the filter
  4432. log.
  4433. The filter accepts the following option:
  4434. @table @option
  4435. @item min_val
  4436. Set the minimal luminance value. Default is @code{16}.
  4437. @end table
  4438. @section bitplanenoise
  4439. Show and measure bit plane noise.
  4440. The filter accepts the following options:
  4441. @table @option
  4442. @item bitplane
  4443. Set which plane to analyze. Default is @code{1}.
  4444. @item filter
  4445. Filter out noisy pixels from @code{bitplane} set above.
  4446. Default is disabled.
  4447. @end table
  4448. @section blackdetect
  4449. Detect video intervals that are (almost) completely black. Can be
  4450. useful to detect chapter transitions, commercials, or invalid
  4451. recordings. Output lines contains the time for the start, end and
  4452. duration of the detected black interval expressed in seconds.
  4453. In order to display the output lines, you need to set the loglevel at
  4454. least to the AV_LOG_INFO value.
  4455. The filter accepts the following options:
  4456. @table @option
  4457. @item black_min_duration, d
  4458. Set the minimum detected black duration expressed in seconds. It must
  4459. be a non-negative floating point number.
  4460. Default value is 2.0.
  4461. @item picture_black_ratio_th, pic_th
  4462. Set the threshold for considering a picture "black".
  4463. Express the minimum value for the ratio:
  4464. @example
  4465. @var{nb_black_pixels} / @var{nb_pixels}
  4466. @end example
  4467. for which a picture is considered black.
  4468. Default value is 0.98.
  4469. @item pixel_black_th, pix_th
  4470. Set the threshold for considering a pixel "black".
  4471. The threshold expresses the maximum pixel luminance value for which a
  4472. pixel is considered "black". The provided value is scaled according to
  4473. the following equation:
  4474. @example
  4475. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4476. @end example
  4477. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4478. the input video format, the range is [0-255] for YUV full-range
  4479. formats and [16-235] for YUV non full-range formats.
  4480. Default value is 0.10.
  4481. @end table
  4482. The following example sets the maximum pixel threshold to the minimum
  4483. value, and detects only black intervals of 2 or more seconds:
  4484. @example
  4485. blackdetect=d=2:pix_th=0.00
  4486. @end example
  4487. @section blackframe
  4488. Detect frames that are (almost) completely black. Can be useful to
  4489. detect chapter transitions or commercials. Output lines consist of
  4490. the frame number of the detected frame, the percentage of blackness,
  4491. the position in the file if known or -1 and the timestamp in seconds.
  4492. In order to display the output lines, you need to set the loglevel at
  4493. least to the AV_LOG_INFO value.
  4494. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4495. The value represents the percentage of pixels in the picture that
  4496. are below the threshold value.
  4497. It accepts the following parameters:
  4498. @table @option
  4499. @item amount
  4500. The percentage of the pixels that have to be below the threshold; it defaults to
  4501. @code{98}.
  4502. @item threshold, thresh
  4503. The threshold below which a pixel value is considered black; it defaults to
  4504. @code{32}.
  4505. @end table
  4506. @section blend, tblend
  4507. Blend two video frames into each other.
  4508. The @code{blend} filter takes two input streams and outputs one
  4509. stream, the first input is the "top" layer and second input is
  4510. "bottom" layer. By default, the output terminates when the longest input terminates.
  4511. The @code{tblend} (time blend) filter takes two consecutive frames
  4512. from one single stream, and outputs the result obtained by blending
  4513. the new frame on top of the old frame.
  4514. A description of the accepted options follows.
  4515. @table @option
  4516. @item c0_mode
  4517. @item c1_mode
  4518. @item c2_mode
  4519. @item c3_mode
  4520. @item all_mode
  4521. Set blend mode for specific pixel component or all pixel components in case
  4522. of @var{all_mode}. Default value is @code{normal}.
  4523. Available values for component modes are:
  4524. @table @samp
  4525. @item addition
  4526. @item grainmerge
  4527. @item and
  4528. @item average
  4529. @item burn
  4530. @item darken
  4531. @item difference
  4532. @item grainextract
  4533. @item divide
  4534. @item dodge
  4535. @item freeze
  4536. @item exclusion
  4537. @item extremity
  4538. @item glow
  4539. @item hardlight
  4540. @item hardmix
  4541. @item heat
  4542. @item lighten
  4543. @item linearlight
  4544. @item multiply
  4545. @item multiply128
  4546. @item negation
  4547. @item normal
  4548. @item or
  4549. @item overlay
  4550. @item phoenix
  4551. @item pinlight
  4552. @item reflect
  4553. @item screen
  4554. @item softlight
  4555. @item subtract
  4556. @item vividlight
  4557. @item xor
  4558. @end table
  4559. @item c0_opacity
  4560. @item c1_opacity
  4561. @item c2_opacity
  4562. @item c3_opacity
  4563. @item all_opacity
  4564. Set blend opacity for specific pixel component or all pixel components in case
  4565. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4566. @item c0_expr
  4567. @item c1_expr
  4568. @item c2_expr
  4569. @item c3_expr
  4570. @item all_expr
  4571. Set blend expression for specific pixel component or all pixel components in case
  4572. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4573. The expressions can use the following variables:
  4574. @table @option
  4575. @item N
  4576. The sequential number of the filtered frame, starting from @code{0}.
  4577. @item X
  4578. @item Y
  4579. the coordinates of the current sample
  4580. @item W
  4581. @item H
  4582. the width and height of currently filtered plane
  4583. @item SW
  4584. @item SH
  4585. Width and height scale for the plane being filtered. It is the
  4586. ratio between the dimensions of the current plane to the luma plane,
  4587. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4588. the luma plane and @code{0.5,0.5} for the chroma planes.
  4589. @item T
  4590. Time of the current frame, expressed in seconds.
  4591. @item TOP, A
  4592. Value of pixel component at current location for first video frame (top layer).
  4593. @item BOTTOM, B
  4594. Value of pixel component at current location for second video frame (bottom layer).
  4595. @end table
  4596. @end table
  4597. The @code{blend} filter also supports the @ref{framesync} options.
  4598. @subsection Examples
  4599. @itemize
  4600. @item
  4601. Apply transition from bottom layer to top layer in first 10 seconds:
  4602. @example
  4603. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4604. @end example
  4605. @item
  4606. Apply linear horizontal transition from top layer to bottom layer:
  4607. @example
  4608. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4609. @end example
  4610. @item
  4611. Apply 1x1 checkerboard effect:
  4612. @example
  4613. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4614. @end example
  4615. @item
  4616. Apply uncover left effect:
  4617. @example
  4618. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4619. @end example
  4620. @item
  4621. Apply uncover down effect:
  4622. @example
  4623. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4624. @end example
  4625. @item
  4626. Apply uncover up-left effect:
  4627. @example
  4628. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4629. @end example
  4630. @item
  4631. Split diagonally video and shows top and bottom layer on each side:
  4632. @example
  4633. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4634. @end example
  4635. @item
  4636. Display differences between the current and the previous frame:
  4637. @example
  4638. tblend=all_mode=grainextract
  4639. @end example
  4640. @end itemize
  4641. @section bm3d
  4642. Denoise frames using Block-Matching 3D algorithm.
  4643. The filter accepts the following options.
  4644. @table @option
  4645. @item sigma
  4646. Set denoising strength. Default value is 1.
  4647. Allowed range is from 0 to 999.9.
  4648. The denoising algorith is very sensitive to sigma, so adjust it
  4649. according to the source.
  4650. @item block
  4651. Set local patch size. This sets dimensions in 2D.
  4652. @item bstep
  4653. Set sliding step for processing blocks. Default value is 4.
  4654. Allowed range is from 1 to 64.
  4655. Smaller values allows processing more reference blocks and is slower.
  4656. @item group
  4657. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4658. When set to 1, no block matching is done. Larger values allows more blocks
  4659. in single group.
  4660. Allowed range is from 1 to 256.
  4661. @item range
  4662. Set radius for search block matching. Default is 9.
  4663. Allowed range is from 1 to INT32_MAX.
  4664. @item mstep
  4665. Set step between two search locations for block matching. Default is 1.
  4666. Allowed range is from 1 to 64. Smaller is slower.
  4667. @item thmse
  4668. Set threshold of mean square error for block matching. Valid range is 0 to
  4669. INT32_MAX.
  4670. @item hdthr
  4671. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4672. Larger values results in stronger hard-thresholding filtering in frequency
  4673. domain.
  4674. @item estim
  4675. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4676. Default is @code{basic}.
  4677. @item ref
  4678. If enabled, filter will use 2nd stream for block matching.
  4679. Default is disabled for @code{basic} value of @var{estim} option,
  4680. and always enabled if value of @var{estim} is @code{final}.
  4681. @item planes
  4682. Set planes to filter. Default is all available except alpha.
  4683. @end table
  4684. @subsection Examples
  4685. @itemize
  4686. @item
  4687. Basic filtering with bm3d:
  4688. @example
  4689. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4690. @end example
  4691. @item
  4692. Same as above, but filtering only luma:
  4693. @example
  4694. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4695. @end example
  4696. @item
  4697. Same as above, but with both estimation modes:
  4698. @example
  4699. 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
  4700. @end example
  4701. @item
  4702. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4703. @example
  4704. 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
  4705. @end example
  4706. @end itemize
  4707. @section boxblur
  4708. Apply a boxblur algorithm to the input video.
  4709. It accepts the following parameters:
  4710. @table @option
  4711. @item luma_radius, lr
  4712. @item luma_power, lp
  4713. @item chroma_radius, cr
  4714. @item chroma_power, cp
  4715. @item alpha_radius, ar
  4716. @item alpha_power, ap
  4717. @end table
  4718. A description of the accepted options follows.
  4719. @table @option
  4720. @item luma_radius, lr
  4721. @item chroma_radius, cr
  4722. @item alpha_radius, ar
  4723. Set an expression for the box radius in pixels used for blurring the
  4724. corresponding input plane.
  4725. The radius value must be a non-negative number, and must not be
  4726. greater than the value of the expression @code{min(w,h)/2} for the
  4727. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4728. planes.
  4729. Default value for @option{luma_radius} is "2". If not specified,
  4730. @option{chroma_radius} and @option{alpha_radius} default to the
  4731. corresponding value set for @option{luma_radius}.
  4732. The expressions can contain the following constants:
  4733. @table @option
  4734. @item w
  4735. @item h
  4736. The input width and height in pixels.
  4737. @item cw
  4738. @item ch
  4739. The input chroma image width and height in pixels.
  4740. @item hsub
  4741. @item vsub
  4742. The horizontal and vertical chroma subsample values. For example, for the
  4743. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4744. @end table
  4745. @item luma_power, lp
  4746. @item chroma_power, cp
  4747. @item alpha_power, ap
  4748. Specify how many times the boxblur filter is applied to the
  4749. corresponding plane.
  4750. Default value for @option{luma_power} is 2. If not specified,
  4751. @option{chroma_power} and @option{alpha_power} default to the
  4752. corresponding value set for @option{luma_power}.
  4753. A value of 0 will disable the effect.
  4754. @end table
  4755. @subsection Examples
  4756. @itemize
  4757. @item
  4758. Apply a boxblur filter with the luma, chroma, and alpha radii
  4759. set to 2:
  4760. @example
  4761. boxblur=luma_radius=2:luma_power=1
  4762. boxblur=2:1
  4763. @end example
  4764. @item
  4765. Set the luma radius to 2, and alpha and chroma radius to 0:
  4766. @example
  4767. boxblur=2:1:cr=0:ar=0
  4768. @end example
  4769. @item
  4770. Set the luma and chroma radii to a fraction of the video dimension:
  4771. @example
  4772. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4773. @end example
  4774. @end itemize
  4775. @section bwdif
  4776. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4777. Deinterlacing Filter").
  4778. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4779. interpolation algorithms.
  4780. It accepts the following parameters:
  4781. @table @option
  4782. @item mode
  4783. The interlacing mode to adopt. It accepts one of the following values:
  4784. @table @option
  4785. @item 0, send_frame
  4786. Output one frame for each frame.
  4787. @item 1, send_field
  4788. Output one frame for each field.
  4789. @end table
  4790. The default value is @code{send_field}.
  4791. @item parity
  4792. The picture field parity assumed for the input interlaced video. It accepts one
  4793. of the following values:
  4794. @table @option
  4795. @item 0, tff
  4796. Assume the top field is first.
  4797. @item 1, bff
  4798. Assume the bottom field is first.
  4799. @item -1, auto
  4800. Enable automatic detection of field parity.
  4801. @end table
  4802. The default value is @code{auto}.
  4803. If the interlacing is unknown or the decoder does not export this information,
  4804. top field first will be assumed.
  4805. @item deint
  4806. Specify which frames to deinterlace. Accept one of the following
  4807. values:
  4808. @table @option
  4809. @item 0, all
  4810. Deinterlace all frames.
  4811. @item 1, interlaced
  4812. Only deinterlace frames marked as interlaced.
  4813. @end table
  4814. The default value is @code{all}.
  4815. @end table
  4816. @section chromahold
  4817. Remove all color information for all colors except for certain one.
  4818. The filter accepts the following options:
  4819. @table @option
  4820. @item color
  4821. The color which will not be replaced with neutral chroma.
  4822. @item similarity
  4823. Similarity percentage with the above color.
  4824. 0.01 matches only the exact key color, while 1.0 matches everything.
  4825. @item yuv
  4826. Signals that the color passed is already in YUV instead of RGB.
  4827. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4828. This can be used to pass exact YUV values as hexadecimal numbers.
  4829. @end table
  4830. @section chromakey
  4831. YUV colorspace color/chroma keying.
  4832. The filter accepts the following options:
  4833. @table @option
  4834. @item color
  4835. The color which will be replaced with transparency.
  4836. @item similarity
  4837. Similarity percentage with the key color.
  4838. 0.01 matches only the exact key color, while 1.0 matches everything.
  4839. @item blend
  4840. Blend percentage.
  4841. 0.0 makes pixels either fully transparent, or not transparent at all.
  4842. Higher values result in semi-transparent pixels, with a higher transparency
  4843. the more similar the pixels color is to the key color.
  4844. @item yuv
  4845. Signals that the color passed is already in YUV instead of RGB.
  4846. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4847. This can be used to pass exact YUV values as hexadecimal numbers.
  4848. @end table
  4849. @subsection Examples
  4850. @itemize
  4851. @item
  4852. Make every green pixel in the input image transparent:
  4853. @example
  4854. ffmpeg -i input.png -vf chromakey=green out.png
  4855. @end example
  4856. @item
  4857. Overlay a greenscreen-video on top of a static black background.
  4858. @example
  4859. 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
  4860. @end example
  4861. @end itemize
  4862. @section chromashift
  4863. Shift chroma pixels horizontally and/or vertically.
  4864. The filter accepts the following options:
  4865. @table @option
  4866. @item cbh
  4867. Set amount to shift chroma-blue horizontally.
  4868. @item cbv
  4869. Set amount to shift chroma-blue vertically.
  4870. @item crh
  4871. Set amount to shift chroma-red horizontally.
  4872. @item crv
  4873. Set amount to shift chroma-red vertically.
  4874. @item edge
  4875. Set edge mode, can be @var{smear}, default, or @var{warp}.
  4876. @end table
  4877. @section ciescope
  4878. Display CIE color diagram with pixels overlaid onto it.
  4879. The filter accepts the following options:
  4880. @table @option
  4881. @item system
  4882. Set color system.
  4883. @table @samp
  4884. @item ntsc, 470m
  4885. @item ebu, 470bg
  4886. @item smpte
  4887. @item 240m
  4888. @item apple
  4889. @item widergb
  4890. @item cie1931
  4891. @item rec709, hdtv
  4892. @item uhdtv, rec2020
  4893. @end table
  4894. @item cie
  4895. Set CIE system.
  4896. @table @samp
  4897. @item xyy
  4898. @item ucs
  4899. @item luv
  4900. @end table
  4901. @item gamuts
  4902. Set what gamuts to draw.
  4903. See @code{system} option for available values.
  4904. @item size, s
  4905. Set ciescope size, by default set to 512.
  4906. @item intensity, i
  4907. Set intensity used to map input pixel values to CIE diagram.
  4908. @item contrast
  4909. Set contrast used to draw tongue colors that are out of active color system gamut.
  4910. @item corrgamma
  4911. Correct gamma displayed on scope, by default enabled.
  4912. @item showwhite
  4913. Show white point on CIE diagram, by default disabled.
  4914. @item gamma
  4915. Set input gamma. Used only with XYZ input color space.
  4916. @end table
  4917. @section codecview
  4918. Visualize information exported by some codecs.
  4919. Some codecs can export information through frames using side-data or other
  4920. means. For example, some MPEG based codecs export motion vectors through the
  4921. @var{export_mvs} flag in the codec @option{flags2} option.
  4922. The filter accepts the following option:
  4923. @table @option
  4924. @item mv
  4925. Set motion vectors to visualize.
  4926. Available flags for @var{mv} are:
  4927. @table @samp
  4928. @item pf
  4929. forward predicted MVs of P-frames
  4930. @item bf
  4931. forward predicted MVs of B-frames
  4932. @item bb
  4933. backward predicted MVs of B-frames
  4934. @end table
  4935. @item qp
  4936. Display quantization parameters using the chroma planes.
  4937. @item mv_type, mvt
  4938. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4939. Available flags for @var{mv_type} are:
  4940. @table @samp
  4941. @item fp
  4942. forward predicted MVs
  4943. @item bp
  4944. backward predicted MVs
  4945. @end table
  4946. @item frame_type, ft
  4947. Set frame type to visualize motion vectors of.
  4948. Available flags for @var{frame_type} are:
  4949. @table @samp
  4950. @item if
  4951. intra-coded frames (I-frames)
  4952. @item pf
  4953. predicted frames (P-frames)
  4954. @item bf
  4955. bi-directionally predicted frames (B-frames)
  4956. @end table
  4957. @end table
  4958. @subsection Examples
  4959. @itemize
  4960. @item
  4961. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4962. @example
  4963. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4964. @end example
  4965. @item
  4966. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4967. @example
  4968. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4969. @end example
  4970. @end itemize
  4971. @section colorbalance
  4972. Modify intensity of primary colors (red, green and blue) of input frames.
  4973. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4974. regions for the red-cyan, green-magenta or blue-yellow balance.
  4975. A positive adjustment value shifts the balance towards the primary color, a negative
  4976. value towards the complementary color.
  4977. The filter accepts the following options:
  4978. @table @option
  4979. @item rs
  4980. @item gs
  4981. @item bs
  4982. Adjust red, green and blue shadows (darkest pixels).
  4983. @item rm
  4984. @item gm
  4985. @item bm
  4986. Adjust red, green and blue midtones (medium pixels).
  4987. @item rh
  4988. @item gh
  4989. @item bh
  4990. Adjust red, green and blue highlights (brightest pixels).
  4991. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4992. @end table
  4993. @subsection Examples
  4994. @itemize
  4995. @item
  4996. Add red color cast to shadows:
  4997. @example
  4998. colorbalance=rs=.3
  4999. @end example
  5000. @end itemize
  5001. @section colorkey
  5002. RGB colorspace color keying.
  5003. The filter accepts the following options:
  5004. @table @option
  5005. @item color
  5006. The color which will be replaced with transparency.
  5007. @item similarity
  5008. Similarity percentage with the key color.
  5009. 0.01 matches only the exact key color, while 1.0 matches everything.
  5010. @item blend
  5011. Blend percentage.
  5012. 0.0 makes pixels either fully transparent, or not transparent at all.
  5013. Higher values result in semi-transparent pixels, with a higher transparency
  5014. the more similar the pixels color is to the key color.
  5015. @end table
  5016. @subsection Examples
  5017. @itemize
  5018. @item
  5019. Make every green pixel in the input image transparent:
  5020. @example
  5021. ffmpeg -i input.png -vf colorkey=green out.png
  5022. @end example
  5023. @item
  5024. Overlay a greenscreen-video on top of a static background image.
  5025. @example
  5026. 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
  5027. @end example
  5028. @end itemize
  5029. @section colorlevels
  5030. Adjust video input frames using levels.
  5031. The filter accepts the following options:
  5032. @table @option
  5033. @item rimin
  5034. @item gimin
  5035. @item bimin
  5036. @item aimin
  5037. Adjust red, green, blue and alpha input black point.
  5038. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5039. @item rimax
  5040. @item gimax
  5041. @item bimax
  5042. @item aimax
  5043. Adjust red, green, blue and alpha input white point.
  5044. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5045. Input levels are used to lighten highlights (bright tones), darken shadows
  5046. (dark tones), change the balance of bright and dark tones.
  5047. @item romin
  5048. @item gomin
  5049. @item bomin
  5050. @item aomin
  5051. Adjust red, green, blue and alpha output black point.
  5052. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5053. @item romax
  5054. @item gomax
  5055. @item bomax
  5056. @item aomax
  5057. Adjust red, green, blue and alpha output white point.
  5058. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5059. Output levels allows manual selection of a constrained output level range.
  5060. @end table
  5061. @subsection Examples
  5062. @itemize
  5063. @item
  5064. Make video output darker:
  5065. @example
  5066. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5067. @end example
  5068. @item
  5069. Increase contrast:
  5070. @example
  5071. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5072. @end example
  5073. @item
  5074. Make video output lighter:
  5075. @example
  5076. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5077. @end example
  5078. @item
  5079. Increase brightness:
  5080. @example
  5081. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5082. @end example
  5083. @end itemize
  5084. @section colorchannelmixer
  5085. Adjust video input frames by re-mixing color channels.
  5086. This filter modifies a color channel by adding the values associated to
  5087. the other channels of the same pixels. For example if the value to
  5088. modify is red, the output value will be:
  5089. @example
  5090. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5091. @end example
  5092. The filter accepts the following options:
  5093. @table @option
  5094. @item rr
  5095. @item rg
  5096. @item rb
  5097. @item ra
  5098. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5099. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5100. @item gr
  5101. @item gg
  5102. @item gb
  5103. @item ga
  5104. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5105. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5106. @item br
  5107. @item bg
  5108. @item bb
  5109. @item ba
  5110. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5111. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5112. @item ar
  5113. @item ag
  5114. @item ab
  5115. @item aa
  5116. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5117. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5118. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5119. @end table
  5120. @subsection Examples
  5121. @itemize
  5122. @item
  5123. Convert source to grayscale:
  5124. @example
  5125. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5126. @end example
  5127. @item
  5128. Simulate sepia tones:
  5129. @example
  5130. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5131. @end example
  5132. @end itemize
  5133. @section colormatrix
  5134. Convert color matrix.
  5135. The filter accepts the following options:
  5136. @table @option
  5137. @item src
  5138. @item dst
  5139. Specify the source and destination color matrix. Both values must be
  5140. specified.
  5141. The accepted values are:
  5142. @table @samp
  5143. @item bt709
  5144. BT.709
  5145. @item fcc
  5146. FCC
  5147. @item bt601
  5148. BT.601
  5149. @item bt470
  5150. BT.470
  5151. @item bt470bg
  5152. BT.470BG
  5153. @item smpte170m
  5154. SMPTE-170M
  5155. @item smpte240m
  5156. SMPTE-240M
  5157. @item bt2020
  5158. BT.2020
  5159. @end table
  5160. @end table
  5161. For example to convert from BT.601 to SMPTE-240M, use the command:
  5162. @example
  5163. colormatrix=bt601:smpte240m
  5164. @end example
  5165. @section colorspace
  5166. Convert colorspace, transfer characteristics or color primaries.
  5167. Input video needs to have an even size.
  5168. The filter accepts the following options:
  5169. @table @option
  5170. @anchor{all}
  5171. @item all
  5172. Specify all color properties at once.
  5173. The accepted values are:
  5174. @table @samp
  5175. @item bt470m
  5176. BT.470M
  5177. @item bt470bg
  5178. BT.470BG
  5179. @item bt601-6-525
  5180. BT.601-6 525
  5181. @item bt601-6-625
  5182. BT.601-6 625
  5183. @item bt709
  5184. BT.709
  5185. @item smpte170m
  5186. SMPTE-170M
  5187. @item smpte240m
  5188. SMPTE-240M
  5189. @item bt2020
  5190. BT.2020
  5191. @end table
  5192. @anchor{space}
  5193. @item space
  5194. Specify output colorspace.
  5195. The accepted values are:
  5196. @table @samp
  5197. @item bt709
  5198. BT.709
  5199. @item fcc
  5200. FCC
  5201. @item bt470bg
  5202. BT.470BG or BT.601-6 625
  5203. @item smpte170m
  5204. SMPTE-170M or BT.601-6 525
  5205. @item smpte240m
  5206. SMPTE-240M
  5207. @item ycgco
  5208. YCgCo
  5209. @item bt2020ncl
  5210. BT.2020 with non-constant luminance
  5211. @end table
  5212. @anchor{trc}
  5213. @item trc
  5214. Specify output transfer characteristics.
  5215. The accepted values are:
  5216. @table @samp
  5217. @item bt709
  5218. BT.709
  5219. @item bt470m
  5220. BT.470M
  5221. @item bt470bg
  5222. BT.470BG
  5223. @item gamma22
  5224. Constant gamma of 2.2
  5225. @item gamma28
  5226. Constant gamma of 2.8
  5227. @item smpte170m
  5228. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5229. @item smpte240m
  5230. SMPTE-240M
  5231. @item srgb
  5232. SRGB
  5233. @item iec61966-2-1
  5234. iec61966-2-1
  5235. @item iec61966-2-4
  5236. iec61966-2-4
  5237. @item xvycc
  5238. xvycc
  5239. @item bt2020-10
  5240. BT.2020 for 10-bits content
  5241. @item bt2020-12
  5242. BT.2020 for 12-bits content
  5243. @end table
  5244. @anchor{primaries}
  5245. @item primaries
  5246. Specify output color primaries.
  5247. The accepted values are:
  5248. @table @samp
  5249. @item bt709
  5250. BT.709
  5251. @item bt470m
  5252. BT.470M
  5253. @item bt470bg
  5254. BT.470BG or BT.601-6 625
  5255. @item smpte170m
  5256. SMPTE-170M or BT.601-6 525
  5257. @item smpte240m
  5258. SMPTE-240M
  5259. @item film
  5260. film
  5261. @item smpte431
  5262. SMPTE-431
  5263. @item smpte432
  5264. SMPTE-432
  5265. @item bt2020
  5266. BT.2020
  5267. @item jedec-p22
  5268. JEDEC P22 phosphors
  5269. @end table
  5270. @anchor{range}
  5271. @item range
  5272. Specify output color range.
  5273. The accepted values are:
  5274. @table @samp
  5275. @item tv
  5276. TV (restricted) range
  5277. @item mpeg
  5278. MPEG (restricted) range
  5279. @item pc
  5280. PC (full) range
  5281. @item jpeg
  5282. JPEG (full) range
  5283. @end table
  5284. @item format
  5285. Specify output color format.
  5286. The accepted values are:
  5287. @table @samp
  5288. @item yuv420p
  5289. YUV 4:2:0 planar 8-bits
  5290. @item yuv420p10
  5291. YUV 4:2:0 planar 10-bits
  5292. @item yuv420p12
  5293. YUV 4:2:0 planar 12-bits
  5294. @item yuv422p
  5295. YUV 4:2:2 planar 8-bits
  5296. @item yuv422p10
  5297. YUV 4:2:2 planar 10-bits
  5298. @item yuv422p12
  5299. YUV 4:2:2 planar 12-bits
  5300. @item yuv444p
  5301. YUV 4:4:4 planar 8-bits
  5302. @item yuv444p10
  5303. YUV 4:4:4 planar 10-bits
  5304. @item yuv444p12
  5305. YUV 4:4:4 planar 12-bits
  5306. @end table
  5307. @item fast
  5308. Do a fast conversion, which skips gamma/primary correction. This will take
  5309. significantly less CPU, but will be mathematically incorrect. To get output
  5310. compatible with that produced by the colormatrix filter, use fast=1.
  5311. @item dither
  5312. Specify dithering mode.
  5313. The accepted values are:
  5314. @table @samp
  5315. @item none
  5316. No dithering
  5317. @item fsb
  5318. Floyd-Steinberg dithering
  5319. @end table
  5320. @item wpadapt
  5321. Whitepoint adaptation mode.
  5322. The accepted values are:
  5323. @table @samp
  5324. @item bradford
  5325. Bradford whitepoint adaptation
  5326. @item vonkries
  5327. von Kries whitepoint adaptation
  5328. @item identity
  5329. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5330. @end table
  5331. @item iall
  5332. Override all input properties at once. Same accepted values as @ref{all}.
  5333. @item ispace
  5334. Override input colorspace. Same accepted values as @ref{space}.
  5335. @item iprimaries
  5336. Override input color primaries. Same accepted values as @ref{primaries}.
  5337. @item itrc
  5338. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5339. @item irange
  5340. Override input color range. Same accepted values as @ref{range}.
  5341. @end table
  5342. The filter converts the transfer characteristics, color space and color
  5343. primaries to the specified user values. The output value, if not specified,
  5344. is set to a default value based on the "all" property. If that property is
  5345. also not specified, the filter will log an error. The output color range and
  5346. format default to the same value as the input color range and format. The
  5347. input transfer characteristics, color space, color primaries and color range
  5348. should be set on the input data. If any of these are missing, the filter will
  5349. log an error and no conversion will take place.
  5350. For example to convert the input to SMPTE-240M, use the command:
  5351. @example
  5352. colorspace=smpte240m
  5353. @end example
  5354. @section convolution
  5355. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5356. The filter accepts the following options:
  5357. @table @option
  5358. @item 0m
  5359. @item 1m
  5360. @item 2m
  5361. @item 3m
  5362. Set matrix for each plane.
  5363. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5364. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5365. @item 0rdiv
  5366. @item 1rdiv
  5367. @item 2rdiv
  5368. @item 3rdiv
  5369. Set multiplier for calculated value for each plane.
  5370. If unset or 0, it will be sum of all matrix elements.
  5371. @item 0bias
  5372. @item 1bias
  5373. @item 2bias
  5374. @item 3bias
  5375. Set bias for each plane. This value is added to the result of the multiplication.
  5376. Useful for making the overall image brighter or darker. Default is 0.0.
  5377. @item 0mode
  5378. @item 1mode
  5379. @item 2mode
  5380. @item 3mode
  5381. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5382. Default is @var{square}.
  5383. @end table
  5384. @subsection Examples
  5385. @itemize
  5386. @item
  5387. Apply sharpen:
  5388. @example
  5389. 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"
  5390. @end example
  5391. @item
  5392. Apply blur:
  5393. @example
  5394. 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"
  5395. @end example
  5396. @item
  5397. Apply edge enhance:
  5398. @example
  5399. 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"
  5400. @end example
  5401. @item
  5402. Apply edge detect:
  5403. @example
  5404. 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"
  5405. @end example
  5406. @item
  5407. Apply laplacian edge detector which includes diagonals:
  5408. @example
  5409. 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"
  5410. @end example
  5411. @item
  5412. Apply emboss:
  5413. @example
  5414. 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"
  5415. @end example
  5416. @end itemize
  5417. @section convolve
  5418. Apply 2D convolution of video stream in frequency domain using second stream
  5419. as impulse.
  5420. The filter accepts the following options:
  5421. @table @option
  5422. @item planes
  5423. Set which planes to process.
  5424. @item impulse
  5425. Set which impulse video frames will be processed, can be @var{first}
  5426. or @var{all}. Default is @var{all}.
  5427. @end table
  5428. The @code{convolve} filter also supports the @ref{framesync} options.
  5429. @section copy
  5430. Copy the input video source unchanged to the output. This is mainly useful for
  5431. testing purposes.
  5432. @anchor{coreimage}
  5433. @section coreimage
  5434. Video filtering on GPU using Apple's CoreImage API on OSX.
  5435. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5436. processed by video hardware. However, software-based OpenGL implementations
  5437. exist which means there is no guarantee for hardware processing. It depends on
  5438. the respective OSX.
  5439. There are many filters and image generators provided by Apple that come with a
  5440. large variety of options. The filter has to be referenced by its name along
  5441. with its options.
  5442. The coreimage filter accepts the following options:
  5443. @table @option
  5444. @item list_filters
  5445. List all available filters and generators along with all their respective
  5446. options as well as possible minimum and maximum values along with the default
  5447. values.
  5448. @example
  5449. list_filters=true
  5450. @end example
  5451. @item filter
  5452. Specify all filters by their respective name and options.
  5453. Use @var{list_filters} to determine all valid filter names and options.
  5454. Numerical options are specified by a float value and are automatically clamped
  5455. to their respective value range. Vector and color options have to be specified
  5456. by a list of space separated float values. Character escaping has to be done.
  5457. A special option name @code{default} is available to use default options for a
  5458. filter.
  5459. It is required to specify either @code{default} or at least one of the filter options.
  5460. All omitted options are used with their default values.
  5461. The syntax of the filter string is as follows:
  5462. @example
  5463. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5464. @end example
  5465. @item output_rect
  5466. Specify a rectangle where the output of the filter chain is copied into the
  5467. input image. It is given by a list of space separated float values:
  5468. @example
  5469. output_rect=x\ y\ width\ height
  5470. @end example
  5471. If not given, the output rectangle equals the dimensions of the input image.
  5472. The output rectangle is automatically cropped at the borders of the input
  5473. image. Negative values are valid for each component.
  5474. @example
  5475. output_rect=25\ 25\ 100\ 100
  5476. @end example
  5477. @end table
  5478. Several filters can be chained for successive processing without GPU-HOST
  5479. transfers allowing for fast processing of complex filter chains.
  5480. Currently, only filters with zero (generators) or exactly one (filters) input
  5481. image and one output image are supported. Also, transition filters are not yet
  5482. usable as intended.
  5483. Some filters generate output images with additional padding depending on the
  5484. respective filter kernel. The padding is automatically removed to ensure the
  5485. filter output has the same size as the input image.
  5486. For image generators, the size of the output image is determined by the
  5487. previous output image of the filter chain or the input image of the whole
  5488. filterchain, respectively. The generators do not use the pixel information of
  5489. this image to generate their output. However, the generated output is
  5490. blended onto this image, resulting in partial or complete coverage of the
  5491. output image.
  5492. The @ref{coreimagesrc} video source can be used for generating input images
  5493. which are directly fed into the filter chain. By using it, providing input
  5494. images by another video source or an input video is not required.
  5495. @subsection Examples
  5496. @itemize
  5497. @item
  5498. List all filters available:
  5499. @example
  5500. coreimage=list_filters=true
  5501. @end example
  5502. @item
  5503. Use the CIBoxBlur filter with default options to blur an image:
  5504. @example
  5505. coreimage=filter=CIBoxBlur@@default
  5506. @end example
  5507. @item
  5508. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5509. its center at 100x100 and a radius of 50 pixels:
  5510. @example
  5511. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5512. @end example
  5513. @item
  5514. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5515. given as complete and escaped command-line for Apple's standard bash shell:
  5516. @example
  5517. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5518. @end example
  5519. @end itemize
  5520. @section crop
  5521. Crop the input video to given dimensions.
  5522. It accepts the following parameters:
  5523. @table @option
  5524. @item w, out_w
  5525. The width of the output video. It defaults to @code{iw}.
  5526. This expression is evaluated only once during the filter
  5527. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5528. @item h, out_h
  5529. The height of the output video. It defaults to @code{ih}.
  5530. This expression is evaluated only once during the filter
  5531. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5532. @item x
  5533. The horizontal position, in the input video, of the left edge of the output
  5534. video. It defaults to @code{(in_w-out_w)/2}.
  5535. This expression is evaluated per-frame.
  5536. @item y
  5537. The vertical position, in the input video, of the top edge of the output video.
  5538. It defaults to @code{(in_h-out_h)/2}.
  5539. This expression is evaluated per-frame.
  5540. @item keep_aspect
  5541. If set to 1 will force the output display aspect ratio
  5542. to be the same of the input, by changing the output sample aspect
  5543. ratio. It defaults to 0.
  5544. @item exact
  5545. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5546. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5547. It defaults to 0.
  5548. @end table
  5549. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5550. expressions containing the following constants:
  5551. @table @option
  5552. @item x
  5553. @item y
  5554. The computed values for @var{x} and @var{y}. They are evaluated for
  5555. each new frame.
  5556. @item in_w
  5557. @item in_h
  5558. The input width and height.
  5559. @item iw
  5560. @item ih
  5561. These are the same as @var{in_w} and @var{in_h}.
  5562. @item out_w
  5563. @item out_h
  5564. The output (cropped) width and height.
  5565. @item ow
  5566. @item oh
  5567. These are the same as @var{out_w} and @var{out_h}.
  5568. @item a
  5569. same as @var{iw} / @var{ih}
  5570. @item sar
  5571. input sample aspect ratio
  5572. @item dar
  5573. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5574. @item hsub
  5575. @item vsub
  5576. horizontal and vertical chroma subsample values. For example for the
  5577. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5578. @item n
  5579. The number of the input frame, starting from 0.
  5580. @item pos
  5581. the position in the file of the input frame, NAN if unknown
  5582. @item t
  5583. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5584. @end table
  5585. The expression for @var{out_w} may depend on the value of @var{out_h},
  5586. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5587. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5588. evaluated after @var{out_w} and @var{out_h}.
  5589. The @var{x} and @var{y} parameters specify the expressions for the
  5590. position of the top-left corner of the output (non-cropped) area. They
  5591. are evaluated for each frame. If the evaluated value is not valid, it
  5592. is approximated to the nearest valid value.
  5593. The expression for @var{x} may depend on @var{y}, and the expression
  5594. for @var{y} may depend on @var{x}.
  5595. @subsection Examples
  5596. @itemize
  5597. @item
  5598. Crop area with size 100x100 at position (12,34).
  5599. @example
  5600. crop=100:100:12:34
  5601. @end example
  5602. Using named options, the example above becomes:
  5603. @example
  5604. crop=w=100:h=100:x=12:y=34
  5605. @end example
  5606. @item
  5607. Crop the central input area with size 100x100:
  5608. @example
  5609. crop=100:100
  5610. @end example
  5611. @item
  5612. Crop the central input area with size 2/3 of the input video:
  5613. @example
  5614. crop=2/3*in_w:2/3*in_h
  5615. @end example
  5616. @item
  5617. Crop the input video central square:
  5618. @example
  5619. crop=out_w=in_h
  5620. crop=in_h
  5621. @end example
  5622. @item
  5623. Delimit the rectangle with the top-left corner placed at position
  5624. 100:100 and the right-bottom corner corresponding to the right-bottom
  5625. corner of the input image.
  5626. @example
  5627. crop=in_w-100:in_h-100:100:100
  5628. @end example
  5629. @item
  5630. Crop 10 pixels from the left and right borders, and 20 pixels from
  5631. the top and bottom borders
  5632. @example
  5633. crop=in_w-2*10:in_h-2*20
  5634. @end example
  5635. @item
  5636. Keep only the bottom right quarter of the input image:
  5637. @example
  5638. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5639. @end example
  5640. @item
  5641. Crop height for getting Greek harmony:
  5642. @example
  5643. crop=in_w:1/PHI*in_w
  5644. @end example
  5645. @item
  5646. Apply trembling effect:
  5647. @example
  5648. 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)
  5649. @end example
  5650. @item
  5651. Apply erratic camera effect depending on timestamp:
  5652. @example
  5653. 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)"
  5654. @end example
  5655. @item
  5656. Set x depending on the value of y:
  5657. @example
  5658. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5659. @end example
  5660. @end itemize
  5661. @subsection Commands
  5662. This filter supports the following commands:
  5663. @table @option
  5664. @item w, out_w
  5665. @item h, out_h
  5666. @item x
  5667. @item y
  5668. Set width/height of the output video and the horizontal/vertical position
  5669. in the input video.
  5670. The command accepts the same syntax of the corresponding option.
  5671. If the specified expression is not valid, it is kept at its current
  5672. value.
  5673. @end table
  5674. @section cropdetect
  5675. Auto-detect the crop size.
  5676. It calculates the necessary cropping parameters and prints the
  5677. recommended parameters via the logging system. The detected dimensions
  5678. correspond to the non-black area of the input video.
  5679. It accepts the following parameters:
  5680. @table @option
  5681. @item limit
  5682. Set higher black value threshold, which can be optionally specified
  5683. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5684. value greater to the set value is considered non-black. It defaults to 24.
  5685. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5686. on the bitdepth of the pixel format.
  5687. @item round
  5688. The value which the width/height should be divisible by. It defaults to
  5689. 16. The offset is automatically adjusted to center the video. Use 2 to
  5690. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5691. encoding to most video codecs.
  5692. @item reset_count, reset
  5693. Set the counter that determines after how many frames cropdetect will
  5694. reset the previously detected largest video area and start over to
  5695. detect the current optimal crop area. Default value is 0.
  5696. This can be useful when channel logos distort the video area. 0
  5697. indicates 'never reset', and returns the largest area encountered during
  5698. playback.
  5699. @end table
  5700. @anchor{cue}
  5701. @section cue
  5702. Delay video filtering until a given wallclock timestamp. The filter first
  5703. passes on @option{preroll} amount of frames, then it buffers at most
  5704. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5705. it forwards the buffered frames and also any subsequent frames coming in its
  5706. input.
  5707. The filter can be used synchronize the output of multiple ffmpeg processes for
  5708. realtime output devices like decklink. By putting the delay in the filtering
  5709. chain and pre-buffering frames the process can pass on data to output almost
  5710. immediately after the target wallclock timestamp is reached.
  5711. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5712. some use cases.
  5713. @table @option
  5714. @item cue
  5715. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5716. @item preroll
  5717. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5718. @item buffer
  5719. The maximum duration of content to buffer before waiting for the cue expressed
  5720. in seconds. Default is 0.
  5721. @end table
  5722. @anchor{curves}
  5723. @section curves
  5724. Apply color adjustments using curves.
  5725. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5726. component (red, green and blue) has its values defined by @var{N} key points
  5727. tied from each other using a smooth curve. The x-axis represents the pixel
  5728. values from the input frame, and the y-axis the new pixel values to be set for
  5729. the output frame.
  5730. By default, a component curve is defined by the two points @var{(0;0)} and
  5731. @var{(1;1)}. This creates a straight line where each original pixel value is
  5732. "adjusted" to its own value, which means no change to the image.
  5733. The filter allows you to redefine these two points and add some more. A new
  5734. curve (using a natural cubic spline interpolation) will be define to pass
  5735. smoothly through all these new coordinates. The new defined points needs to be
  5736. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5737. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5738. the vector spaces, the values will be clipped accordingly.
  5739. The filter accepts the following options:
  5740. @table @option
  5741. @item preset
  5742. Select one of the available color presets. This option can be used in addition
  5743. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5744. options takes priority on the preset values.
  5745. Available presets are:
  5746. @table @samp
  5747. @item none
  5748. @item color_negative
  5749. @item cross_process
  5750. @item darker
  5751. @item increase_contrast
  5752. @item lighter
  5753. @item linear_contrast
  5754. @item medium_contrast
  5755. @item negative
  5756. @item strong_contrast
  5757. @item vintage
  5758. @end table
  5759. Default is @code{none}.
  5760. @item master, m
  5761. Set the master key points. These points will define a second pass mapping. It
  5762. is sometimes called a "luminance" or "value" mapping. It can be used with
  5763. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5764. post-processing LUT.
  5765. @item red, r
  5766. Set the key points for the red component.
  5767. @item green, g
  5768. Set the key points for the green component.
  5769. @item blue, b
  5770. Set the key points for the blue component.
  5771. @item all
  5772. Set the key points for all components (not including master).
  5773. Can be used in addition to the other key points component
  5774. options. In this case, the unset component(s) will fallback on this
  5775. @option{all} setting.
  5776. @item psfile
  5777. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5778. @item plot
  5779. Save Gnuplot script of the curves in specified file.
  5780. @end table
  5781. To avoid some filtergraph syntax conflicts, each key points list need to be
  5782. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5783. @subsection Examples
  5784. @itemize
  5785. @item
  5786. Increase slightly the middle level of blue:
  5787. @example
  5788. curves=blue='0/0 0.5/0.58 1/1'
  5789. @end example
  5790. @item
  5791. Vintage effect:
  5792. @example
  5793. 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'
  5794. @end example
  5795. Here we obtain the following coordinates for each components:
  5796. @table @var
  5797. @item red
  5798. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5799. @item green
  5800. @code{(0;0) (0.50;0.48) (1;1)}
  5801. @item blue
  5802. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5803. @end table
  5804. @item
  5805. The previous example can also be achieved with the associated built-in preset:
  5806. @example
  5807. curves=preset=vintage
  5808. @end example
  5809. @item
  5810. Or simply:
  5811. @example
  5812. curves=vintage
  5813. @end example
  5814. @item
  5815. Use a Photoshop preset and redefine the points of the green component:
  5816. @example
  5817. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5818. @end example
  5819. @item
  5820. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5821. and @command{gnuplot}:
  5822. @example
  5823. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5824. gnuplot -p /tmp/curves.plt
  5825. @end example
  5826. @end itemize
  5827. @section datascope
  5828. Video data analysis filter.
  5829. This filter shows hexadecimal pixel values of part of video.
  5830. The filter accepts the following options:
  5831. @table @option
  5832. @item size, s
  5833. Set output video size.
  5834. @item x
  5835. Set x offset from where to pick pixels.
  5836. @item y
  5837. Set y offset from where to pick pixels.
  5838. @item mode
  5839. Set scope mode, can be one of the following:
  5840. @table @samp
  5841. @item mono
  5842. Draw hexadecimal pixel values with white color on black background.
  5843. @item color
  5844. Draw hexadecimal pixel values with input video pixel color on black
  5845. background.
  5846. @item color2
  5847. Draw hexadecimal pixel values on color background picked from input video,
  5848. the text color is picked in such way so its always visible.
  5849. @end table
  5850. @item axis
  5851. Draw rows and columns numbers on left and top of video.
  5852. @item opacity
  5853. Set background opacity.
  5854. @end table
  5855. @section dctdnoiz
  5856. Denoise frames using 2D DCT (frequency domain filtering).
  5857. This filter is not designed for real time.
  5858. The filter accepts the following options:
  5859. @table @option
  5860. @item sigma, s
  5861. Set the noise sigma constant.
  5862. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5863. coefficient (absolute value) below this threshold with be dropped.
  5864. If you need a more advanced filtering, see @option{expr}.
  5865. Default is @code{0}.
  5866. @item overlap
  5867. Set number overlapping pixels for each block. Since the filter can be slow, you
  5868. may want to reduce this value, at the cost of a less effective filter and the
  5869. risk of various artefacts.
  5870. If the overlapping value doesn't permit processing the whole input width or
  5871. height, a warning will be displayed and according borders won't be denoised.
  5872. Default value is @var{blocksize}-1, which is the best possible setting.
  5873. @item expr, e
  5874. Set the coefficient factor expression.
  5875. For each coefficient of a DCT block, this expression will be evaluated as a
  5876. multiplier value for the coefficient.
  5877. If this is option is set, the @option{sigma} option will be ignored.
  5878. The absolute value of the coefficient can be accessed through the @var{c}
  5879. variable.
  5880. @item n
  5881. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5882. @var{blocksize}, which is the width and height of the processed blocks.
  5883. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5884. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5885. on the speed processing. Also, a larger block size does not necessarily means a
  5886. better de-noising.
  5887. @end table
  5888. @subsection Examples
  5889. Apply a denoise with a @option{sigma} of @code{4.5}:
  5890. @example
  5891. dctdnoiz=4.5
  5892. @end example
  5893. The same operation can be achieved using the expression system:
  5894. @example
  5895. dctdnoiz=e='gte(c, 4.5*3)'
  5896. @end example
  5897. Violent denoise using a block size of @code{16x16}:
  5898. @example
  5899. dctdnoiz=15:n=4
  5900. @end example
  5901. @section deband
  5902. Remove banding artifacts from input video.
  5903. It works by replacing banded pixels with average value of referenced pixels.
  5904. The filter accepts the following options:
  5905. @table @option
  5906. @item 1thr
  5907. @item 2thr
  5908. @item 3thr
  5909. @item 4thr
  5910. Set banding detection threshold for each plane. Default is 0.02.
  5911. Valid range is 0.00003 to 0.5.
  5912. If difference between current pixel and reference pixel is less than threshold,
  5913. it will be considered as banded.
  5914. @item range, r
  5915. Banding detection range in pixels. Default is 16. If positive, random number
  5916. in range 0 to set value will be used. If negative, exact absolute value
  5917. will be used.
  5918. The range defines square of four pixels around current pixel.
  5919. @item direction, d
  5920. Set direction in radians from which four pixel will be compared. If positive,
  5921. random direction from 0 to set direction will be picked. If negative, exact of
  5922. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5923. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5924. column.
  5925. @item blur, b
  5926. If enabled, current pixel is compared with average value of all four
  5927. surrounding pixels. The default is enabled. If disabled current pixel is
  5928. compared with all four surrounding pixels. The pixel is considered banded
  5929. if only all four differences with surrounding pixels are less than threshold.
  5930. @item coupling, c
  5931. If enabled, current pixel is changed if and only if all pixel components are banded,
  5932. e.g. banding detection threshold is triggered for all color components.
  5933. The default is disabled.
  5934. @end table
  5935. @section deblock
  5936. Remove blocking artifacts from input video.
  5937. The filter accepts the following options:
  5938. @table @option
  5939. @item filter
  5940. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5941. This controls what kind of deblocking is applied.
  5942. @item block
  5943. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5944. @item alpha
  5945. @item beta
  5946. @item gamma
  5947. @item delta
  5948. Set blocking detection thresholds. Allowed range is 0 to 1.
  5949. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5950. Using higher threshold gives more deblocking strength.
  5951. Setting @var{alpha} controls threshold detection at exact edge of block.
  5952. Remaining options controls threshold detection near the edge. Each one for
  5953. below/above or left/right. Setting any of those to @var{0} disables
  5954. deblocking.
  5955. @item planes
  5956. Set planes to filter. Default is to filter all available planes.
  5957. @end table
  5958. @subsection Examples
  5959. @itemize
  5960. @item
  5961. Deblock using weak filter and block size of 4 pixels.
  5962. @example
  5963. deblock=filter=weak:block=4
  5964. @end example
  5965. @item
  5966. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5967. deblocking more edges.
  5968. @example
  5969. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5970. @end example
  5971. @item
  5972. Similar as above, but filter only first plane.
  5973. @example
  5974. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5975. @end example
  5976. @item
  5977. Similar as above, but filter only second and third plane.
  5978. @example
  5979. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5980. @end example
  5981. @end itemize
  5982. @anchor{decimate}
  5983. @section decimate
  5984. Drop duplicated frames at regular intervals.
  5985. The filter accepts the following options:
  5986. @table @option
  5987. @item cycle
  5988. Set the number of frames from which one will be dropped. Setting this to
  5989. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5990. Default is @code{5}.
  5991. @item dupthresh
  5992. Set the threshold for duplicate detection. If the difference metric for a frame
  5993. is less than or equal to this value, then it is declared as duplicate. Default
  5994. is @code{1.1}
  5995. @item scthresh
  5996. Set scene change threshold. Default is @code{15}.
  5997. @item blockx
  5998. @item blocky
  5999. Set the size of the x and y-axis blocks used during metric calculations.
  6000. Larger blocks give better noise suppression, but also give worse detection of
  6001. small movements. Must be a power of two. Default is @code{32}.
  6002. @item ppsrc
  6003. Mark main input as a pre-processed input and activate clean source input
  6004. stream. This allows the input to be pre-processed with various filters to help
  6005. the metrics calculation while keeping the frame selection lossless. When set to
  6006. @code{1}, the first stream is for the pre-processed input, and the second
  6007. stream is the clean source from where the kept frames are chosen. Default is
  6008. @code{0}.
  6009. @item chroma
  6010. Set whether or not chroma is considered in the metric calculations. Default is
  6011. @code{1}.
  6012. @end table
  6013. @section deconvolve
  6014. Apply 2D deconvolution of video stream in frequency domain using second stream
  6015. as impulse.
  6016. The filter accepts the following options:
  6017. @table @option
  6018. @item planes
  6019. Set which planes to process.
  6020. @item impulse
  6021. Set which impulse video frames will be processed, can be @var{first}
  6022. or @var{all}. Default is @var{all}.
  6023. @item noise
  6024. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6025. and height are not same and not power of 2 or if stream prior to convolving
  6026. had noise.
  6027. @end table
  6028. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6029. @section dedot
  6030. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6031. It accepts the following options:
  6032. @table @option
  6033. @item m
  6034. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6035. @var{rainbows} for cross-color reduction.
  6036. @item lt
  6037. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6038. @item tl
  6039. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6040. @item tc
  6041. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6042. @item ct
  6043. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6044. @end table
  6045. @section deflate
  6046. Apply deflate effect to the video.
  6047. This filter replaces the pixel by the local(3x3) average by taking into account
  6048. only values lower than the pixel.
  6049. It accepts the following options:
  6050. @table @option
  6051. @item threshold0
  6052. @item threshold1
  6053. @item threshold2
  6054. @item threshold3
  6055. Limit the maximum change for each plane, default is 65535.
  6056. If 0, plane will remain unchanged.
  6057. @end table
  6058. @section deflicker
  6059. Remove temporal frame luminance variations.
  6060. It accepts the following options:
  6061. @table @option
  6062. @item size, s
  6063. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6064. @item mode, m
  6065. Set averaging mode to smooth temporal luminance variations.
  6066. Available values are:
  6067. @table @samp
  6068. @item am
  6069. Arithmetic mean
  6070. @item gm
  6071. Geometric mean
  6072. @item hm
  6073. Harmonic mean
  6074. @item qm
  6075. Quadratic mean
  6076. @item cm
  6077. Cubic mean
  6078. @item pm
  6079. Power mean
  6080. @item median
  6081. Median
  6082. @end table
  6083. @item bypass
  6084. Do not actually modify frame. Useful when one only wants metadata.
  6085. @end table
  6086. @section dejudder
  6087. Remove judder produced by partially interlaced telecined content.
  6088. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6089. source was partially telecined content then the output of @code{pullup,dejudder}
  6090. will have a variable frame rate. May change the recorded frame rate of the
  6091. container. Aside from that change, this filter will not affect constant frame
  6092. rate video.
  6093. The option available in this filter is:
  6094. @table @option
  6095. @item cycle
  6096. Specify the length of the window over which the judder repeats.
  6097. Accepts any integer greater than 1. Useful values are:
  6098. @table @samp
  6099. @item 4
  6100. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6101. @item 5
  6102. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6103. @item 20
  6104. If a mixture of the two.
  6105. @end table
  6106. The default is @samp{4}.
  6107. @end table
  6108. @section delogo
  6109. Suppress a TV station logo by a simple interpolation of the surrounding
  6110. pixels. Just set a rectangle covering the logo and watch it disappear
  6111. (and sometimes something even uglier appear - your mileage may vary).
  6112. It accepts the following parameters:
  6113. @table @option
  6114. @item x
  6115. @item y
  6116. Specify the top left corner coordinates of the logo. They must be
  6117. specified.
  6118. @item w
  6119. @item h
  6120. Specify the width and height of the logo to clear. They must be
  6121. specified.
  6122. @item band, t
  6123. Specify the thickness of the fuzzy edge of the rectangle (added to
  6124. @var{w} and @var{h}). The default value is 1. This option is
  6125. deprecated, setting higher values should no longer be necessary and
  6126. is not recommended.
  6127. @item show
  6128. When set to 1, a green rectangle is drawn on the screen to simplify
  6129. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6130. The default value is 0.
  6131. The rectangle is drawn on the outermost pixels which will be (partly)
  6132. replaced with interpolated values. The values of the next pixels
  6133. immediately outside this rectangle in each direction will be used to
  6134. compute the interpolated pixel values inside the rectangle.
  6135. @end table
  6136. @subsection Examples
  6137. @itemize
  6138. @item
  6139. Set a rectangle covering the area with top left corner coordinates 0,0
  6140. and size 100x77, and a band of size 10:
  6141. @example
  6142. delogo=x=0:y=0:w=100:h=77:band=10
  6143. @end example
  6144. @end itemize
  6145. @section deshake
  6146. Attempt to fix small changes in horizontal and/or vertical shift. This
  6147. filter helps remove camera shake from hand-holding a camera, bumping a
  6148. tripod, moving on a vehicle, etc.
  6149. The filter accepts the following options:
  6150. @table @option
  6151. @item x
  6152. @item y
  6153. @item w
  6154. @item h
  6155. Specify a rectangular area where to limit the search for motion
  6156. vectors.
  6157. If desired the search for motion vectors can be limited to a
  6158. rectangular area of the frame defined by its top left corner, width
  6159. and height. These parameters have the same meaning as the drawbox
  6160. filter which can be used to visualise the position of the bounding
  6161. box.
  6162. This is useful when simultaneous movement of subjects within the frame
  6163. might be confused for camera motion by the motion vector search.
  6164. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6165. then the full frame is used. This allows later options to be set
  6166. without specifying the bounding box for the motion vector search.
  6167. Default - search the whole frame.
  6168. @item rx
  6169. @item ry
  6170. Specify the maximum extent of movement in x and y directions in the
  6171. range 0-64 pixels. Default 16.
  6172. @item edge
  6173. Specify how to generate pixels to fill blanks at the edge of the
  6174. frame. Available values are:
  6175. @table @samp
  6176. @item blank, 0
  6177. Fill zeroes at blank locations
  6178. @item original, 1
  6179. Original image at blank locations
  6180. @item clamp, 2
  6181. Extruded edge value at blank locations
  6182. @item mirror, 3
  6183. Mirrored edge at blank locations
  6184. @end table
  6185. Default value is @samp{mirror}.
  6186. @item blocksize
  6187. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6188. default 8.
  6189. @item contrast
  6190. Specify the contrast threshold for blocks. Only blocks with more than
  6191. the specified contrast (difference between darkest and lightest
  6192. pixels) will be considered. Range 1-255, default 125.
  6193. @item search
  6194. Specify the search strategy. Available values are:
  6195. @table @samp
  6196. @item exhaustive, 0
  6197. Set exhaustive search
  6198. @item less, 1
  6199. Set less exhaustive search.
  6200. @end table
  6201. Default value is @samp{exhaustive}.
  6202. @item filename
  6203. If set then a detailed log of the motion search is written to the
  6204. specified file.
  6205. @end table
  6206. @section despill
  6207. Remove unwanted contamination of foreground colors, caused by reflected color of
  6208. greenscreen or bluescreen.
  6209. This filter accepts the following options:
  6210. @table @option
  6211. @item type
  6212. Set what type of despill to use.
  6213. @item mix
  6214. Set how spillmap will be generated.
  6215. @item expand
  6216. Set how much to get rid of still remaining spill.
  6217. @item red
  6218. Controls amount of red in spill area.
  6219. @item green
  6220. Controls amount of green in spill area.
  6221. Should be -1 for greenscreen.
  6222. @item blue
  6223. Controls amount of blue in spill area.
  6224. Should be -1 for bluescreen.
  6225. @item brightness
  6226. Controls brightness of spill area, preserving colors.
  6227. @item alpha
  6228. Modify alpha from generated spillmap.
  6229. @end table
  6230. @section detelecine
  6231. Apply an exact inverse of the telecine operation. It requires a predefined
  6232. pattern specified using the pattern option which must be the same as that passed
  6233. to the telecine filter.
  6234. This filter accepts the following options:
  6235. @table @option
  6236. @item first_field
  6237. @table @samp
  6238. @item top, t
  6239. top field first
  6240. @item bottom, b
  6241. bottom field first
  6242. The default value is @code{top}.
  6243. @end table
  6244. @item pattern
  6245. A string of numbers representing the pulldown pattern you wish to apply.
  6246. The default value is @code{23}.
  6247. @item start_frame
  6248. A number representing position of the first frame with respect to the telecine
  6249. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6250. @end table
  6251. @section dilation
  6252. Apply dilation effect to the video.
  6253. This filter replaces the pixel by the local(3x3) maximum.
  6254. It accepts the following options:
  6255. @table @option
  6256. @item threshold0
  6257. @item threshold1
  6258. @item threshold2
  6259. @item threshold3
  6260. Limit the maximum change for each plane, default is 65535.
  6261. If 0, plane will remain unchanged.
  6262. @item coordinates
  6263. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6264. pixels are used.
  6265. Flags to local 3x3 coordinates maps like this:
  6266. 1 2 3
  6267. 4 5
  6268. 6 7 8
  6269. @end table
  6270. @section displace
  6271. Displace pixels as indicated by second and third input stream.
  6272. It takes three input streams and outputs one stream, the first input is the
  6273. source, and second and third input are displacement maps.
  6274. The second input specifies how much to displace pixels along the
  6275. x-axis, while the third input specifies how much to displace pixels
  6276. along the y-axis.
  6277. If one of displacement map streams terminates, last frame from that
  6278. displacement map will be used.
  6279. Note that once generated, displacements maps can be reused over and over again.
  6280. A description of the accepted options follows.
  6281. @table @option
  6282. @item edge
  6283. Set displace behavior for pixels that are out of range.
  6284. Available values are:
  6285. @table @samp
  6286. @item blank
  6287. Missing pixels are replaced by black pixels.
  6288. @item smear
  6289. Adjacent pixels will spread out to replace missing pixels.
  6290. @item wrap
  6291. Out of range pixels are wrapped so they point to pixels of other side.
  6292. @item mirror
  6293. Out of range pixels will be replaced with mirrored pixels.
  6294. @end table
  6295. Default is @samp{smear}.
  6296. @end table
  6297. @subsection Examples
  6298. @itemize
  6299. @item
  6300. Add ripple effect to rgb input of video size hd720:
  6301. @example
  6302. 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
  6303. @end example
  6304. @item
  6305. Add wave effect to rgb input of video size hd720:
  6306. @example
  6307. 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
  6308. @end example
  6309. @end itemize
  6310. @section drawbox
  6311. Draw a colored box on the input image.
  6312. It accepts the following parameters:
  6313. @table @option
  6314. @item x
  6315. @item y
  6316. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6317. @item width, w
  6318. @item height, h
  6319. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6320. the input width and height. It defaults to 0.
  6321. @item color, c
  6322. Specify the color of the box to write. For the general syntax of this option,
  6323. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6324. value @code{invert} is used, the box edge color is the same as the
  6325. video with inverted luma.
  6326. @item thickness, t
  6327. The expression which sets the thickness of the box edge.
  6328. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6329. See below for the list of accepted constants.
  6330. @item replace
  6331. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6332. will overwrite the video's color and alpha pixels.
  6333. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6334. @end table
  6335. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6336. following constants:
  6337. @table @option
  6338. @item dar
  6339. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6340. @item hsub
  6341. @item vsub
  6342. horizontal and vertical chroma subsample values. For example for the
  6343. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6344. @item in_h, ih
  6345. @item in_w, iw
  6346. The input width and height.
  6347. @item sar
  6348. The input sample aspect ratio.
  6349. @item x
  6350. @item y
  6351. The x and y offset coordinates where the box is drawn.
  6352. @item w
  6353. @item h
  6354. The width and height of the drawn box.
  6355. @item t
  6356. The thickness of the drawn box.
  6357. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6358. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6359. @end table
  6360. @subsection Examples
  6361. @itemize
  6362. @item
  6363. Draw a black box around the edge of the input image:
  6364. @example
  6365. drawbox
  6366. @end example
  6367. @item
  6368. Draw a box with color red and an opacity of 50%:
  6369. @example
  6370. drawbox=10:20:200:60:red@@0.5
  6371. @end example
  6372. The previous example can be specified as:
  6373. @example
  6374. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6375. @end example
  6376. @item
  6377. Fill the box with pink color:
  6378. @example
  6379. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6380. @end example
  6381. @item
  6382. Draw a 2-pixel red 2.40:1 mask:
  6383. @example
  6384. 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
  6385. @end example
  6386. @end itemize
  6387. @section drawgrid
  6388. Draw a grid on the input image.
  6389. It accepts the following parameters:
  6390. @table @option
  6391. @item x
  6392. @item y
  6393. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6394. @item width, w
  6395. @item height, h
  6396. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6397. input width and height, respectively, minus @code{thickness}, so image gets
  6398. framed. Default to 0.
  6399. @item color, c
  6400. Specify the color of the grid. For the general syntax of this option,
  6401. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6402. value @code{invert} is used, the grid color is the same as the
  6403. video with inverted luma.
  6404. @item thickness, t
  6405. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6406. See below for the list of accepted constants.
  6407. @item replace
  6408. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6409. will overwrite the video's color and alpha pixels.
  6410. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6411. @end table
  6412. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6413. following constants:
  6414. @table @option
  6415. @item dar
  6416. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6417. @item hsub
  6418. @item vsub
  6419. horizontal and vertical chroma subsample values. For example for the
  6420. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6421. @item in_h, ih
  6422. @item in_w, iw
  6423. The input grid cell width and height.
  6424. @item sar
  6425. The input sample aspect ratio.
  6426. @item x
  6427. @item y
  6428. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6429. @item w
  6430. @item h
  6431. The width and height of the drawn cell.
  6432. @item t
  6433. The thickness of the drawn cell.
  6434. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6435. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6436. @end table
  6437. @subsection Examples
  6438. @itemize
  6439. @item
  6440. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6441. @example
  6442. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6443. @end example
  6444. @item
  6445. Draw a white 3x3 grid with an opacity of 50%:
  6446. @example
  6447. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6448. @end example
  6449. @end itemize
  6450. @anchor{drawtext}
  6451. @section drawtext
  6452. Draw a text string or text from a specified file on top of a video, using the
  6453. libfreetype library.
  6454. To enable compilation of this filter, you need to configure FFmpeg with
  6455. @code{--enable-libfreetype}.
  6456. To enable default font fallback and the @var{font} option you need to
  6457. configure FFmpeg with @code{--enable-libfontconfig}.
  6458. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6459. @code{--enable-libfribidi}.
  6460. @subsection Syntax
  6461. It accepts the following parameters:
  6462. @table @option
  6463. @item box
  6464. Used to draw a box around text using the background color.
  6465. The value must be either 1 (enable) or 0 (disable).
  6466. The default value of @var{box} is 0.
  6467. @item boxborderw
  6468. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6469. The default value of @var{boxborderw} is 0.
  6470. @item boxcolor
  6471. The color to be used for drawing box around text. For the syntax of this
  6472. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6473. The default value of @var{boxcolor} is "white".
  6474. @item line_spacing
  6475. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6476. The default value of @var{line_spacing} is 0.
  6477. @item borderw
  6478. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6479. The default value of @var{borderw} is 0.
  6480. @item bordercolor
  6481. Set the color to be used for drawing border around text. For the syntax of this
  6482. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6483. The default value of @var{bordercolor} is "black".
  6484. @item expansion
  6485. Select how the @var{text} is expanded. Can be either @code{none},
  6486. @code{strftime} (deprecated) or
  6487. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6488. below for details.
  6489. @item basetime
  6490. Set a start time for the count. Value is in microseconds. Only applied
  6491. in the deprecated strftime expansion mode. To emulate in normal expansion
  6492. mode use the @code{pts} function, supplying the start time (in seconds)
  6493. as the second argument.
  6494. @item fix_bounds
  6495. If true, check and fix text coords to avoid clipping.
  6496. @item fontcolor
  6497. The color to be used for drawing fonts. For the syntax of this option, check
  6498. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6499. The default value of @var{fontcolor} is "black".
  6500. @item fontcolor_expr
  6501. String which is expanded the same way as @var{text} to obtain dynamic
  6502. @var{fontcolor} value. By default this option has empty value and is not
  6503. processed. When this option is set, it overrides @var{fontcolor} option.
  6504. @item font
  6505. The font family to be used for drawing text. By default Sans.
  6506. @item fontfile
  6507. The font file to be used for drawing text. The path must be included.
  6508. This parameter is mandatory if the fontconfig support is disabled.
  6509. @item alpha
  6510. Draw the text applying alpha blending. The value can
  6511. be a number between 0.0 and 1.0.
  6512. The expression accepts the same variables @var{x, y} as well.
  6513. The default value is 1.
  6514. Please see @var{fontcolor_expr}.
  6515. @item fontsize
  6516. The font size to be used for drawing text.
  6517. The default value of @var{fontsize} is 16.
  6518. @item text_shaping
  6519. If set to 1, attempt to shape the text (for example, reverse the order of
  6520. right-to-left text and join Arabic characters) before drawing it.
  6521. Otherwise, just draw the text exactly as given.
  6522. By default 1 (if supported).
  6523. @item ft_load_flags
  6524. The flags to be used for loading the fonts.
  6525. The flags map the corresponding flags supported by libfreetype, and are
  6526. a combination of the following values:
  6527. @table @var
  6528. @item default
  6529. @item no_scale
  6530. @item no_hinting
  6531. @item render
  6532. @item no_bitmap
  6533. @item vertical_layout
  6534. @item force_autohint
  6535. @item crop_bitmap
  6536. @item pedantic
  6537. @item ignore_global_advance_width
  6538. @item no_recurse
  6539. @item ignore_transform
  6540. @item monochrome
  6541. @item linear_design
  6542. @item no_autohint
  6543. @end table
  6544. Default value is "default".
  6545. For more information consult the documentation for the FT_LOAD_*
  6546. libfreetype flags.
  6547. @item shadowcolor
  6548. The color to be used for drawing a shadow behind the drawn text. For the
  6549. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6550. ffmpeg-utils manual,ffmpeg-utils}.
  6551. The default value of @var{shadowcolor} is "black".
  6552. @item shadowx
  6553. @item shadowy
  6554. The x and y offsets for the text shadow position with respect to the
  6555. position of the text. They can be either positive or negative
  6556. values. The default value for both is "0".
  6557. @item start_number
  6558. The starting frame number for the n/frame_num variable. The default value
  6559. is "0".
  6560. @item tabsize
  6561. The size in number of spaces to use for rendering the tab.
  6562. Default value is 4.
  6563. @item timecode
  6564. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6565. format. It can be used with or without text parameter. @var{timecode_rate}
  6566. option must be specified.
  6567. @item timecode_rate, rate, r
  6568. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6569. integer. Minimum value is "1".
  6570. Drop-frame timecode is supported for frame rates 30 & 60.
  6571. @item tc24hmax
  6572. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6573. Default is 0 (disabled).
  6574. @item text
  6575. The text string to be drawn. The text must be a sequence of UTF-8
  6576. encoded characters.
  6577. This parameter is mandatory if no file is specified with the parameter
  6578. @var{textfile}.
  6579. @item textfile
  6580. A text file containing text to be drawn. The text must be a sequence
  6581. of UTF-8 encoded characters.
  6582. This parameter is mandatory if no text string is specified with the
  6583. parameter @var{text}.
  6584. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6585. @item reload
  6586. If set to 1, the @var{textfile} will be reloaded before each frame.
  6587. Be sure to update it atomically, or it may be read partially, or even fail.
  6588. @item x
  6589. @item y
  6590. The expressions which specify the offsets where text will be drawn
  6591. within the video frame. They are relative to the top/left border of the
  6592. output image.
  6593. The default value of @var{x} and @var{y} is "0".
  6594. See below for the list of accepted constants and functions.
  6595. @end table
  6596. The parameters for @var{x} and @var{y} are expressions containing the
  6597. following constants and functions:
  6598. @table @option
  6599. @item dar
  6600. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6601. @item hsub
  6602. @item vsub
  6603. horizontal and vertical chroma subsample values. For example for the
  6604. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6605. @item line_h, lh
  6606. the height of each text line
  6607. @item main_h, h, H
  6608. the input height
  6609. @item main_w, w, W
  6610. the input width
  6611. @item max_glyph_a, ascent
  6612. the maximum distance from the baseline to the highest/upper grid
  6613. coordinate used to place a glyph outline point, for all the rendered
  6614. glyphs.
  6615. It is a positive value, due to the grid's orientation with the Y axis
  6616. upwards.
  6617. @item max_glyph_d, descent
  6618. the maximum distance from the baseline to the lowest grid coordinate
  6619. used to place a glyph outline point, for all the rendered glyphs.
  6620. This is a negative value, due to the grid's orientation, with the Y axis
  6621. upwards.
  6622. @item max_glyph_h
  6623. maximum glyph height, that is the maximum height for all the glyphs
  6624. contained in the rendered text, it is equivalent to @var{ascent} -
  6625. @var{descent}.
  6626. @item max_glyph_w
  6627. maximum glyph width, that is the maximum width for all the glyphs
  6628. contained in the rendered text
  6629. @item n
  6630. the number of input frame, starting from 0
  6631. @item rand(min, max)
  6632. return a random number included between @var{min} and @var{max}
  6633. @item sar
  6634. The input sample aspect ratio.
  6635. @item t
  6636. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6637. @item text_h, th
  6638. the height of the rendered text
  6639. @item text_w, tw
  6640. the width of the rendered text
  6641. @item x
  6642. @item y
  6643. the x and y offset coordinates where the text is drawn.
  6644. These parameters allow the @var{x} and @var{y} expressions to refer
  6645. each other, so you can for example specify @code{y=x/dar}.
  6646. @end table
  6647. @anchor{drawtext_expansion}
  6648. @subsection Text expansion
  6649. If @option{expansion} is set to @code{strftime},
  6650. the filter recognizes strftime() sequences in the provided text and
  6651. expands them accordingly. Check the documentation of strftime(). This
  6652. feature is deprecated.
  6653. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6654. If @option{expansion} is set to @code{normal} (which is the default),
  6655. the following expansion mechanism is used.
  6656. The backslash character @samp{\}, followed by any character, always expands to
  6657. the second character.
  6658. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6659. braces is a function name, possibly followed by arguments separated by ':'.
  6660. If the arguments contain special characters or delimiters (':' or '@}'),
  6661. they should be escaped.
  6662. Note that they probably must also be escaped as the value for the
  6663. @option{text} option in the filter argument string and as the filter
  6664. argument in the filtergraph description, and possibly also for the shell,
  6665. that makes up to four levels of escaping; using a text file avoids these
  6666. problems.
  6667. The following functions are available:
  6668. @table @command
  6669. @item expr, e
  6670. The expression evaluation result.
  6671. It must take one argument specifying the expression to be evaluated,
  6672. which accepts the same constants and functions as the @var{x} and
  6673. @var{y} values. Note that not all constants should be used, for
  6674. example the text size is not known when evaluating the expression, so
  6675. the constants @var{text_w} and @var{text_h} will have an undefined
  6676. value.
  6677. @item expr_int_format, eif
  6678. Evaluate the expression's value and output as formatted integer.
  6679. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6680. The second argument specifies the output format. Allowed values are @samp{x},
  6681. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6682. @code{printf} function.
  6683. The third parameter is optional and sets the number of positions taken by the output.
  6684. It can be used to add padding with zeros from the left.
  6685. @item gmtime
  6686. The time at which the filter is running, expressed in UTC.
  6687. It can accept an argument: a strftime() format string.
  6688. @item localtime
  6689. The time at which the filter is running, expressed in the local time zone.
  6690. It can accept an argument: a strftime() format string.
  6691. @item metadata
  6692. Frame metadata. Takes one or two arguments.
  6693. The first argument is mandatory and specifies the metadata key.
  6694. The second argument is optional and specifies a default value, used when the
  6695. metadata key is not found or empty.
  6696. @item n, frame_num
  6697. The frame number, starting from 0.
  6698. @item pict_type
  6699. A 1 character description of the current picture type.
  6700. @item pts
  6701. The timestamp of the current frame.
  6702. It can take up to three arguments.
  6703. The first argument is the format of the timestamp; it defaults to @code{flt}
  6704. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6705. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6706. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6707. @code{localtime} stands for the timestamp of the frame formatted as
  6708. local time zone time.
  6709. The second argument is an offset added to the timestamp.
  6710. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6711. supplied to present the hour part of the formatted timestamp in 24h format
  6712. (00-23).
  6713. If the format is set to @code{localtime} or @code{gmtime},
  6714. a third argument may be supplied: a strftime() format string.
  6715. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6716. @end table
  6717. @subsection Examples
  6718. @itemize
  6719. @item
  6720. Draw "Test Text" with font FreeSerif, using the default values for the
  6721. optional parameters.
  6722. @example
  6723. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6724. @end example
  6725. @item
  6726. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6727. and y=50 (counting from the top-left corner of the screen), text is
  6728. yellow with a red box around it. Both the text and the box have an
  6729. opacity of 20%.
  6730. @example
  6731. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6732. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6733. @end example
  6734. Note that the double quotes are not necessary if spaces are not used
  6735. within the parameter list.
  6736. @item
  6737. Show the text at the center of the video frame:
  6738. @example
  6739. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6740. @end example
  6741. @item
  6742. Show the text at a random position, switching to a new position every 30 seconds:
  6743. @example
  6744. 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)"
  6745. @end example
  6746. @item
  6747. Show a text line sliding from right to left in the last row of the video
  6748. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6749. with no newlines.
  6750. @example
  6751. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6752. @end example
  6753. @item
  6754. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6755. @example
  6756. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6757. @end example
  6758. @item
  6759. Draw a single green letter "g", at the center of the input video.
  6760. The glyph baseline is placed at half screen height.
  6761. @example
  6762. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6763. @end example
  6764. @item
  6765. Show text for 1 second every 3 seconds:
  6766. @example
  6767. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6768. @end example
  6769. @item
  6770. Use fontconfig to set the font. Note that the colons need to be escaped.
  6771. @example
  6772. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6773. @end example
  6774. @item
  6775. Print the date of a real-time encoding (see strftime(3)):
  6776. @example
  6777. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6778. @end example
  6779. @item
  6780. Show text fading in and out (appearing/disappearing):
  6781. @example
  6782. #!/bin/sh
  6783. DS=1.0 # display start
  6784. DE=10.0 # display end
  6785. FID=1.5 # fade in duration
  6786. FOD=5 # fade out duration
  6787. 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 @}"
  6788. @end example
  6789. @item
  6790. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6791. and the @option{fontsize} value are included in the @option{y} offset.
  6792. @example
  6793. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6794. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6795. @end example
  6796. @end itemize
  6797. For more information about libfreetype, check:
  6798. @url{http://www.freetype.org/}.
  6799. For more information about fontconfig, check:
  6800. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6801. For more information about libfribidi, check:
  6802. @url{http://fribidi.org/}.
  6803. @section edgedetect
  6804. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6805. The filter accepts the following options:
  6806. @table @option
  6807. @item low
  6808. @item high
  6809. Set low and high threshold values used by the Canny thresholding
  6810. algorithm.
  6811. The high threshold selects the "strong" edge pixels, which are then
  6812. connected through 8-connectivity with the "weak" edge pixels selected
  6813. by the low threshold.
  6814. @var{low} and @var{high} threshold values must be chosen in the range
  6815. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6816. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6817. is @code{50/255}.
  6818. @item mode
  6819. Define the drawing mode.
  6820. @table @samp
  6821. @item wires
  6822. Draw white/gray wires on black background.
  6823. @item colormix
  6824. Mix the colors to create a paint/cartoon effect.
  6825. @item canny
  6826. Apply Canny edge detector on all selected planes.
  6827. @end table
  6828. Default value is @var{wires}.
  6829. @item planes
  6830. Select planes for filtering. By default all available planes are filtered.
  6831. @end table
  6832. @subsection Examples
  6833. @itemize
  6834. @item
  6835. Standard edge detection with custom values for the hysteresis thresholding:
  6836. @example
  6837. edgedetect=low=0.1:high=0.4
  6838. @end example
  6839. @item
  6840. Painting effect without thresholding:
  6841. @example
  6842. edgedetect=mode=colormix:high=0
  6843. @end example
  6844. @end itemize
  6845. @section eq
  6846. Set brightness, contrast, saturation and approximate gamma adjustment.
  6847. The filter accepts the following options:
  6848. @table @option
  6849. @item contrast
  6850. Set the contrast expression. The value must be a float value in range
  6851. @code{-2.0} to @code{2.0}. The default value is "1".
  6852. @item brightness
  6853. Set the brightness expression. The value must be a float value in
  6854. range @code{-1.0} to @code{1.0}. The default value is "0".
  6855. @item saturation
  6856. Set the saturation expression. The value must be a float in
  6857. range @code{0.0} to @code{3.0}. The default value is "1".
  6858. @item gamma
  6859. Set the gamma expression. The value must be a float in range
  6860. @code{0.1} to @code{10.0}. The default value is "1".
  6861. @item gamma_r
  6862. Set the gamma expression for red. The value must be a float in
  6863. range @code{0.1} to @code{10.0}. The default value is "1".
  6864. @item gamma_g
  6865. Set the gamma expression for green. The value must be a float in range
  6866. @code{0.1} to @code{10.0}. The default value is "1".
  6867. @item gamma_b
  6868. Set the gamma expression for blue. The value must be a float in range
  6869. @code{0.1} to @code{10.0}. The default value is "1".
  6870. @item gamma_weight
  6871. Set the gamma weight expression. It can be used to reduce the effect
  6872. of a high gamma value on bright image areas, e.g. keep them from
  6873. getting overamplified and just plain white. The value must be a float
  6874. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6875. gamma correction all the way down while @code{1.0} leaves it at its
  6876. full strength. Default is "1".
  6877. @item eval
  6878. Set when the expressions for brightness, contrast, saturation and
  6879. gamma expressions are evaluated.
  6880. It accepts the following values:
  6881. @table @samp
  6882. @item init
  6883. only evaluate expressions once during the filter initialization or
  6884. when a command is processed
  6885. @item frame
  6886. evaluate expressions for each incoming frame
  6887. @end table
  6888. Default value is @samp{init}.
  6889. @end table
  6890. The expressions accept the following parameters:
  6891. @table @option
  6892. @item n
  6893. frame count of the input frame starting from 0
  6894. @item pos
  6895. byte position of the corresponding packet in the input file, NAN if
  6896. unspecified
  6897. @item r
  6898. frame rate of the input video, NAN if the input frame rate is unknown
  6899. @item t
  6900. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6901. @end table
  6902. @subsection Commands
  6903. The filter supports the following commands:
  6904. @table @option
  6905. @item contrast
  6906. Set the contrast expression.
  6907. @item brightness
  6908. Set the brightness expression.
  6909. @item saturation
  6910. Set the saturation expression.
  6911. @item gamma
  6912. Set the gamma expression.
  6913. @item gamma_r
  6914. Set the gamma_r expression.
  6915. @item gamma_g
  6916. Set gamma_g expression.
  6917. @item gamma_b
  6918. Set gamma_b expression.
  6919. @item gamma_weight
  6920. Set gamma_weight expression.
  6921. The command accepts the same syntax of the corresponding option.
  6922. If the specified expression is not valid, it is kept at its current
  6923. value.
  6924. @end table
  6925. @section erosion
  6926. Apply erosion effect to the video.
  6927. This filter replaces the pixel by the local(3x3) minimum.
  6928. It accepts the following options:
  6929. @table @option
  6930. @item threshold0
  6931. @item threshold1
  6932. @item threshold2
  6933. @item threshold3
  6934. Limit the maximum change for each plane, default is 65535.
  6935. If 0, plane will remain unchanged.
  6936. @item coordinates
  6937. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6938. pixels are used.
  6939. Flags to local 3x3 coordinates maps like this:
  6940. 1 2 3
  6941. 4 5
  6942. 6 7 8
  6943. @end table
  6944. @section extractplanes
  6945. Extract color channel components from input video stream into
  6946. separate grayscale video streams.
  6947. The filter accepts the following option:
  6948. @table @option
  6949. @item planes
  6950. Set plane(s) to extract.
  6951. Available values for planes are:
  6952. @table @samp
  6953. @item y
  6954. @item u
  6955. @item v
  6956. @item a
  6957. @item r
  6958. @item g
  6959. @item b
  6960. @end table
  6961. Choosing planes not available in the input will result in an error.
  6962. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6963. with @code{y}, @code{u}, @code{v} planes at same time.
  6964. @end table
  6965. @subsection Examples
  6966. @itemize
  6967. @item
  6968. Extract luma, u and v color channel component from input video frame
  6969. into 3 grayscale outputs:
  6970. @example
  6971. 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
  6972. @end example
  6973. @end itemize
  6974. @section elbg
  6975. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6976. For each input image, the filter will compute the optimal mapping from
  6977. the input to the output given the codebook length, that is the number
  6978. of distinct output colors.
  6979. This filter accepts the following options.
  6980. @table @option
  6981. @item codebook_length, l
  6982. Set codebook length. The value must be a positive integer, and
  6983. represents the number of distinct output colors. Default value is 256.
  6984. @item nb_steps, n
  6985. Set the maximum number of iterations to apply for computing the optimal
  6986. mapping. The higher the value the better the result and the higher the
  6987. computation time. Default value is 1.
  6988. @item seed, s
  6989. Set a random seed, must be an integer included between 0 and
  6990. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6991. will try to use a good random seed on a best effort basis.
  6992. @item pal8
  6993. Set pal8 output pixel format. This option does not work with codebook
  6994. length greater than 256.
  6995. @end table
  6996. @section entropy
  6997. Measure graylevel entropy in histogram of color channels of video frames.
  6998. It accepts the following parameters:
  6999. @table @option
  7000. @item mode
  7001. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7002. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7003. between neighbour histogram values.
  7004. @end table
  7005. @section fade
  7006. Apply a fade-in/out effect to the input video.
  7007. It accepts the following parameters:
  7008. @table @option
  7009. @item type, t
  7010. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7011. effect.
  7012. Default is @code{in}.
  7013. @item start_frame, s
  7014. Specify the number of the frame to start applying the fade
  7015. effect at. Default is 0.
  7016. @item nb_frames, n
  7017. The number of frames that the fade effect lasts. At the end of the
  7018. fade-in effect, the output video will have the same intensity as the input video.
  7019. At the end of the fade-out transition, the output video will be filled with the
  7020. selected @option{color}.
  7021. Default is 25.
  7022. @item alpha
  7023. If set to 1, fade only alpha channel, if one exists on the input.
  7024. Default value is 0.
  7025. @item start_time, st
  7026. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7027. effect. If both start_frame and start_time are specified, the fade will start at
  7028. whichever comes last. Default is 0.
  7029. @item duration, d
  7030. The number of seconds for which the fade effect has to last. At the end of the
  7031. fade-in effect the output video will have the same intensity as the input video,
  7032. at the end of the fade-out transition the output video will be filled with the
  7033. selected @option{color}.
  7034. If both duration and nb_frames are specified, duration is used. Default is 0
  7035. (nb_frames is used by default).
  7036. @item color, c
  7037. Specify the color of the fade. Default is "black".
  7038. @end table
  7039. @subsection Examples
  7040. @itemize
  7041. @item
  7042. Fade in the first 30 frames of video:
  7043. @example
  7044. fade=in:0:30
  7045. @end example
  7046. The command above is equivalent to:
  7047. @example
  7048. fade=t=in:s=0:n=30
  7049. @end example
  7050. @item
  7051. Fade out the last 45 frames of a 200-frame video:
  7052. @example
  7053. fade=out:155:45
  7054. fade=type=out:start_frame=155:nb_frames=45
  7055. @end example
  7056. @item
  7057. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7058. @example
  7059. fade=in:0:25, fade=out:975:25
  7060. @end example
  7061. @item
  7062. Make the first 5 frames yellow, then fade in from frame 5-24:
  7063. @example
  7064. fade=in:5:20:color=yellow
  7065. @end example
  7066. @item
  7067. Fade in alpha over first 25 frames of video:
  7068. @example
  7069. fade=in:0:25:alpha=1
  7070. @end example
  7071. @item
  7072. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7073. @example
  7074. fade=t=in:st=5.5:d=0.5
  7075. @end example
  7076. @end itemize
  7077. @section fftfilt
  7078. Apply arbitrary expressions to samples in frequency domain
  7079. @table @option
  7080. @item dc_Y
  7081. Adjust the dc value (gain) of the luma plane of the image. The filter
  7082. accepts an integer value in range @code{0} to @code{1000}. The default
  7083. value is set to @code{0}.
  7084. @item dc_U
  7085. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7086. filter accepts an integer value in range @code{0} to @code{1000}. The
  7087. default value is set to @code{0}.
  7088. @item dc_V
  7089. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7090. filter accepts an integer value in range @code{0} to @code{1000}. The
  7091. default value is set to @code{0}.
  7092. @item weight_Y
  7093. Set the frequency domain weight expression for the luma plane.
  7094. @item weight_U
  7095. Set the frequency domain weight expression for the 1st chroma plane.
  7096. @item weight_V
  7097. Set the frequency domain weight expression for the 2nd chroma plane.
  7098. @item eval
  7099. Set when the expressions are evaluated.
  7100. It accepts the following values:
  7101. @table @samp
  7102. @item init
  7103. Only evaluate expressions once during the filter initialization.
  7104. @item frame
  7105. Evaluate expressions for each incoming frame.
  7106. @end table
  7107. Default value is @samp{init}.
  7108. The filter accepts the following variables:
  7109. @item X
  7110. @item Y
  7111. The coordinates of the current sample.
  7112. @item W
  7113. @item H
  7114. The width and height of the image.
  7115. @item N
  7116. The number of input frame, starting from 0.
  7117. @end table
  7118. @subsection Examples
  7119. @itemize
  7120. @item
  7121. High-pass:
  7122. @example
  7123. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7124. @end example
  7125. @item
  7126. Low-pass:
  7127. @example
  7128. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7129. @end example
  7130. @item
  7131. Sharpen:
  7132. @example
  7133. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7134. @end example
  7135. @item
  7136. Blur:
  7137. @example
  7138. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7139. @end example
  7140. @end itemize
  7141. @section fftdnoiz
  7142. Denoise frames using 3D FFT (frequency domain filtering).
  7143. The filter accepts the following options:
  7144. @table @option
  7145. @item sigma
  7146. Set the noise sigma constant. This sets denoising strength.
  7147. Default value is 1. Allowed range is from 0 to 30.
  7148. Using very high sigma with low overlap may give blocking artifacts.
  7149. @item amount
  7150. Set amount of denoising. By default all detected noise is reduced.
  7151. Default value is 1. Allowed range is from 0 to 1.
  7152. @item block
  7153. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7154. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7155. block size in pixels is 2^4 which is 16.
  7156. @item overlap
  7157. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7158. @item prev
  7159. Set number of previous frames to use for denoising. By default is set to 0.
  7160. @item next
  7161. Set number of next frames to to use for denoising. By default is set to 0.
  7162. @item planes
  7163. Set planes which will be filtered, by default are all available filtered
  7164. except alpha.
  7165. @end table
  7166. @section field
  7167. Extract a single field from an interlaced image using stride
  7168. arithmetic to avoid wasting CPU time. The output frames are marked as
  7169. non-interlaced.
  7170. The filter accepts the following options:
  7171. @table @option
  7172. @item type
  7173. Specify whether to extract the top (if the value is @code{0} or
  7174. @code{top}) or the bottom field (if the value is @code{1} or
  7175. @code{bottom}).
  7176. @end table
  7177. @section fieldhint
  7178. Create new frames by copying the top and bottom fields from surrounding frames
  7179. supplied as numbers by the hint file.
  7180. @table @option
  7181. @item hint
  7182. Set file containing hints: absolute/relative frame numbers.
  7183. There must be one line for each frame in a clip. Each line must contain two
  7184. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7185. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7186. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7187. for @code{relative} mode. First number tells from which frame to pick up top
  7188. field and second number tells from which frame to pick up bottom field.
  7189. If optionally followed by @code{+} output frame will be marked as interlaced,
  7190. else if followed by @code{-} output frame will be marked as progressive, else
  7191. it will be marked same as input frame.
  7192. If line starts with @code{#} or @code{;} that line is skipped.
  7193. @item mode
  7194. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7195. @end table
  7196. Example of first several lines of @code{hint} file for @code{relative} mode:
  7197. @example
  7198. 0,0 - # first frame
  7199. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7200. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7201. 1,0 -
  7202. 0,0 -
  7203. 0,0 -
  7204. 1,0 -
  7205. 1,0 -
  7206. 1,0 -
  7207. 0,0 -
  7208. 0,0 -
  7209. 1,0 -
  7210. 1,0 -
  7211. 1,0 -
  7212. 0,0 -
  7213. @end example
  7214. @section fieldmatch
  7215. Field matching filter for inverse telecine. It is meant to reconstruct the
  7216. progressive frames from a telecined stream. The filter does not drop duplicated
  7217. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7218. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7219. The separation of the field matching and the decimation is notably motivated by
  7220. the possibility of inserting a de-interlacing filter fallback between the two.
  7221. If the source has mixed telecined and real interlaced content,
  7222. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7223. But these remaining combed frames will be marked as interlaced, and thus can be
  7224. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7225. In addition to the various configuration options, @code{fieldmatch} can take an
  7226. optional second stream, activated through the @option{ppsrc} option. If
  7227. enabled, the frames reconstruction will be based on the fields and frames from
  7228. this second stream. This allows the first input to be pre-processed in order to
  7229. help the various algorithms of the filter, while keeping the output lossless
  7230. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7231. or brightness/contrast adjustments can help.
  7232. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7233. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7234. which @code{fieldmatch} is based on. While the semantic and usage are very
  7235. close, some behaviour and options names can differ.
  7236. The @ref{decimate} filter currently only works for constant frame rate input.
  7237. If your input has mixed telecined (30fps) and progressive content with a lower
  7238. framerate like 24fps use the following filterchain to produce the necessary cfr
  7239. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7240. The filter accepts the following options:
  7241. @table @option
  7242. @item order
  7243. Specify the assumed field order of the input stream. Available values are:
  7244. @table @samp
  7245. @item auto
  7246. Auto detect parity (use FFmpeg's internal parity value).
  7247. @item bff
  7248. Assume bottom field first.
  7249. @item tff
  7250. Assume top field first.
  7251. @end table
  7252. Note that it is sometimes recommended not to trust the parity announced by the
  7253. stream.
  7254. Default value is @var{auto}.
  7255. @item mode
  7256. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7257. sense that it won't risk creating jerkiness due to duplicate frames when
  7258. possible, but if there are bad edits or blended fields it will end up
  7259. outputting combed frames when a good match might actually exist. On the other
  7260. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7261. but will almost always find a good frame if there is one. The other values are
  7262. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7263. jerkiness and creating duplicate frames versus finding good matches in sections
  7264. with bad edits, orphaned fields, blended fields, etc.
  7265. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7266. Available values are:
  7267. @table @samp
  7268. @item pc
  7269. 2-way matching (p/c)
  7270. @item pc_n
  7271. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7272. @item pc_u
  7273. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7274. @item pc_n_ub
  7275. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7276. still combed (p/c + n + u/b)
  7277. @item pcn
  7278. 3-way matching (p/c/n)
  7279. @item pcn_ub
  7280. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7281. detected as combed (p/c/n + u/b)
  7282. @end table
  7283. The parenthesis at the end indicate the matches that would be used for that
  7284. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7285. @var{top}).
  7286. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7287. the slowest.
  7288. Default value is @var{pc_n}.
  7289. @item ppsrc
  7290. Mark the main input stream as a pre-processed input, and enable the secondary
  7291. input stream as the clean source to pick the fields from. See the filter
  7292. introduction for more details. It is similar to the @option{clip2} feature from
  7293. VFM/TFM.
  7294. Default value is @code{0} (disabled).
  7295. @item field
  7296. Set the field to match from. It is recommended to set this to the same value as
  7297. @option{order} unless you experience matching failures with that setting. In
  7298. certain circumstances changing the field that is used to match from can have a
  7299. large impact on matching performance. Available values are:
  7300. @table @samp
  7301. @item auto
  7302. Automatic (same value as @option{order}).
  7303. @item bottom
  7304. Match from the bottom field.
  7305. @item top
  7306. Match from the top field.
  7307. @end table
  7308. Default value is @var{auto}.
  7309. @item mchroma
  7310. Set whether or not chroma is included during the match comparisons. In most
  7311. cases it is recommended to leave this enabled. You should set this to @code{0}
  7312. only if your clip has bad chroma problems such as heavy rainbowing or other
  7313. artifacts. Setting this to @code{0} could also be used to speed things up at
  7314. the cost of some accuracy.
  7315. Default value is @code{1}.
  7316. @item y0
  7317. @item y1
  7318. These define an exclusion band which excludes the lines between @option{y0} and
  7319. @option{y1} from being included in the field matching decision. An exclusion
  7320. band can be used to ignore subtitles, a logo, or other things that may
  7321. interfere with the matching. @option{y0} sets the starting scan line and
  7322. @option{y1} sets the ending line; all lines in between @option{y0} and
  7323. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7324. @option{y0} and @option{y1} to the same value will disable the feature.
  7325. @option{y0} and @option{y1} defaults to @code{0}.
  7326. @item scthresh
  7327. Set the scene change detection threshold as a percentage of maximum change on
  7328. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7329. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7330. @option{scthresh} is @code{[0.0, 100.0]}.
  7331. Default value is @code{12.0}.
  7332. @item combmatch
  7333. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7334. account the combed scores of matches when deciding what match to use as the
  7335. final match. Available values are:
  7336. @table @samp
  7337. @item none
  7338. No final matching based on combed scores.
  7339. @item sc
  7340. Combed scores are only used when a scene change is detected.
  7341. @item full
  7342. Use combed scores all the time.
  7343. @end table
  7344. Default is @var{sc}.
  7345. @item combdbg
  7346. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7347. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7348. Available values are:
  7349. @table @samp
  7350. @item none
  7351. No forced calculation.
  7352. @item pcn
  7353. Force p/c/n calculations.
  7354. @item pcnub
  7355. Force p/c/n/u/b calculations.
  7356. @end table
  7357. Default value is @var{none}.
  7358. @item cthresh
  7359. This is the area combing threshold used for combed frame detection. This
  7360. essentially controls how "strong" or "visible" combing must be to be detected.
  7361. Larger values mean combing must be more visible and smaller values mean combing
  7362. can be less visible or strong and still be detected. Valid settings are from
  7363. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7364. be detected as combed). This is basically a pixel difference value. A good
  7365. range is @code{[8, 12]}.
  7366. Default value is @code{9}.
  7367. @item chroma
  7368. Sets whether or not chroma is considered in the combed frame decision. Only
  7369. disable this if your source has chroma problems (rainbowing, etc.) that are
  7370. causing problems for the combed frame detection with chroma enabled. Actually,
  7371. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7372. where there is chroma only combing in the source.
  7373. Default value is @code{0}.
  7374. @item blockx
  7375. @item blocky
  7376. Respectively set the x-axis and y-axis size of the window used during combed
  7377. frame detection. This has to do with the size of the area in which
  7378. @option{combpel} pixels are required to be detected as combed for a frame to be
  7379. declared combed. See the @option{combpel} parameter description for more info.
  7380. Possible values are any number that is a power of 2 starting at 4 and going up
  7381. to 512.
  7382. Default value is @code{16}.
  7383. @item combpel
  7384. The number of combed pixels inside any of the @option{blocky} by
  7385. @option{blockx} size blocks on the frame for the frame to be detected as
  7386. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7387. setting controls "how much" combing there must be in any localized area (a
  7388. window defined by the @option{blockx} and @option{blocky} settings) on the
  7389. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7390. which point no frames will ever be detected as combed). This setting is known
  7391. as @option{MI} in TFM/VFM vocabulary.
  7392. Default value is @code{80}.
  7393. @end table
  7394. @anchor{p/c/n/u/b meaning}
  7395. @subsection p/c/n/u/b meaning
  7396. @subsubsection p/c/n
  7397. We assume the following telecined stream:
  7398. @example
  7399. Top fields: 1 2 2 3 4
  7400. Bottom fields: 1 2 3 4 4
  7401. @end example
  7402. The numbers correspond to the progressive frame the fields relate to. Here, the
  7403. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7404. When @code{fieldmatch} is configured to run a matching from bottom
  7405. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7406. @example
  7407. Input stream:
  7408. T 1 2 2 3 4
  7409. B 1 2 3 4 4 <-- matching reference
  7410. Matches: c c n n c
  7411. Output stream:
  7412. T 1 2 3 4 4
  7413. B 1 2 3 4 4
  7414. @end example
  7415. As a result of the field matching, we can see that some frames get duplicated.
  7416. To perform a complete inverse telecine, you need to rely on a decimation filter
  7417. after this operation. See for instance the @ref{decimate} filter.
  7418. The same operation now matching from top fields (@option{field}=@var{top})
  7419. looks like this:
  7420. @example
  7421. Input stream:
  7422. T 1 2 2 3 4 <-- matching reference
  7423. B 1 2 3 4 4
  7424. Matches: c c p p c
  7425. Output stream:
  7426. T 1 2 2 3 4
  7427. B 1 2 2 3 4
  7428. @end example
  7429. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7430. basically, they refer to the frame and field of the opposite parity:
  7431. @itemize
  7432. @item @var{p} matches the field of the opposite parity in the previous frame
  7433. @item @var{c} matches the field of the opposite parity in the current frame
  7434. @item @var{n} matches the field of the opposite parity in the next frame
  7435. @end itemize
  7436. @subsubsection u/b
  7437. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7438. from the opposite parity flag. In the following examples, we assume that we are
  7439. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7440. 'x' is placed above and below each matched fields.
  7441. With bottom matching (@option{field}=@var{bottom}):
  7442. @example
  7443. Match: c p n b u
  7444. x x x x x
  7445. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7446. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7447. x x x x x
  7448. Output frames:
  7449. 2 1 2 2 2
  7450. 2 2 2 1 3
  7451. @end example
  7452. With top matching (@option{field}=@var{top}):
  7453. @example
  7454. Match: c p n b u
  7455. x x x x x
  7456. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7457. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7458. x x x x x
  7459. Output frames:
  7460. 2 2 2 1 2
  7461. 2 1 3 2 2
  7462. @end example
  7463. @subsection Examples
  7464. Simple IVTC of a top field first telecined stream:
  7465. @example
  7466. fieldmatch=order=tff:combmatch=none, decimate
  7467. @end example
  7468. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7469. @example
  7470. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7471. @end example
  7472. @section fieldorder
  7473. Transform the field order of the input video.
  7474. It accepts the following parameters:
  7475. @table @option
  7476. @item order
  7477. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7478. for bottom field first.
  7479. @end table
  7480. The default value is @samp{tff}.
  7481. The transformation is done by shifting the picture content up or down
  7482. by one line, and filling the remaining line with appropriate picture content.
  7483. This method is consistent with most broadcast field order converters.
  7484. If the input video is not flagged as being interlaced, or it is already
  7485. flagged as being of the required output field order, then this filter does
  7486. not alter the incoming video.
  7487. It is very useful when converting to or from PAL DV material,
  7488. which is bottom field first.
  7489. For example:
  7490. @example
  7491. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7492. @end example
  7493. @section fifo, afifo
  7494. Buffer input images and send them when they are requested.
  7495. It is mainly useful when auto-inserted by the libavfilter
  7496. framework.
  7497. It does not take parameters.
  7498. @section fillborders
  7499. Fill borders of the input video, without changing video stream dimensions.
  7500. Sometimes video can have garbage at the four edges and you may not want to
  7501. crop video input to keep size multiple of some number.
  7502. This filter accepts the following options:
  7503. @table @option
  7504. @item left
  7505. Number of pixels to fill from left border.
  7506. @item right
  7507. Number of pixels to fill from right border.
  7508. @item top
  7509. Number of pixels to fill from top border.
  7510. @item bottom
  7511. Number of pixels to fill from bottom border.
  7512. @item mode
  7513. Set fill mode.
  7514. It accepts the following values:
  7515. @table @samp
  7516. @item smear
  7517. fill pixels using outermost pixels
  7518. @item mirror
  7519. fill pixels using mirroring
  7520. @item fixed
  7521. fill pixels with constant value
  7522. @end table
  7523. Default is @var{smear}.
  7524. @item color
  7525. Set color for pixels in fixed mode. Default is @var{black}.
  7526. @end table
  7527. @section find_rect
  7528. Find a rectangular object
  7529. It accepts the following options:
  7530. @table @option
  7531. @item object
  7532. Filepath of the object image, needs to be in gray8.
  7533. @item threshold
  7534. Detection threshold, default is 0.5.
  7535. @item mipmaps
  7536. Number of mipmaps, default is 3.
  7537. @item xmin, ymin, xmax, ymax
  7538. Specifies the rectangle in which to search.
  7539. @end table
  7540. @subsection Examples
  7541. @itemize
  7542. @item
  7543. Generate a representative palette of a given video using @command{ffmpeg}:
  7544. @example
  7545. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7546. @end example
  7547. @end itemize
  7548. @section cover_rect
  7549. Cover a rectangular object
  7550. It accepts the following options:
  7551. @table @option
  7552. @item cover
  7553. Filepath of the optional cover image, needs to be in yuv420.
  7554. @item mode
  7555. Set covering mode.
  7556. It accepts the following values:
  7557. @table @samp
  7558. @item cover
  7559. cover it by the supplied image
  7560. @item blur
  7561. cover it by interpolating the surrounding pixels
  7562. @end table
  7563. Default value is @var{blur}.
  7564. @end table
  7565. @subsection Examples
  7566. @itemize
  7567. @item
  7568. Generate a representative palette of a given video using @command{ffmpeg}:
  7569. @example
  7570. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7571. @end example
  7572. @end itemize
  7573. @section floodfill
  7574. Flood area with values of same pixel components with another values.
  7575. It accepts the following options:
  7576. @table @option
  7577. @item x
  7578. Set pixel x coordinate.
  7579. @item y
  7580. Set pixel y coordinate.
  7581. @item s0
  7582. Set source #0 component value.
  7583. @item s1
  7584. Set source #1 component value.
  7585. @item s2
  7586. Set source #2 component value.
  7587. @item s3
  7588. Set source #3 component value.
  7589. @item d0
  7590. Set destination #0 component value.
  7591. @item d1
  7592. Set destination #1 component value.
  7593. @item d2
  7594. Set destination #2 component value.
  7595. @item d3
  7596. Set destination #3 component value.
  7597. @end table
  7598. @anchor{format}
  7599. @section format
  7600. Convert the input video to one of the specified pixel formats.
  7601. Libavfilter will try to pick one that is suitable as input to
  7602. the next filter.
  7603. It accepts the following parameters:
  7604. @table @option
  7605. @item pix_fmts
  7606. A '|'-separated list of pixel format names, such as
  7607. "pix_fmts=yuv420p|monow|rgb24".
  7608. @end table
  7609. @subsection Examples
  7610. @itemize
  7611. @item
  7612. Convert the input video to the @var{yuv420p} format
  7613. @example
  7614. format=pix_fmts=yuv420p
  7615. @end example
  7616. Convert the input video to any of the formats in the list
  7617. @example
  7618. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7619. @end example
  7620. @end itemize
  7621. @anchor{fps}
  7622. @section fps
  7623. Convert the video to specified constant frame rate by duplicating or dropping
  7624. frames as necessary.
  7625. It accepts the following parameters:
  7626. @table @option
  7627. @item fps
  7628. The desired output frame rate. The default is @code{25}.
  7629. @item start_time
  7630. Assume the first PTS should be the given value, in seconds. This allows for
  7631. padding/trimming at the start of stream. By default, no assumption is made
  7632. about the first frame's expected PTS, so no padding or trimming is done.
  7633. For example, this could be set to 0 to pad the beginning with duplicates of
  7634. the first frame if a video stream starts after the audio stream or to trim any
  7635. frames with a negative PTS.
  7636. @item round
  7637. Timestamp (PTS) rounding method.
  7638. Possible values are:
  7639. @table @option
  7640. @item zero
  7641. round towards 0
  7642. @item inf
  7643. round away from 0
  7644. @item down
  7645. round towards -infinity
  7646. @item up
  7647. round towards +infinity
  7648. @item near
  7649. round to nearest
  7650. @end table
  7651. The default is @code{near}.
  7652. @item eof_action
  7653. Action performed when reading the last frame.
  7654. Possible values are:
  7655. @table @option
  7656. @item round
  7657. Use same timestamp rounding method as used for other frames.
  7658. @item pass
  7659. Pass through last frame if input duration has not been reached yet.
  7660. @end table
  7661. The default is @code{round}.
  7662. @end table
  7663. Alternatively, the options can be specified as a flat string:
  7664. @var{fps}[:@var{start_time}[:@var{round}]].
  7665. See also the @ref{setpts} filter.
  7666. @subsection Examples
  7667. @itemize
  7668. @item
  7669. A typical usage in order to set the fps to 25:
  7670. @example
  7671. fps=fps=25
  7672. @end example
  7673. @item
  7674. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7675. @example
  7676. fps=fps=film:round=near
  7677. @end example
  7678. @end itemize
  7679. @section framepack
  7680. Pack two different video streams into a stereoscopic video, setting proper
  7681. metadata on supported codecs. The two views should have the same size and
  7682. framerate and processing will stop when the shorter video ends. Please note
  7683. that you may conveniently adjust view properties with the @ref{scale} and
  7684. @ref{fps} filters.
  7685. It accepts the following parameters:
  7686. @table @option
  7687. @item format
  7688. The desired packing format. Supported values are:
  7689. @table @option
  7690. @item sbs
  7691. The views are next to each other (default).
  7692. @item tab
  7693. The views are on top of each other.
  7694. @item lines
  7695. The views are packed by line.
  7696. @item columns
  7697. The views are packed by column.
  7698. @item frameseq
  7699. The views are temporally interleaved.
  7700. @end table
  7701. @end table
  7702. Some examples:
  7703. @example
  7704. # Convert left and right views into a frame-sequential video
  7705. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7706. # Convert views into a side-by-side video with the same output resolution as the input
  7707. 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
  7708. @end example
  7709. @section framerate
  7710. Change the frame rate by interpolating new video output frames from the source
  7711. frames.
  7712. This filter is not designed to function correctly with interlaced media. If
  7713. you wish to change the frame rate of interlaced media then you are required
  7714. to deinterlace before this filter and re-interlace after this filter.
  7715. A description of the accepted options follows.
  7716. @table @option
  7717. @item fps
  7718. Specify the output frames per second. This option can also be specified
  7719. as a value alone. The default is @code{50}.
  7720. @item interp_start
  7721. Specify the start of a range where the output frame will be created as a
  7722. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7723. the default is @code{15}.
  7724. @item interp_end
  7725. Specify the end of a range where the output frame will be created as a
  7726. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7727. the default is @code{240}.
  7728. @item scene
  7729. Specify the level at which a scene change is detected as a value between
  7730. 0 and 100 to indicate a new scene; a low value reflects a low
  7731. probability for the current frame to introduce a new scene, while a higher
  7732. value means the current frame is more likely to be one.
  7733. The default is @code{8.2}.
  7734. @item flags
  7735. Specify flags influencing the filter process.
  7736. Available value for @var{flags} is:
  7737. @table @option
  7738. @item scene_change_detect, scd
  7739. Enable scene change detection using the value of the option @var{scene}.
  7740. This flag is enabled by default.
  7741. @end table
  7742. @end table
  7743. @section framestep
  7744. Select one frame every N-th frame.
  7745. This filter accepts the following option:
  7746. @table @option
  7747. @item step
  7748. Select frame after every @code{step} frames.
  7749. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7750. @end table
  7751. @section freezedetect
  7752. Detect frozen video.
  7753. This filter logs a message and sets frame metadata when it detects that the
  7754. input video has no significant change in content during a specified duration.
  7755. Video freeze detection calculates the mean average absolute difference of all
  7756. the components of video frames and compares it to a noise floor.
  7757. The printed times and duration are expressed in seconds. The
  7758. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  7759. whose timestamp equals or exceeds the detection duration and it contains the
  7760. timestamp of the first frame of the freeze. The
  7761. @code{lavfi.freezedetect.freeze_duration} and
  7762. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  7763. after the freeze.
  7764. The filter accepts the following options:
  7765. @table @option
  7766. @item noise, n
  7767. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  7768. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  7769. 0.001.
  7770. @item duration, d
  7771. Set freeze duration until notification (default is 2 seconds).
  7772. @end table
  7773. @anchor{frei0r}
  7774. @section frei0r
  7775. Apply a frei0r effect to the input video.
  7776. To enable the compilation of this filter, you need to install the frei0r
  7777. header and configure FFmpeg with @code{--enable-frei0r}.
  7778. It accepts the following parameters:
  7779. @table @option
  7780. @item filter_name
  7781. The name of the frei0r effect to load. If the environment variable
  7782. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7783. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7784. Otherwise, the standard frei0r paths are searched, in this order:
  7785. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7786. @file{/usr/lib/frei0r-1/}.
  7787. @item filter_params
  7788. A '|'-separated list of parameters to pass to the frei0r effect.
  7789. @end table
  7790. A frei0r effect parameter can be a boolean (its value is either
  7791. "y" or "n"), a double, a color (specified as
  7792. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7793. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7794. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7795. a position (specified as @var{X}/@var{Y}, where
  7796. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7797. The number and types of parameters depend on the loaded effect. If an
  7798. effect parameter is not specified, the default value is set.
  7799. @subsection Examples
  7800. @itemize
  7801. @item
  7802. Apply the distort0r effect, setting the first two double parameters:
  7803. @example
  7804. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7805. @end example
  7806. @item
  7807. Apply the colordistance effect, taking a color as the first parameter:
  7808. @example
  7809. frei0r=colordistance:0.2/0.3/0.4
  7810. frei0r=colordistance:violet
  7811. frei0r=colordistance:0x112233
  7812. @end example
  7813. @item
  7814. Apply the perspective effect, specifying the top left and top right image
  7815. positions:
  7816. @example
  7817. frei0r=perspective:0.2/0.2|0.8/0.2
  7818. @end example
  7819. @end itemize
  7820. For more information, see
  7821. @url{http://frei0r.dyne.org}
  7822. @section fspp
  7823. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7824. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7825. processing filter, one of them is performed once per block, not per pixel.
  7826. This allows for much higher speed.
  7827. The filter accepts the following options:
  7828. @table @option
  7829. @item quality
  7830. Set quality. This option defines the number of levels for averaging. It accepts
  7831. an integer in the range 4-5. Default value is @code{4}.
  7832. @item qp
  7833. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7834. If not set, the filter will use the QP from the video stream (if available).
  7835. @item strength
  7836. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7837. more details but also more artifacts, while higher values make the image smoother
  7838. but also blurrier. Default value is @code{0} − PSNR optimal.
  7839. @item use_bframe_qp
  7840. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7841. option may cause flicker since the B-Frames have often larger QP. Default is
  7842. @code{0} (not enabled).
  7843. @end table
  7844. @section gblur
  7845. Apply Gaussian blur filter.
  7846. The filter accepts the following options:
  7847. @table @option
  7848. @item sigma
  7849. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7850. @item steps
  7851. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7852. @item planes
  7853. Set which planes to filter. By default all planes are filtered.
  7854. @item sigmaV
  7855. Set vertical sigma, if negative it will be same as @code{sigma}.
  7856. Default is @code{-1}.
  7857. @end table
  7858. @section geq
  7859. Apply generic equation to each pixel.
  7860. The filter accepts the following options:
  7861. @table @option
  7862. @item lum_expr, lum
  7863. Set the luminance expression.
  7864. @item cb_expr, cb
  7865. Set the chrominance blue expression.
  7866. @item cr_expr, cr
  7867. Set the chrominance red expression.
  7868. @item alpha_expr, a
  7869. Set the alpha expression.
  7870. @item red_expr, r
  7871. Set the red expression.
  7872. @item green_expr, g
  7873. Set the green expression.
  7874. @item blue_expr, b
  7875. Set the blue expression.
  7876. @end table
  7877. The colorspace is selected according to the specified options. If one
  7878. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7879. options is specified, the filter will automatically select a YCbCr
  7880. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7881. @option{blue_expr} options is specified, it will select an RGB
  7882. colorspace.
  7883. If one of the chrominance expression is not defined, it falls back on the other
  7884. one. If no alpha expression is specified it will evaluate to opaque value.
  7885. If none of chrominance expressions are specified, they will evaluate
  7886. to the luminance expression.
  7887. The expressions can use the following variables and functions:
  7888. @table @option
  7889. @item N
  7890. The sequential number of the filtered frame, starting from @code{0}.
  7891. @item X
  7892. @item Y
  7893. The coordinates of the current sample.
  7894. @item W
  7895. @item H
  7896. The width and height of the image.
  7897. @item SW
  7898. @item SH
  7899. Width and height scale depending on the currently filtered plane. It is the
  7900. ratio between the corresponding luma plane number of pixels and the current
  7901. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7902. @code{0.5,0.5} for chroma planes.
  7903. @item T
  7904. Time of the current frame, expressed in seconds.
  7905. @item p(x, y)
  7906. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7907. plane.
  7908. @item lum(x, y)
  7909. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7910. plane.
  7911. @item cb(x, y)
  7912. Return the value of the pixel at location (@var{x},@var{y}) of the
  7913. blue-difference chroma plane. Return 0 if there is no such plane.
  7914. @item cr(x, y)
  7915. Return the value of the pixel at location (@var{x},@var{y}) of the
  7916. red-difference chroma plane. Return 0 if there is no such plane.
  7917. @item r(x, y)
  7918. @item g(x, y)
  7919. @item b(x, y)
  7920. Return the value of the pixel at location (@var{x},@var{y}) of the
  7921. red/green/blue component. Return 0 if there is no such component.
  7922. @item alpha(x, y)
  7923. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7924. plane. Return 0 if there is no such plane.
  7925. @end table
  7926. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7927. automatically clipped to the closer edge.
  7928. @subsection Examples
  7929. @itemize
  7930. @item
  7931. Flip the image horizontally:
  7932. @example
  7933. geq=p(W-X\,Y)
  7934. @end example
  7935. @item
  7936. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7937. wavelength of 100 pixels:
  7938. @example
  7939. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7940. @end example
  7941. @item
  7942. Generate a fancy enigmatic moving light:
  7943. @example
  7944. 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
  7945. @end example
  7946. @item
  7947. Generate a quick emboss effect:
  7948. @example
  7949. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7950. @end example
  7951. @item
  7952. Modify RGB components depending on pixel position:
  7953. @example
  7954. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7955. @end example
  7956. @item
  7957. Create a radial gradient that is the same size as the input (also see
  7958. the @ref{vignette} filter):
  7959. @example
  7960. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7961. @end example
  7962. @end itemize
  7963. @section gradfun
  7964. Fix the banding artifacts that are sometimes introduced into nearly flat
  7965. regions by truncation to 8-bit color depth.
  7966. Interpolate the gradients that should go where the bands are, and
  7967. dither them.
  7968. It is designed for playback only. Do not use it prior to
  7969. lossy compression, because compression tends to lose the dither and
  7970. bring back the bands.
  7971. It accepts the following parameters:
  7972. @table @option
  7973. @item strength
  7974. The maximum amount by which the filter will change any one pixel. This is also
  7975. the threshold for detecting nearly flat regions. Acceptable values range from
  7976. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7977. valid range.
  7978. @item radius
  7979. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7980. gradients, but also prevents the filter from modifying the pixels near detailed
  7981. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7982. values will be clipped to the valid range.
  7983. @end table
  7984. Alternatively, the options can be specified as a flat string:
  7985. @var{strength}[:@var{radius}]
  7986. @subsection Examples
  7987. @itemize
  7988. @item
  7989. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7990. @example
  7991. gradfun=3.5:8
  7992. @end example
  7993. @item
  7994. Specify radius, omitting the strength (which will fall-back to the default
  7995. value):
  7996. @example
  7997. gradfun=radius=8
  7998. @end example
  7999. @end itemize
  8000. @section graphmonitor, agraphmonitor
  8001. Show various filtergraph stats.
  8002. With this filter one can debug complete filtergraph.
  8003. Especially issues with links filling with queued frames.
  8004. The filter accepts the following options:
  8005. @table @option
  8006. @item size, s
  8007. Set video output size. Default is @var{hd720}.
  8008. @item opacity, o
  8009. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8010. @item mode, m
  8011. Set output mode, can be @var{fulll} or @var{compact}.
  8012. In @var{compact} mode only filters with some queued frames have displayed stats.
  8013. @item flags, f
  8014. Set flags which enable which stats are shown in video.
  8015. Available values for flags are:
  8016. @table @samp
  8017. @item queue
  8018. Display number of queued frames in each link.
  8019. @item frame_count_in
  8020. Display number of frames taken from filter.
  8021. @item frame_count_out
  8022. Display number of frames given out from filter.
  8023. @item pts
  8024. Display current filtered frame pts.
  8025. @item time
  8026. Display current filtered frame time.
  8027. @item timebase
  8028. Display time base for filter link.
  8029. @item format
  8030. Display used format for filter link.
  8031. @item size
  8032. Display video size or number of audio channels in case of audio used by filter link.
  8033. @item rate
  8034. Display video frame rate or sample rate in case of audio used by filter link.
  8035. @end table
  8036. @item rate, r
  8037. Set upper limit for video rate of output stream, Default value is @var{25}.
  8038. This guarantee that output video frame rate will not be higher than this value.
  8039. @end table
  8040. @section greyedge
  8041. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8042. and corrects the scene colors accordingly.
  8043. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8044. The filter accepts the following options:
  8045. @table @option
  8046. @item difford
  8047. The order of differentiation to be applied on the scene. Must be chosen in the range
  8048. [0,2] and default value is 1.
  8049. @item minknorm
  8050. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8051. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8052. max value instead of calculating Minkowski distance.
  8053. @item sigma
  8054. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8055. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8056. can't be euqal to 0 if @var{difford} is greater than 0.
  8057. @end table
  8058. @subsection Examples
  8059. @itemize
  8060. @item
  8061. Grey Edge:
  8062. @example
  8063. greyedge=difford=1:minknorm=5:sigma=2
  8064. @end example
  8065. @item
  8066. Max Edge:
  8067. @example
  8068. greyedge=difford=1:minknorm=0:sigma=2
  8069. @end example
  8070. @end itemize
  8071. @anchor{haldclut}
  8072. @section haldclut
  8073. Apply a Hald CLUT to a video stream.
  8074. First input is the video stream to process, and second one is the Hald CLUT.
  8075. The Hald CLUT input can be a simple picture or a complete video stream.
  8076. The filter accepts the following options:
  8077. @table @option
  8078. @item shortest
  8079. Force termination when the shortest input terminates. Default is @code{0}.
  8080. @item repeatlast
  8081. Continue applying the last CLUT after the end of the stream. A value of
  8082. @code{0} disable the filter after the last frame of the CLUT is reached.
  8083. Default is @code{1}.
  8084. @end table
  8085. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8086. filters share the same internals).
  8087. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8088. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8089. @subsection Workflow examples
  8090. @subsubsection Hald CLUT video stream
  8091. Generate an identity Hald CLUT stream altered with various effects:
  8092. @example
  8093. 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
  8094. @end example
  8095. Note: make sure you use a lossless codec.
  8096. Then use it with @code{haldclut} to apply it on some random stream:
  8097. @example
  8098. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8099. @end example
  8100. The Hald CLUT will be applied to the 10 first seconds (duration of
  8101. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8102. to the remaining frames of the @code{mandelbrot} stream.
  8103. @subsubsection Hald CLUT with preview
  8104. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8105. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8106. biggest possible square starting at the top left of the picture. The remaining
  8107. padding pixels (bottom or right) will be ignored. This area can be used to add
  8108. a preview of the Hald CLUT.
  8109. Typically, the following generated Hald CLUT will be supported by the
  8110. @code{haldclut} filter:
  8111. @example
  8112. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8113. pad=iw+320 [padded_clut];
  8114. smptebars=s=320x256, split [a][b];
  8115. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8116. [main][b] overlay=W-320" -frames:v 1 clut.png
  8117. @end example
  8118. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8119. bars are displayed on the right-top, and below the same color bars processed by
  8120. the color changes.
  8121. Then, the effect of this Hald CLUT can be visualized with:
  8122. @example
  8123. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8124. @end example
  8125. @section hflip
  8126. Flip the input video horizontally.
  8127. For example, to horizontally flip the input video with @command{ffmpeg}:
  8128. @example
  8129. ffmpeg -i in.avi -vf "hflip" out.avi
  8130. @end example
  8131. @section histeq
  8132. This filter applies a global color histogram equalization on a
  8133. per-frame basis.
  8134. It can be used to correct video that has a compressed range of pixel
  8135. intensities. The filter redistributes the pixel intensities to
  8136. equalize their distribution across the intensity range. It may be
  8137. viewed as an "automatically adjusting contrast filter". This filter is
  8138. useful only for correcting degraded or poorly captured source
  8139. video.
  8140. The filter accepts the following options:
  8141. @table @option
  8142. @item strength
  8143. Determine the amount of equalization to be applied. As the strength
  8144. is reduced, the distribution of pixel intensities more-and-more
  8145. approaches that of the input frame. The value must be a float number
  8146. in the range [0,1] and defaults to 0.200.
  8147. @item intensity
  8148. Set the maximum intensity that can generated and scale the output
  8149. values appropriately. The strength should be set as desired and then
  8150. the intensity can be limited if needed to avoid washing-out. The value
  8151. must be a float number in the range [0,1] and defaults to 0.210.
  8152. @item antibanding
  8153. Set the antibanding level. If enabled the filter will randomly vary
  8154. the luminance of output pixels by a small amount to avoid banding of
  8155. the histogram. Possible values are @code{none}, @code{weak} or
  8156. @code{strong}. It defaults to @code{none}.
  8157. @end table
  8158. @section histogram
  8159. Compute and draw a color distribution histogram for the input video.
  8160. The computed histogram is a representation of the color component
  8161. distribution in an image.
  8162. Standard histogram displays the color components distribution in an image.
  8163. Displays color graph for each color component. Shows distribution of
  8164. the Y, U, V, A or R, G, B components, depending on input format, in the
  8165. current frame. Below each graph a color component scale meter is shown.
  8166. The filter accepts the following options:
  8167. @table @option
  8168. @item level_height
  8169. Set height of level. Default value is @code{200}.
  8170. Allowed range is [50, 2048].
  8171. @item scale_height
  8172. Set height of color scale. Default value is @code{12}.
  8173. Allowed range is [0, 40].
  8174. @item display_mode
  8175. Set display mode.
  8176. It accepts the following values:
  8177. @table @samp
  8178. @item stack
  8179. Per color component graphs are placed below each other.
  8180. @item parade
  8181. Per color component graphs are placed side by side.
  8182. @item overlay
  8183. Presents information identical to that in the @code{parade}, except
  8184. that the graphs representing color components are superimposed directly
  8185. over one another.
  8186. @end table
  8187. Default is @code{stack}.
  8188. @item levels_mode
  8189. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8190. Default is @code{linear}.
  8191. @item components
  8192. Set what color components to display.
  8193. Default is @code{7}.
  8194. @item fgopacity
  8195. Set foreground opacity. Default is @code{0.7}.
  8196. @item bgopacity
  8197. Set background opacity. Default is @code{0.5}.
  8198. @end table
  8199. @subsection Examples
  8200. @itemize
  8201. @item
  8202. Calculate and draw histogram:
  8203. @example
  8204. ffplay -i input -vf histogram
  8205. @end example
  8206. @end itemize
  8207. @anchor{hqdn3d}
  8208. @section hqdn3d
  8209. This is a high precision/quality 3d denoise filter. It aims to reduce
  8210. image noise, producing smooth images and making still images really
  8211. still. It should enhance compressibility.
  8212. It accepts the following optional parameters:
  8213. @table @option
  8214. @item luma_spatial
  8215. A non-negative floating point number which specifies spatial luma strength.
  8216. It defaults to 4.0.
  8217. @item chroma_spatial
  8218. A non-negative floating point number which specifies spatial chroma strength.
  8219. It defaults to 3.0*@var{luma_spatial}/4.0.
  8220. @item luma_tmp
  8221. A floating point number which specifies luma temporal strength. It defaults to
  8222. 6.0*@var{luma_spatial}/4.0.
  8223. @item chroma_tmp
  8224. A floating point number which specifies chroma temporal strength. It defaults to
  8225. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8226. @end table
  8227. @anchor{hwdownload}
  8228. @section hwdownload
  8229. Download hardware frames to system memory.
  8230. The input must be in hardware frames, and the output a non-hardware format.
  8231. Not all formats will be supported on the output - it may be necessary to insert
  8232. an additional @option{format} filter immediately following in the graph to get
  8233. the output in a supported format.
  8234. @section hwmap
  8235. Map hardware frames to system memory or to another device.
  8236. This filter has several different modes of operation; which one is used depends
  8237. on the input and output formats:
  8238. @itemize
  8239. @item
  8240. Hardware frame input, normal frame output
  8241. Map the input frames to system memory and pass them to the output. If the
  8242. original hardware frame is later required (for example, after overlaying
  8243. something else on part of it), the @option{hwmap} filter can be used again
  8244. in the next mode to retrieve it.
  8245. @item
  8246. Normal frame input, hardware frame output
  8247. If the input is actually a software-mapped hardware frame, then unmap it -
  8248. that is, return the original hardware frame.
  8249. Otherwise, a device must be provided. Create new hardware surfaces on that
  8250. device for the output, then map them back to the software format at the input
  8251. and give those frames to the preceding filter. This will then act like the
  8252. @option{hwupload} filter, but may be able to avoid an additional copy when
  8253. the input is already in a compatible format.
  8254. @item
  8255. Hardware frame input and output
  8256. A device must be supplied for the output, either directly or with the
  8257. @option{derive_device} option. The input and output devices must be of
  8258. different types and compatible - the exact meaning of this is
  8259. system-dependent, but typically it means that they must refer to the same
  8260. underlying hardware context (for example, refer to the same graphics card).
  8261. If the input frames were originally created on the output device, then unmap
  8262. to retrieve the original frames.
  8263. Otherwise, map the frames to the output device - create new hardware frames
  8264. on the output corresponding to the frames on the input.
  8265. @end itemize
  8266. The following additional parameters are accepted:
  8267. @table @option
  8268. @item mode
  8269. Set the frame mapping mode. Some combination of:
  8270. @table @var
  8271. @item read
  8272. The mapped frame should be readable.
  8273. @item write
  8274. The mapped frame should be writeable.
  8275. @item overwrite
  8276. The mapping will always overwrite the entire frame.
  8277. This may improve performance in some cases, as the original contents of the
  8278. frame need not be loaded.
  8279. @item direct
  8280. The mapping must not involve any copying.
  8281. Indirect mappings to copies of frames are created in some cases where either
  8282. direct mapping is not possible or it would have unexpected properties.
  8283. Setting this flag ensures that the mapping is direct and will fail if that is
  8284. not possible.
  8285. @end table
  8286. Defaults to @var{read+write} if not specified.
  8287. @item derive_device @var{type}
  8288. Rather than using the device supplied at initialisation, instead derive a new
  8289. device of type @var{type} from the device the input frames exist on.
  8290. @item reverse
  8291. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8292. and map them back to the source. This may be necessary in some cases where
  8293. a mapping in one direction is required but only the opposite direction is
  8294. supported by the devices being used.
  8295. This option is dangerous - it may break the preceding filter in undefined
  8296. ways if there are any additional constraints on that filter's output.
  8297. Do not use it without fully understanding the implications of its use.
  8298. @end table
  8299. @anchor{hwupload}
  8300. @section hwupload
  8301. Upload system memory frames to hardware surfaces.
  8302. The device to upload to must be supplied when the filter is initialised. If
  8303. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8304. option.
  8305. @anchor{hwupload_cuda}
  8306. @section hwupload_cuda
  8307. Upload system memory frames to a CUDA device.
  8308. It accepts the following optional parameters:
  8309. @table @option
  8310. @item device
  8311. The number of the CUDA device to use
  8312. @end table
  8313. @section hqx
  8314. Apply a high-quality magnification filter designed for pixel art. This filter
  8315. was originally created by Maxim Stepin.
  8316. It accepts the following option:
  8317. @table @option
  8318. @item n
  8319. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8320. @code{hq3x} and @code{4} for @code{hq4x}.
  8321. Default is @code{3}.
  8322. @end table
  8323. @section hstack
  8324. Stack input videos horizontally.
  8325. All streams must be of same pixel format and of same height.
  8326. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8327. to create same output.
  8328. The filter accept the following option:
  8329. @table @option
  8330. @item inputs
  8331. Set number of input streams. Default is 2.
  8332. @item shortest
  8333. If set to 1, force the output to terminate when the shortest input
  8334. terminates. Default value is 0.
  8335. @end table
  8336. @section hue
  8337. Modify the hue and/or the saturation of the input.
  8338. It accepts the following parameters:
  8339. @table @option
  8340. @item h
  8341. Specify the hue angle as a number of degrees. It accepts an expression,
  8342. and defaults to "0".
  8343. @item s
  8344. Specify the saturation in the [-10,10] range. It accepts an expression and
  8345. defaults to "1".
  8346. @item H
  8347. Specify the hue angle as a number of radians. It accepts an
  8348. expression, and defaults to "0".
  8349. @item b
  8350. Specify the brightness in the [-10,10] range. It accepts an expression and
  8351. defaults to "0".
  8352. @end table
  8353. @option{h} and @option{H} are mutually exclusive, and can't be
  8354. specified at the same time.
  8355. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8356. expressions containing the following constants:
  8357. @table @option
  8358. @item n
  8359. frame count of the input frame starting from 0
  8360. @item pts
  8361. presentation timestamp of the input frame expressed in time base units
  8362. @item r
  8363. frame rate of the input video, NAN if the input frame rate is unknown
  8364. @item t
  8365. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8366. @item tb
  8367. time base of the input video
  8368. @end table
  8369. @subsection Examples
  8370. @itemize
  8371. @item
  8372. Set the hue to 90 degrees and the saturation to 1.0:
  8373. @example
  8374. hue=h=90:s=1
  8375. @end example
  8376. @item
  8377. Same command but expressing the hue in radians:
  8378. @example
  8379. hue=H=PI/2:s=1
  8380. @end example
  8381. @item
  8382. Rotate hue and make the saturation swing between 0
  8383. and 2 over a period of 1 second:
  8384. @example
  8385. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8386. @end example
  8387. @item
  8388. Apply a 3 seconds saturation fade-in effect starting at 0:
  8389. @example
  8390. hue="s=min(t/3\,1)"
  8391. @end example
  8392. The general fade-in expression can be written as:
  8393. @example
  8394. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8395. @end example
  8396. @item
  8397. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8398. @example
  8399. hue="s=max(0\, min(1\, (8-t)/3))"
  8400. @end example
  8401. The general fade-out expression can be written as:
  8402. @example
  8403. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8404. @end example
  8405. @end itemize
  8406. @subsection Commands
  8407. This filter supports the following commands:
  8408. @table @option
  8409. @item b
  8410. @item s
  8411. @item h
  8412. @item H
  8413. Modify the hue and/or the saturation and/or brightness of the input video.
  8414. The command accepts the same syntax of the corresponding option.
  8415. If the specified expression is not valid, it is kept at its current
  8416. value.
  8417. @end table
  8418. @section hysteresis
  8419. Grow first stream into second stream by connecting components.
  8420. This makes it possible to build more robust edge masks.
  8421. This filter accepts the following options:
  8422. @table @option
  8423. @item planes
  8424. Set which planes will be processed as bitmap, unprocessed planes will be
  8425. copied from first stream.
  8426. By default value 0xf, all planes will be processed.
  8427. @item threshold
  8428. Set threshold which is used in filtering. If pixel component value is higher than
  8429. this value filter algorithm for connecting components is activated.
  8430. By default value is 0.
  8431. @end table
  8432. @section idet
  8433. Detect video interlacing type.
  8434. This filter tries to detect if the input frames are interlaced, progressive,
  8435. top or bottom field first. It will also try to detect fields that are
  8436. repeated between adjacent frames (a sign of telecine).
  8437. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8438. Multiple frame detection incorporates the classification history of previous frames.
  8439. The filter will log these metadata values:
  8440. @table @option
  8441. @item single.current_frame
  8442. Detected type of current frame using single-frame detection. One of:
  8443. ``tff'' (top field first), ``bff'' (bottom field first),
  8444. ``progressive'', or ``undetermined''
  8445. @item single.tff
  8446. Cumulative number of frames detected as top field first using single-frame detection.
  8447. @item multiple.tff
  8448. Cumulative number of frames detected as top field first using multiple-frame detection.
  8449. @item single.bff
  8450. Cumulative number of frames detected as bottom field first using single-frame detection.
  8451. @item multiple.current_frame
  8452. Detected type of current frame using multiple-frame detection. One of:
  8453. ``tff'' (top field first), ``bff'' (bottom field first),
  8454. ``progressive'', or ``undetermined''
  8455. @item multiple.bff
  8456. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8457. @item single.progressive
  8458. Cumulative number of frames detected as progressive using single-frame detection.
  8459. @item multiple.progressive
  8460. Cumulative number of frames detected as progressive using multiple-frame detection.
  8461. @item single.undetermined
  8462. Cumulative number of frames that could not be classified using single-frame detection.
  8463. @item multiple.undetermined
  8464. Cumulative number of frames that could not be classified using multiple-frame detection.
  8465. @item repeated.current_frame
  8466. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8467. @item repeated.neither
  8468. Cumulative number of frames with no repeated field.
  8469. @item repeated.top
  8470. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8471. @item repeated.bottom
  8472. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8473. @end table
  8474. The filter accepts the following options:
  8475. @table @option
  8476. @item intl_thres
  8477. Set interlacing threshold.
  8478. @item prog_thres
  8479. Set progressive threshold.
  8480. @item rep_thres
  8481. Threshold for repeated field detection.
  8482. @item half_life
  8483. Number of frames after which a given frame's contribution to the
  8484. statistics is halved (i.e., it contributes only 0.5 to its
  8485. classification). The default of 0 means that all frames seen are given
  8486. full weight of 1.0 forever.
  8487. @item analyze_interlaced_flag
  8488. When this is not 0 then idet will use the specified number of frames to determine
  8489. if the interlaced flag is accurate, it will not count undetermined frames.
  8490. If the flag is found to be accurate it will be used without any further
  8491. computations, if it is found to be inaccurate it will be cleared without any
  8492. further computations. This allows inserting the idet filter as a low computational
  8493. method to clean up the interlaced flag
  8494. @end table
  8495. @section il
  8496. Deinterleave or interleave fields.
  8497. This filter allows one to process interlaced images fields without
  8498. deinterlacing them. Deinterleaving splits the input frame into 2
  8499. fields (so called half pictures). Odd lines are moved to the top
  8500. half of the output image, even lines to the bottom half.
  8501. You can process (filter) them independently and then re-interleave them.
  8502. The filter accepts the following options:
  8503. @table @option
  8504. @item luma_mode, l
  8505. @item chroma_mode, c
  8506. @item alpha_mode, a
  8507. Available values for @var{luma_mode}, @var{chroma_mode} and
  8508. @var{alpha_mode} are:
  8509. @table @samp
  8510. @item none
  8511. Do nothing.
  8512. @item deinterleave, d
  8513. Deinterleave fields, placing one above the other.
  8514. @item interleave, i
  8515. Interleave fields. Reverse the effect of deinterleaving.
  8516. @end table
  8517. Default value is @code{none}.
  8518. @item luma_swap, ls
  8519. @item chroma_swap, cs
  8520. @item alpha_swap, as
  8521. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8522. @end table
  8523. @section inflate
  8524. Apply inflate effect to the video.
  8525. This filter replaces the pixel by the local(3x3) average by taking into account
  8526. only values higher than the pixel.
  8527. It accepts the following options:
  8528. @table @option
  8529. @item threshold0
  8530. @item threshold1
  8531. @item threshold2
  8532. @item threshold3
  8533. Limit the maximum change for each plane, default is 65535.
  8534. If 0, plane will remain unchanged.
  8535. @end table
  8536. @section interlace
  8537. Simple interlacing filter from progressive contents. This interleaves upper (or
  8538. lower) lines from odd frames with lower (or upper) lines from even frames,
  8539. halving the frame rate and preserving image height.
  8540. @example
  8541. Original Original New Frame
  8542. Frame 'j' Frame 'j+1' (tff)
  8543. ========== =========== ==================
  8544. Line 0 --------------------> Frame 'j' Line 0
  8545. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8546. Line 2 ---------------------> Frame 'j' Line 2
  8547. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8548. ... ... ...
  8549. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8550. @end example
  8551. It accepts the following optional parameters:
  8552. @table @option
  8553. @item scan
  8554. This determines whether the interlaced frame is taken from the even
  8555. (tff - default) or odd (bff) lines of the progressive frame.
  8556. @item lowpass
  8557. Vertical lowpass filter to avoid twitter interlacing and
  8558. reduce moire patterns.
  8559. @table @samp
  8560. @item 0, off
  8561. Disable vertical lowpass filter
  8562. @item 1, linear
  8563. Enable linear filter (default)
  8564. @item 2, complex
  8565. Enable complex filter. This will slightly less reduce twitter and moire
  8566. but better retain detail and subjective sharpness impression.
  8567. @end table
  8568. @end table
  8569. @section kerndeint
  8570. Deinterlace input video by applying Donald Graft's adaptive kernel
  8571. deinterling. Work on interlaced parts of a video to produce
  8572. progressive frames.
  8573. The description of the accepted parameters follows.
  8574. @table @option
  8575. @item thresh
  8576. Set the threshold which affects the filter's tolerance when
  8577. determining if a pixel line must be processed. It must be an integer
  8578. in the range [0,255] and defaults to 10. A value of 0 will result in
  8579. applying the process on every pixels.
  8580. @item map
  8581. Paint pixels exceeding the threshold value to white if set to 1.
  8582. Default is 0.
  8583. @item order
  8584. Set the fields order. Swap fields if set to 1, leave fields alone if
  8585. 0. Default is 0.
  8586. @item sharp
  8587. Enable additional sharpening if set to 1. Default is 0.
  8588. @item twoway
  8589. Enable twoway sharpening if set to 1. Default is 0.
  8590. @end table
  8591. @subsection Examples
  8592. @itemize
  8593. @item
  8594. Apply default values:
  8595. @example
  8596. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8597. @end example
  8598. @item
  8599. Enable additional sharpening:
  8600. @example
  8601. kerndeint=sharp=1
  8602. @end example
  8603. @item
  8604. Paint processed pixels in white:
  8605. @example
  8606. kerndeint=map=1
  8607. @end example
  8608. @end itemize
  8609. @section lenscorrection
  8610. Correct radial lens distortion
  8611. This filter can be used to correct for radial distortion as can result from the use
  8612. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8613. one can use tools available for example as part of opencv or simply trial-and-error.
  8614. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8615. and extract the k1 and k2 coefficients from the resulting matrix.
  8616. Note that effectively the same filter is available in the open-source tools Krita and
  8617. Digikam from the KDE project.
  8618. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8619. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8620. brightness distribution, so you may want to use both filters together in certain
  8621. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8622. be applied before or after lens correction.
  8623. @subsection Options
  8624. The filter accepts the following options:
  8625. @table @option
  8626. @item cx
  8627. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8628. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8629. width. Default is 0.5.
  8630. @item cy
  8631. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8632. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8633. height. Default is 0.5.
  8634. @item k1
  8635. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8636. no correction. Default is 0.
  8637. @item k2
  8638. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8639. 0 means no correction. Default is 0.
  8640. @end table
  8641. The formula that generates the correction is:
  8642. @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)
  8643. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8644. distances from the focal point in the source and target images, respectively.
  8645. @section lensfun
  8646. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8647. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8648. to apply the lens correction. The filter will load the lensfun database and
  8649. query it to find the corresponding camera and lens entries in the database. As
  8650. long as these entries can be found with the given options, the filter can
  8651. perform corrections on frames. Note that incomplete strings will result in the
  8652. filter choosing the best match with the given options, and the filter will
  8653. output the chosen camera and lens models (logged with level "info"). You must
  8654. provide the make, camera model, and lens model as they are required.
  8655. The filter accepts the following options:
  8656. @table @option
  8657. @item make
  8658. The make of the camera (for example, "Canon"). This option is required.
  8659. @item model
  8660. The model of the camera (for example, "Canon EOS 100D"). This option is
  8661. required.
  8662. @item lens_model
  8663. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8664. option is required.
  8665. @item mode
  8666. The type of correction to apply. The following values are valid options:
  8667. @table @samp
  8668. @item vignetting
  8669. Enables fixing lens vignetting.
  8670. @item geometry
  8671. Enables fixing lens geometry. This is the default.
  8672. @item subpixel
  8673. Enables fixing chromatic aberrations.
  8674. @item vig_geo
  8675. Enables fixing lens vignetting and lens geometry.
  8676. @item vig_subpixel
  8677. Enables fixing lens vignetting and chromatic aberrations.
  8678. @item distortion
  8679. Enables fixing both lens geometry and chromatic aberrations.
  8680. @item all
  8681. Enables all possible corrections.
  8682. @end table
  8683. @item focal_length
  8684. The focal length of the image/video (zoom; expected constant for video). For
  8685. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8686. range should be chosen when using that lens. Default 18.
  8687. @item aperture
  8688. The aperture of the image/video (expected constant for video). Note that
  8689. aperture is only used for vignetting correction. Default 3.5.
  8690. @item focus_distance
  8691. The focus distance of the image/video (expected constant for video). Note that
  8692. focus distance is only used for vignetting and only slightly affects the
  8693. vignetting correction process. If unknown, leave it at the default value (which
  8694. is 1000).
  8695. @item target_geometry
  8696. The target geometry of the output image/video. The following values are valid
  8697. options:
  8698. @table @samp
  8699. @item rectilinear (default)
  8700. @item fisheye
  8701. @item panoramic
  8702. @item equirectangular
  8703. @item fisheye_orthographic
  8704. @item fisheye_stereographic
  8705. @item fisheye_equisolid
  8706. @item fisheye_thoby
  8707. @end table
  8708. @item reverse
  8709. Apply the reverse of image correction (instead of correcting distortion, apply
  8710. it).
  8711. @item interpolation
  8712. The type of interpolation used when correcting distortion. The following values
  8713. are valid options:
  8714. @table @samp
  8715. @item nearest
  8716. @item linear (default)
  8717. @item lanczos
  8718. @end table
  8719. @end table
  8720. @subsection Examples
  8721. @itemize
  8722. @item
  8723. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8724. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8725. aperture of "8.0".
  8726. @example
  8727. 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
  8728. @end example
  8729. @item
  8730. Apply the same as before, but only for the first 5 seconds of video.
  8731. @example
  8732. 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
  8733. @end example
  8734. @end itemize
  8735. @section libvmaf
  8736. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8737. score between two input videos.
  8738. The obtained VMAF score is printed through the logging system.
  8739. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8740. After installing the library it can be enabled using:
  8741. @code{./configure --enable-libvmaf --enable-version3}.
  8742. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8743. The filter has following options:
  8744. @table @option
  8745. @item model_path
  8746. Set the model path which is to be used for SVM.
  8747. Default value: @code{"vmaf_v0.6.1.pkl"}
  8748. @item log_path
  8749. Set the file path to be used to store logs.
  8750. @item log_fmt
  8751. Set the format of the log file (xml or json).
  8752. @item enable_transform
  8753. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  8754. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  8755. Default value: @code{false}
  8756. @item phone_model
  8757. Invokes the phone model which will generate VMAF scores higher than in the
  8758. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8759. @item psnr
  8760. Enables computing psnr along with vmaf.
  8761. @item ssim
  8762. Enables computing ssim along with vmaf.
  8763. @item ms_ssim
  8764. Enables computing ms_ssim along with vmaf.
  8765. @item pool
  8766. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8767. @item n_threads
  8768. Set number of threads to be used when computing vmaf.
  8769. @item n_subsample
  8770. Set interval for frame subsampling used when computing vmaf.
  8771. @item enable_conf_interval
  8772. Enables confidence interval.
  8773. @end table
  8774. This filter also supports the @ref{framesync} options.
  8775. On the below examples the input file @file{main.mpg} being processed is
  8776. compared with the reference file @file{ref.mpg}.
  8777. @example
  8778. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8779. @end example
  8780. Example with options:
  8781. @example
  8782. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  8783. @end example
  8784. @section limiter
  8785. Limits the pixel components values to the specified range [min, max].
  8786. The filter accepts the following options:
  8787. @table @option
  8788. @item min
  8789. Lower bound. Defaults to the lowest allowed value for the input.
  8790. @item max
  8791. Upper bound. Defaults to the highest allowed value for the input.
  8792. @item planes
  8793. Specify which planes will be processed. Defaults to all available.
  8794. @end table
  8795. @section loop
  8796. Loop video frames.
  8797. The filter accepts the following options:
  8798. @table @option
  8799. @item loop
  8800. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8801. Default is 0.
  8802. @item size
  8803. Set maximal size in number of frames. Default is 0.
  8804. @item start
  8805. Set first frame of loop. Default is 0.
  8806. @end table
  8807. @subsection Examples
  8808. @itemize
  8809. @item
  8810. Loop single first frame infinitely:
  8811. @example
  8812. loop=loop=-1:size=1:start=0
  8813. @end example
  8814. @item
  8815. Loop single first frame 10 times:
  8816. @example
  8817. loop=loop=10:size=1:start=0
  8818. @end example
  8819. @item
  8820. Loop 10 first frames 5 times:
  8821. @example
  8822. loop=loop=5:size=10:start=0
  8823. @end example
  8824. @end itemize
  8825. @section lut1d
  8826. Apply a 1D LUT to an input video.
  8827. The filter accepts the following options:
  8828. @table @option
  8829. @item file
  8830. Set the 1D LUT file name.
  8831. Currently supported formats:
  8832. @table @samp
  8833. @item cube
  8834. Iridas
  8835. @end table
  8836. @item interp
  8837. Select interpolation mode.
  8838. Available values are:
  8839. @table @samp
  8840. @item nearest
  8841. Use values from the nearest defined point.
  8842. @item linear
  8843. Interpolate values using the linear interpolation.
  8844. @item cosine
  8845. Interpolate values using the cosine interpolation.
  8846. @item cubic
  8847. Interpolate values using the cubic interpolation.
  8848. @item spline
  8849. Interpolate values using the spline interpolation.
  8850. @end table
  8851. @end table
  8852. @anchor{lut3d}
  8853. @section lut3d
  8854. Apply a 3D LUT to an input video.
  8855. The filter accepts the following options:
  8856. @table @option
  8857. @item file
  8858. Set the 3D LUT file name.
  8859. Currently supported formats:
  8860. @table @samp
  8861. @item 3dl
  8862. AfterEffects
  8863. @item cube
  8864. Iridas
  8865. @item dat
  8866. DaVinci
  8867. @item m3d
  8868. Pandora
  8869. @end table
  8870. @item interp
  8871. Select interpolation mode.
  8872. Available values are:
  8873. @table @samp
  8874. @item nearest
  8875. Use values from the nearest defined point.
  8876. @item trilinear
  8877. Interpolate values using the 8 points defining a cube.
  8878. @item tetrahedral
  8879. Interpolate values using a tetrahedron.
  8880. @end table
  8881. @end table
  8882. This filter also supports the @ref{framesync} options.
  8883. @section lumakey
  8884. Turn certain luma values into transparency.
  8885. The filter accepts the following options:
  8886. @table @option
  8887. @item threshold
  8888. Set the luma which will be used as base for transparency.
  8889. Default value is @code{0}.
  8890. @item tolerance
  8891. Set the range of luma values to be keyed out.
  8892. Default value is @code{0}.
  8893. @item softness
  8894. Set the range of softness. Default value is @code{0}.
  8895. Use this to control gradual transition from zero to full transparency.
  8896. @end table
  8897. @section lut, lutrgb, lutyuv
  8898. Compute a look-up table for binding each pixel component input value
  8899. to an output value, and apply it to the input video.
  8900. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8901. to an RGB input video.
  8902. These filters accept the following parameters:
  8903. @table @option
  8904. @item c0
  8905. set first pixel component expression
  8906. @item c1
  8907. set second pixel component expression
  8908. @item c2
  8909. set third pixel component expression
  8910. @item c3
  8911. set fourth pixel component expression, corresponds to the alpha component
  8912. @item r
  8913. set red component expression
  8914. @item g
  8915. set green component expression
  8916. @item b
  8917. set blue component expression
  8918. @item a
  8919. alpha component expression
  8920. @item y
  8921. set Y/luminance component expression
  8922. @item u
  8923. set U/Cb component expression
  8924. @item v
  8925. set V/Cr component expression
  8926. @end table
  8927. Each of them specifies the expression to use for computing the lookup table for
  8928. the corresponding pixel component values.
  8929. The exact component associated to each of the @var{c*} options depends on the
  8930. format in input.
  8931. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8932. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8933. The expressions can contain the following constants and functions:
  8934. @table @option
  8935. @item w
  8936. @item h
  8937. The input width and height.
  8938. @item val
  8939. The input value for the pixel component.
  8940. @item clipval
  8941. The input value, clipped to the @var{minval}-@var{maxval} range.
  8942. @item maxval
  8943. The maximum value for the pixel component.
  8944. @item minval
  8945. The minimum value for the pixel component.
  8946. @item negval
  8947. The negated value for the pixel component value, clipped to the
  8948. @var{minval}-@var{maxval} range; it corresponds to the expression
  8949. "maxval-clipval+minval".
  8950. @item clip(val)
  8951. The computed value in @var{val}, clipped to the
  8952. @var{minval}-@var{maxval} range.
  8953. @item gammaval(gamma)
  8954. The computed gamma correction value of the pixel component value,
  8955. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8956. expression
  8957. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8958. @end table
  8959. All expressions default to "val".
  8960. @subsection Examples
  8961. @itemize
  8962. @item
  8963. Negate input video:
  8964. @example
  8965. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8966. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8967. @end example
  8968. The above is the same as:
  8969. @example
  8970. lutrgb="r=negval:g=negval:b=negval"
  8971. lutyuv="y=negval:u=negval:v=negval"
  8972. @end example
  8973. @item
  8974. Negate luminance:
  8975. @example
  8976. lutyuv=y=negval
  8977. @end example
  8978. @item
  8979. Remove chroma components, turning the video into a graytone image:
  8980. @example
  8981. lutyuv="u=128:v=128"
  8982. @end example
  8983. @item
  8984. Apply a luma burning effect:
  8985. @example
  8986. lutyuv="y=2*val"
  8987. @end example
  8988. @item
  8989. Remove green and blue components:
  8990. @example
  8991. lutrgb="g=0:b=0"
  8992. @end example
  8993. @item
  8994. Set a constant alpha channel value on input:
  8995. @example
  8996. format=rgba,lutrgb=a="maxval-minval/2"
  8997. @end example
  8998. @item
  8999. Correct luminance gamma by a factor of 0.5:
  9000. @example
  9001. lutyuv=y=gammaval(0.5)
  9002. @end example
  9003. @item
  9004. Discard least significant bits of luma:
  9005. @example
  9006. lutyuv=y='bitand(val, 128+64+32)'
  9007. @end example
  9008. @item
  9009. Technicolor like effect:
  9010. @example
  9011. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9012. @end example
  9013. @end itemize
  9014. @section lut2, tlut2
  9015. The @code{lut2} filter takes two input streams and outputs one
  9016. stream.
  9017. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9018. from one single stream.
  9019. This filter accepts the following parameters:
  9020. @table @option
  9021. @item c0
  9022. set first pixel component expression
  9023. @item c1
  9024. set second pixel component expression
  9025. @item c2
  9026. set third pixel component expression
  9027. @item c3
  9028. set fourth pixel component expression, corresponds to the alpha component
  9029. @item d
  9030. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9031. which means bit depth is automatically picked from first input format.
  9032. @end table
  9033. Each of them specifies the expression to use for computing the lookup table for
  9034. the corresponding pixel component values.
  9035. The exact component associated to each of the @var{c*} options depends on the
  9036. format in inputs.
  9037. The expressions can contain the following constants:
  9038. @table @option
  9039. @item w
  9040. @item h
  9041. The input width and height.
  9042. @item x
  9043. The first input value for the pixel component.
  9044. @item y
  9045. The second input value for the pixel component.
  9046. @item bdx
  9047. The first input video bit depth.
  9048. @item bdy
  9049. The second input video bit depth.
  9050. @end table
  9051. All expressions default to "x".
  9052. @subsection Examples
  9053. @itemize
  9054. @item
  9055. Highlight differences between two RGB video streams:
  9056. @example
  9057. 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)'
  9058. @end example
  9059. @item
  9060. Highlight differences between two YUV video streams:
  9061. @example
  9062. 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)'
  9063. @end example
  9064. @item
  9065. Show max difference between two video streams:
  9066. @example
  9067. 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)))'
  9068. @end example
  9069. @end itemize
  9070. @section maskedclamp
  9071. Clamp the first input stream with the second input and third input stream.
  9072. Returns the value of first stream to be between second input
  9073. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9074. This filter accepts the following options:
  9075. @table @option
  9076. @item undershoot
  9077. Default value is @code{0}.
  9078. @item overshoot
  9079. Default value is @code{0}.
  9080. @item planes
  9081. Set which planes will be processed as bitmap, unprocessed planes will be
  9082. copied from first stream.
  9083. By default value 0xf, all planes will be processed.
  9084. @end table
  9085. @section maskedmerge
  9086. Merge the first input stream with the second input stream using per pixel
  9087. weights in the third input stream.
  9088. A value of 0 in the third stream pixel component means that pixel component
  9089. from first stream is returned unchanged, while maximum value (eg. 255 for
  9090. 8-bit videos) means that pixel component from second stream is returned
  9091. unchanged. Intermediate values define the amount of merging between both
  9092. input stream's pixel components.
  9093. This filter accepts the following options:
  9094. @table @option
  9095. @item planes
  9096. Set which planes will be processed as bitmap, unprocessed planes will be
  9097. copied from first stream.
  9098. By default value 0xf, all planes will be processed.
  9099. @end table
  9100. @section mcdeint
  9101. Apply motion-compensation deinterlacing.
  9102. It needs one field per frame as input and must thus be used together
  9103. with yadif=1/3 or equivalent.
  9104. This filter accepts the following options:
  9105. @table @option
  9106. @item mode
  9107. Set the deinterlacing mode.
  9108. It accepts one of the following values:
  9109. @table @samp
  9110. @item fast
  9111. @item medium
  9112. @item slow
  9113. use iterative motion estimation
  9114. @item extra_slow
  9115. like @samp{slow}, but use multiple reference frames.
  9116. @end table
  9117. Default value is @samp{fast}.
  9118. @item parity
  9119. Set the picture field parity assumed for the input video. It must be
  9120. one of the following values:
  9121. @table @samp
  9122. @item 0, tff
  9123. assume top field first
  9124. @item 1, bff
  9125. assume bottom field first
  9126. @end table
  9127. Default value is @samp{bff}.
  9128. @item qp
  9129. Set per-block quantization parameter (QP) used by the internal
  9130. encoder.
  9131. Higher values should result in a smoother motion vector field but less
  9132. optimal individual vectors. Default value is 1.
  9133. @end table
  9134. @section mergeplanes
  9135. Merge color channel components from several video streams.
  9136. The filter accepts up to 4 input streams, and merge selected input
  9137. planes to the output video.
  9138. This filter accepts the following options:
  9139. @table @option
  9140. @item mapping
  9141. Set input to output plane mapping. Default is @code{0}.
  9142. The mappings is specified as a bitmap. It should be specified as a
  9143. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9144. mapping for the first plane of the output stream. 'A' sets the number of
  9145. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9146. corresponding input to use (from 0 to 3). The rest of the mappings is
  9147. similar, 'Bb' describes the mapping for the output stream second
  9148. plane, 'Cc' describes the mapping for the output stream third plane and
  9149. 'Dd' describes the mapping for the output stream fourth plane.
  9150. @item format
  9151. Set output pixel format. Default is @code{yuva444p}.
  9152. @end table
  9153. @subsection Examples
  9154. @itemize
  9155. @item
  9156. Merge three gray video streams of same width and height into single video stream:
  9157. @example
  9158. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9159. @end example
  9160. @item
  9161. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9162. @example
  9163. [a0][a1]mergeplanes=0x00010210:yuva444p
  9164. @end example
  9165. @item
  9166. Swap Y and A plane in yuva444p stream:
  9167. @example
  9168. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9169. @end example
  9170. @item
  9171. Swap U and V plane in yuv420p stream:
  9172. @example
  9173. format=yuv420p,mergeplanes=0x000201:yuv420p
  9174. @end example
  9175. @item
  9176. Cast a rgb24 clip to yuv444p:
  9177. @example
  9178. format=rgb24,mergeplanes=0x000102:yuv444p
  9179. @end example
  9180. @end itemize
  9181. @section mestimate
  9182. Estimate and export motion vectors using block matching algorithms.
  9183. Motion vectors are stored in frame side data to be used by other filters.
  9184. This filter accepts the following options:
  9185. @table @option
  9186. @item method
  9187. Specify the motion estimation method. Accepts one of the following values:
  9188. @table @samp
  9189. @item esa
  9190. Exhaustive search algorithm.
  9191. @item tss
  9192. Three step search algorithm.
  9193. @item tdls
  9194. Two dimensional logarithmic search algorithm.
  9195. @item ntss
  9196. New three step search algorithm.
  9197. @item fss
  9198. Four step search algorithm.
  9199. @item ds
  9200. Diamond search algorithm.
  9201. @item hexbs
  9202. Hexagon-based search algorithm.
  9203. @item epzs
  9204. Enhanced predictive zonal search algorithm.
  9205. @item umh
  9206. Uneven multi-hexagon search algorithm.
  9207. @end table
  9208. Default value is @samp{esa}.
  9209. @item mb_size
  9210. Macroblock size. Default @code{16}.
  9211. @item search_param
  9212. Search parameter. Default @code{7}.
  9213. @end table
  9214. @section midequalizer
  9215. Apply Midway Image Equalization effect using two video streams.
  9216. Midway Image Equalization adjusts a pair of images to have the same
  9217. histogram, while maintaining their dynamics as much as possible. It's
  9218. useful for e.g. matching exposures from a pair of stereo cameras.
  9219. This filter has two inputs and one output, which must be of same pixel format, but
  9220. may be of different sizes. The output of filter is first input adjusted with
  9221. midway histogram of both inputs.
  9222. This filter accepts the following option:
  9223. @table @option
  9224. @item planes
  9225. Set which planes to process. Default is @code{15}, which is all available planes.
  9226. @end table
  9227. @section minterpolate
  9228. Convert the video to specified frame rate using motion interpolation.
  9229. This filter accepts the following options:
  9230. @table @option
  9231. @item fps
  9232. 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}.
  9233. @item mi_mode
  9234. Motion interpolation mode. Following values are accepted:
  9235. @table @samp
  9236. @item dup
  9237. Duplicate previous or next frame for interpolating new ones.
  9238. @item blend
  9239. Blend source frames. Interpolated frame is mean of previous and next frames.
  9240. @item mci
  9241. Motion compensated interpolation. Following options are effective when this mode is selected:
  9242. @table @samp
  9243. @item mc_mode
  9244. Motion compensation mode. Following values are accepted:
  9245. @table @samp
  9246. @item obmc
  9247. Overlapped block motion compensation.
  9248. @item aobmc
  9249. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9250. @end table
  9251. Default mode is @samp{obmc}.
  9252. @item me_mode
  9253. Motion estimation mode. Following values are accepted:
  9254. @table @samp
  9255. @item bidir
  9256. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9257. @item bilat
  9258. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9259. @end table
  9260. Default mode is @samp{bilat}.
  9261. @item me
  9262. The algorithm to be used for motion estimation. Following values are accepted:
  9263. @table @samp
  9264. @item esa
  9265. Exhaustive search algorithm.
  9266. @item tss
  9267. Three step search algorithm.
  9268. @item tdls
  9269. Two dimensional logarithmic search algorithm.
  9270. @item ntss
  9271. New three step search algorithm.
  9272. @item fss
  9273. Four step search algorithm.
  9274. @item ds
  9275. Diamond search algorithm.
  9276. @item hexbs
  9277. Hexagon-based search algorithm.
  9278. @item epzs
  9279. Enhanced predictive zonal search algorithm.
  9280. @item umh
  9281. Uneven multi-hexagon search algorithm.
  9282. @end table
  9283. Default algorithm is @samp{epzs}.
  9284. @item mb_size
  9285. Macroblock size. Default @code{16}.
  9286. @item search_param
  9287. Motion estimation search parameter. Default @code{32}.
  9288. @item vsbmc
  9289. 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).
  9290. @end table
  9291. @end table
  9292. @item scd
  9293. 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:
  9294. @table @samp
  9295. @item none
  9296. Disable scene change detection.
  9297. @item fdiff
  9298. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9299. @end table
  9300. Default method is @samp{fdiff}.
  9301. @item scd_threshold
  9302. Scene change detection threshold. Default is @code{5.0}.
  9303. @end table
  9304. @section mix
  9305. Mix several video input streams into one video stream.
  9306. A description of the accepted options follows.
  9307. @table @option
  9308. @item nb_inputs
  9309. The number of inputs. If unspecified, it defaults to 2.
  9310. @item weights
  9311. Specify weight of each input video stream as sequence.
  9312. Each weight is separated by space. If number of weights
  9313. is smaller than number of @var{frames} last specified
  9314. weight will be used for all remaining unset weights.
  9315. @item scale
  9316. Specify scale, if it is set it will be multiplied with sum
  9317. of each weight multiplied with pixel values to give final destination
  9318. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9319. @item duration
  9320. Specify how end of stream is determined.
  9321. @table @samp
  9322. @item longest
  9323. The duration of the longest input. (default)
  9324. @item shortest
  9325. The duration of the shortest input.
  9326. @item first
  9327. The duration of the first input.
  9328. @end table
  9329. @end table
  9330. @section mpdecimate
  9331. Drop frames that do not differ greatly from the previous frame in
  9332. order to reduce frame rate.
  9333. The main use of this filter is for very-low-bitrate encoding
  9334. (e.g. streaming over dialup modem), but it could in theory be used for
  9335. fixing movies that were inverse-telecined incorrectly.
  9336. A description of the accepted options follows.
  9337. @table @option
  9338. @item max
  9339. Set the maximum number of consecutive frames which can be dropped (if
  9340. positive), or the minimum interval between dropped frames (if
  9341. negative). If the value is 0, the frame is dropped disregarding the
  9342. number of previous sequentially dropped frames.
  9343. Default value is 0.
  9344. @item hi
  9345. @item lo
  9346. @item frac
  9347. Set the dropping threshold values.
  9348. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9349. represent actual pixel value differences, so a threshold of 64
  9350. corresponds to 1 unit of difference for each pixel, or the same spread
  9351. out differently over the block.
  9352. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9353. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9354. meaning the whole image) differ by more than a threshold of @option{lo}.
  9355. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9356. 64*5, and default value for @option{frac} is 0.33.
  9357. @end table
  9358. @section negate
  9359. Negate (invert) the input video.
  9360. It accepts the following option:
  9361. @table @option
  9362. @item negate_alpha
  9363. With value 1, it negates the alpha component, if present. Default value is 0.
  9364. @end table
  9365. @anchor{nlmeans}
  9366. @section nlmeans
  9367. Denoise frames using Non-Local Means algorithm.
  9368. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9369. context similarity is defined by comparing their surrounding patches of size
  9370. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9371. around the pixel.
  9372. Note that the research area defines centers for patches, which means some
  9373. patches will be made of pixels outside that research area.
  9374. The filter accepts the following options.
  9375. @table @option
  9376. @item s
  9377. Set denoising strength.
  9378. @item p
  9379. Set patch size.
  9380. @item pc
  9381. Same as @option{p} but for chroma planes.
  9382. The default value is @var{0} and means automatic.
  9383. @item r
  9384. Set research size.
  9385. @item rc
  9386. Same as @option{r} but for chroma planes.
  9387. The default value is @var{0} and means automatic.
  9388. @end table
  9389. @section nnedi
  9390. Deinterlace video using neural network edge directed interpolation.
  9391. This filter accepts the following options:
  9392. @table @option
  9393. @item weights
  9394. Mandatory option, without binary file filter can not work.
  9395. Currently file can be found here:
  9396. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9397. @item deint
  9398. Set which frames to deinterlace, by default it is @code{all}.
  9399. Can be @code{all} or @code{interlaced}.
  9400. @item field
  9401. Set mode of operation.
  9402. Can be one of the following:
  9403. @table @samp
  9404. @item af
  9405. Use frame flags, both fields.
  9406. @item a
  9407. Use frame flags, single field.
  9408. @item t
  9409. Use top field only.
  9410. @item b
  9411. Use bottom field only.
  9412. @item tf
  9413. Use both fields, top first.
  9414. @item bf
  9415. Use both fields, bottom first.
  9416. @end table
  9417. @item planes
  9418. Set which planes to process, by default filter process all frames.
  9419. @item nsize
  9420. Set size of local neighborhood around each pixel, used by the predictor neural
  9421. network.
  9422. Can be one of the following:
  9423. @table @samp
  9424. @item s8x6
  9425. @item s16x6
  9426. @item s32x6
  9427. @item s48x6
  9428. @item s8x4
  9429. @item s16x4
  9430. @item s32x4
  9431. @end table
  9432. @item nns
  9433. Set the number of neurons in predictor neural network.
  9434. Can be one of the following:
  9435. @table @samp
  9436. @item n16
  9437. @item n32
  9438. @item n64
  9439. @item n128
  9440. @item n256
  9441. @end table
  9442. @item qual
  9443. Controls the number of different neural network predictions that are blended
  9444. together to compute the final output value. Can be @code{fast}, default or
  9445. @code{slow}.
  9446. @item etype
  9447. Set which set of weights to use in the predictor.
  9448. Can be one of the following:
  9449. @table @samp
  9450. @item a
  9451. weights trained to minimize absolute error
  9452. @item s
  9453. weights trained to minimize squared error
  9454. @end table
  9455. @item pscrn
  9456. Controls whether or not the prescreener neural network is used to decide
  9457. which pixels should be processed by the predictor neural network and which
  9458. can be handled by simple cubic interpolation.
  9459. The prescreener is trained to know whether cubic interpolation will be
  9460. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9461. The computational complexity of the prescreener nn is much less than that of
  9462. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9463. using the prescreener generally results in much faster processing.
  9464. The prescreener is pretty accurate, so the difference between using it and not
  9465. using it is almost always unnoticeable.
  9466. Can be one of the following:
  9467. @table @samp
  9468. @item none
  9469. @item original
  9470. @item new
  9471. @end table
  9472. Default is @code{new}.
  9473. @item fapprox
  9474. Set various debugging flags.
  9475. @end table
  9476. @section noformat
  9477. Force libavfilter not to use any of the specified pixel formats for the
  9478. input to the next filter.
  9479. It accepts the following parameters:
  9480. @table @option
  9481. @item pix_fmts
  9482. A '|'-separated list of pixel format names, such as
  9483. pix_fmts=yuv420p|monow|rgb24".
  9484. @end table
  9485. @subsection Examples
  9486. @itemize
  9487. @item
  9488. Force libavfilter to use a format different from @var{yuv420p} for the
  9489. input to the vflip filter:
  9490. @example
  9491. noformat=pix_fmts=yuv420p,vflip
  9492. @end example
  9493. @item
  9494. Convert the input video to any of the formats not contained in the list:
  9495. @example
  9496. noformat=yuv420p|yuv444p|yuv410p
  9497. @end example
  9498. @end itemize
  9499. @section noise
  9500. Add noise on video input frame.
  9501. The filter accepts the following options:
  9502. @table @option
  9503. @item all_seed
  9504. @item c0_seed
  9505. @item c1_seed
  9506. @item c2_seed
  9507. @item c3_seed
  9508. Set noise seed for specific pixel component or all pixel components in case
  9509. of @var{all_seed}. Default value is @code{123457}.
  9510. @item all_strength, alls
  9511. @item c0_strength, c0s
  9512. @item c1_strength, c1s
  9513. @item c2_strength, c2s
  9514. @item c3_strength, c3s
  9515. Set noise strength for specific pixel component or all pixel components in case
  9516. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9517. @item all_flags, allf
  9518. @item c0_flags, c0f
  9519. @item c1_flags, c1f
  9520. @item c2_flags, c2f
  9521. @item c3_flags, c3f
  9522. Set pixel component flags or set flags for all components if @var{all_flags}.
  9523. Available values for component flags are:
  9524. @table @samp
  9525. @item a
  9526. averaged temporal noise (smoother)
  9527. @item p
  9528. mix random noise with a (semi)regular pattern
  9529. @item t
  9530. temporal noise (noise pattern changes between frames)
  9531. @item u
  9532. uniform noise (gaussian otherwise)
  9533. @end table
  9534. @end table
  9535. @subsection Examples
  9536. Add temporal and uniform noise to input video:
  9537. @example
  9538. noise=alls=20:allf=t+u
  9539. @end example
  9540. @section normalize
  9541. Normalize RGB video (aka histogram stretching, contrast stretching).
  9542. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9543. For each channel of each frame, the filter computes the input range and maps
  9544. it linearly to the user-specified output range. The output range defaults
  9545. to the full dynamic range from pure black to pure white.
  9546. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9547. changes in brightness) caused when small dark or bright objects enter or leave
  9548. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9549. video camera, and, like a video camera, it may cause a period of over- or
  9550. under-exposure of the video.
  9551. The R,G,B channels can be normalized independently, which may cause some
  9552. color shifting, or linked together as a single channel, which prevents
  9553. color shifting. Linked normalization preserves hue. Independent normalization
  9554. does not, so it can be used to remove some color casts. Independent and linked
  9555. normalization can be combined in any ratio.
  9556. The normalize filter accepts the following options:
  9557. @table @option
  9558. @item blackpt
  9559. @item whitept
  9560. Colors which define the output range. The minimum input value is mapped to
  9561. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9562. The defaults are black and white respectively. Specifying white for
  9563. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9564. normalized video. Shades of grey can be used to reduce the dynamic range
  9565. (contrast). Specifying saturated colors here can create some interesting
  9566. effects.
  9567. @item smoothing
  9568. The number of previous frames to use for temporal smoothing. The input range
  9569. of each channel is smoothed using a rolling average over the current frame
  9570. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9571. smoothing).
  9572. @item independence
  9573. Controls the ratio of independent (color shifting) channel normalization to
  9574. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9575. independent. Defaults to 1.0 (fully independent).
  9576. @item strength
  9577. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9578. expensive no-op. Defaults to 1.0 (full strength).
  9579. @end table
  9580. @subsection Examples
  9581. Stretch video contrast to use the full dynamic range, with no temporal
  9582. smoothing; may flicker depending on the source content:
  9583. @example
  9584. normalize=blackpt=black:whitept=white:smoothing=0
  9585. @end example
  9586. As above, but with 50 frames of temporal smoothing; flicker should be
  9587. reduced, depending on the source content:
  9588. @example
  9589. normalize=blackpt=black:whitept=white:smoothing=50
  9590. @end example
  9591. As above, but with hue-preserving linked channel normalization:
  9592. @example
  9593. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9594. @end example
  9595. As above, but with half strength:
  9596. @example
  9597. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9598. @end example
  9599. Map the darkest input color to red, the brightest input color to cyan:
  9600. @example
  9601. normalize=blackpt=red:whitept=cyan
  9602. @end example
  9603. @section null
  9604. Pass the video source unchanged to the output.
  9605. @section ocr
  9606. Optical Character Recognition
  9607. This filter uses Tesseract for optical character recognition. To enable
  9608. compilation of this filter, you need to configure FFmpeg with
  9609. @code{--enable-libtesseract}.
  9610. It accepts the following options:
  9611. @table @option
  9612. @item datapath
  9613. Set datapath to tesseract data. Default is to use whatever was
  9614. set at installation.
  9615. @item language
  9616. Set language, default is "eng".
  9617. @item whitelist
  9618. Set character whitelist.
  9619. @item blacklist
  9620. Set character blacklist.
  9621. @end table
  9622. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9623. @section ocv
  9624. Apply a video transform using libopencv.
  9625. To enable this filter, install the libopencv library and headers and
  9626. configure FFmpeg with @code{--enable-libopencv}.
  9627. It accepts the following parameters:
  9628. @table @option
  9629. @item filter_name
  9630. The name of the libopencv filter to apply.
  9631. @item filter_params
  9632. The parameters to pass to the libopencv filter. If not specified, the default
  9633. values are assumed.
  9634. @end table
  9635. Refer to the official libopencv documentation for more precise
  9636. information:
  9637. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9638. Several libopencv filters are supported; see the following subsections.
  9639. @anchor{dilate}
  9640. @subsection dilate
  9641. Dilate an image by using a specific structuring element.
  9642. It corresponds to the libopencv function @code{cvDilate}.
  9643. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9644. @var{struct_el} represents a structuring element, and has the syntax:
  9645. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9646. @var{cols} and @var{rows} represent the number of columns and rows of
  9647. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9648. point, and @var{shape} the shape for the structuring element. @var{shape}
  9649. must be "rect", "cross", "ellipse", or "custom".
  9650. If the value for @var{shape} is "custom", it must be followed by a
  9651. string of the form "=@var{filename}". The file with name
  9652. @var{filename} is assumed to represent a binary image, with each
  9653. printable character corresponding to a bright pixel. When a custom
  9654. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9655. or columns and rows of the read file are assumed instead.
  9656. The default value for @var{struct_el} is "3x3+0x0/rect".
  9657. @var{nb_iterations} specifies the number of times the transform is
  9658. applied to the image, and defaults to 1.
  9659. Some examples:
  9660. @example
  9661. # Use the default values
  9662. ocv=dilate
  9663. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9664. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9665. # Read the shape from the file diamond.shape, iterating two times.
  9666. # The file diamond.shape may contain a pattern of characters like this
  9667. # *
  9668. # ***
  9669. # *****
  9670. # ***
  9671. # *
  9672. # The specified columns and rows are ignored
  9673. # but the anchor point coordinates are not
  9674. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9675. @end example
  9676. @subsection erode
  9677. Erode an image by using a specific structuring element.
  9678. It corresponds to the libopencv function @code{cvErode}.
  9679. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9680. with the same syntax and semantics as the @ref{dilate} filter.
  9681. @subsection smooth
  9682. Smooth the input video.
  9683. The filter takes the following parameters:
  9684. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9685. @var{type} is the type of smooth filter to apply, and must be one of
  9686. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9687. or "bilateral". The default value is "gaussian".
  9688. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9689. depend on the smooth type. @var{param1} and
  9690. @var{param2} accept integer positive values or 0. @var{param3} and
  9691. @var{param4} accept floating point values.
  9692. The default value for @var{param1} is 3. The default value for the
  9693. other parameters is 0.
  9694. These parameters correspond to the parameters assigned to the
  9695. libopencv function @code{cvSmooth}.
  9696. @section oscilloscope
  9697. 2D Video Oscilloscope.
  9698. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9699. It accepts the following parameters:
  9700. @table @option
  9701. @item x
  9702. Set scope center x position.
  9703. @item y
  9704. Set scope center y position.
  9705. @item s
  9706. Set scope size, relative to frame diagonal.
  9707. @item t
  9708. Set scope tilt/rotation.
  9709. @item o
  9710. Set trace opacity.
  9711. @item tx
  9712. Set trace center x position.
  9713. @item ty
  9714. Set trace center y position.
  9715. @item tw
  9716. Set trace width, relative to width of frame.
  9717. @item th
  9718. Set trace height, relative to height of frame.
  9719. @item c
  9720. Set which components to trace. By default it traces first three components.
  9721. @item g
  9722. Draw trace grid. By default is enabled.
  9723. @item st
  9724. Draw some statistics. By default is enabled.
  9725. @item sc
  9726. Draw scope. By default is enabled.
  9727. @end table
  9728. @subsection Examples
  9729. @itemize
  9730. @item
  9731. Inspect full first row of video frame.
  9732. @example
  9733. oscilloscope=x=0.5:y=0:s=1
  9734. @end example
  9735. @item
  9736. Inspect full last row of video frame.
  9737. @example
  9738. oscilloscope=x=0.5:y=1:s=1
  9739. @end example
  9740. @item
  9741. Inspect full 5th line of video frame of height 1080.
  9742. @example
  9743. oscilloscope=x=0.5:y=5/1080:s=1
  9744. @end example
  9745. @item
  9746. Inspect full last column of video frame.
  9747. @example
  9748. oscilloscope=x=1:y=0.5:s=1:t=1
  9749. @end example
  9750. @end itemize
  9751. @anchor{overlay}
  9752. @section overlay
  9753. Overlay one video on top of another.
  9754. It takes two inputs and has one output. The first input is the "main"
  9755. video on which the second input is overlaid.
  9756. It accepts the following parameters:
  9757. A description of the accepted options follows.
  9758. @table @option
  9759. @item x
  9760. @item y
  9761. Set the expression for the x and y coordinates of the overlaid video
  9762. on the main video. Default value is "0" for both expressions. In case
  9763. the expression is invalid, it is set to a huge value (meaning that the
  9764. overlay will not be displayed within the output visible area).
  9765. @item eof_action
  9766. See @ref{framesync}.
  9767. @item eval
  9768. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9769. It accepts the following values:
  9770. @table @samp
  9771. @item init
  9772. only evaluate expressions once during the filter initialization or
  9773. when a command is processed
  9774. @item frame
  9775. evaluate expressions for each incoming frame
  9776. @end table
  9777. Default value is @samp{frame}.
  9778. @item shortest
  9779. See @ref{framesync}.
  9780. @item format
  9781. Set the format for the output video.
  9782. It accepts the following values:
  9783. @table @samp
  9784. @item yuv420
  9785. force YUV420 output
  9786. @item yuv422
  9787. force YUV422 output
  9788. @item yuv444
  9789. force YUV444 output
  9790. @item rgb
  9791. force packed RGB output
  9792. @item gbrp
  9793. force planar RGB output
  9794. @item auto
  9795. automatically pick format
  9796. @end table
  9797. Default value is @samp{yuv420}.
  9798. @item repeatlast
  9799. See @ref{framesync}.
  9800. @item alpha
  9801. Set format of alpha of the overlaid video, it can be @var{straight} or
  9802. @var{premultiplied}. Default is @var{straight}.
  9803. @end table
  9804. The @option{x}, and @option{y} expressions can contain the following
  9805. parameters.
  9806. @table @option
  9807. @item main_w, W
  9808. @item main_h, H
  9809. The main input width and height.
  9810. @item overlay_w, w
  9811. @item overlay_h, h
  9812. The overlay input width and height.
  9813. @item x
  9814. @item y
  9815. The computed values for @var{x} and @var{y}. They are evaluated for
  9816. each new frame.
  9817. @item hsub
  9818. @item vsub
  9819. horizontal and vertical chroma subsample values of the output
  9820. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9821. @var{vsub} is 1.
  9822. @item n
  9823. the number of input frame, starting from 0
  9824. @item pos
  9825. the position in the file of the input frame, NAN if unknown
  9826. @item t
  9827. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9828. @end table
  9829. This filter also supports the @ref{framesync} options.
  9830. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9831. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9832. when @option{eval} is set to @samp{init}.
  9833. Be aware that frames are taken from each input video in timestamp
  9834. order, hence, if their initial timestamps differ, it is a good idea
  9835. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9836. have them begin in the same zero timestamp, as the example for
  9837. the @var{movie} filter does.
  9838. You can chain together more overlays but you should test the
  9839. efficiency of such approach.
  9840. @subsection Commands
  9841. This filter supports the following commands:
  9842. @table @option
  9843. @item x
  9844. @item y
  9845. Modify the x and y of the overlay input.
  9846. The command accepts the same syntax of the corresponding option.
  9847. If the specified expression is not valid, it is kept at its current
  9848. value.
  9849. @end table
  9850. @subsection Examples
  9851. @itemize
  9852. @item
  9853. Draw the overlay at 10 pixels from the bottom right corner of the main
  9854. video:
  9855. @example
  9856. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9857. @end example
  9858. Using named options the example above becomes:
  9859. @example
  9860. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9861. @end example
  9862. @item
  9863. Insert a transparent PNG logo in the bottom left corner of the input,
  9864. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9865. @example
  9866. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9867. @end example
  9868. @item
  9869. Insert 2 different transparent PNG logos (second logo on bottom
  9870. right corner) using the @command{ffmpeg} tool:
  9871. @example
  9872. 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
  9873. @end example
  9874. @item
  9875. Add a transparent color layer on top of the main video; @code{WxH}
  9876. must specify the size of the main input to the overlay filter:
  9877. @example
  9878. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9879. @end example
  9880. @item
  9881. Play an original video and a filtered version (here with the deshake
  9882. filter) side by side using the @command{ffplay} tool:
  9883. @example
  9884. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9885. @end example
  9886. The above command is the same as:
  9887. @example
  9888. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9889. @end example
  9890. @item
  9891. Make a sliding overlay appearing from the left to the right top part of the
  9892. screen starting since time 2:
  9893. @example
  9894. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9895. @end example
  9896. @item
  9897. Compose output by putting two input videos side to side:
  9898. @example
  9899. ffmpeg -i left.avi -i right.avi -filter_complex "
  9900. nullsrc=size=200x100 [background];
  9901. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9902. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9903. [background][left] overlay=shortest=1 [background+left];
  9904. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9905. "
  9906. @end example
  9907. @item
  9908. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9909. @example
  9910. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9911. -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]'
  9912. masked.avi
  9913. @end example
  9914. @item
  9915. Chain several overlays in cascade:
  9916. @example
  9917. nullsrc=s=200x200 [bg];
  9918. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9919. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9920. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9921. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9922. [in3] null, [mid2] overlay=100:100 [out0]
  9923. @end example
  9924. @end itemize
  9925. @section owdenoise
  9926. Apply Overcomplete Wavelet denoiser.
  9927. The filter accepts the following options:
  9928. @table @option
  9929. @item depth
  9930. Set depth.
  9931. Larger depth values will denoise lower frequency components more, but
  9932. slow down filtering.
  9933. Must be an int in the range 8-16, default is @code{8}.
  9934. @item luma_strength, ls
  9935. Set luma strength.
  9936. Must be a double value in the range 0-1000, default is @code{1.0}.
  9937. @item chroma_strength, cs
  9938. Set chroma strength.
  9939. Must be a double value in the range 0-1000, default is @code{1.0}.
  9940. @end table
  9941. @anchor{pad}
  9942. @section pad
  9943. Add paddings to the input image, and place the original input at the
  9944. provided @var{x}, @var{y} coordinates.
  9945. It accepts the following parameters:
  9946. @table @option
  9947. @item width, w
  9948. @item height, h
  9949. Specify an expression for the size of the output image with the
  9950. paddings added. If the value for @var{width} or @var{height} is 0, the
  9951. corresponding input size is used for the output.
  9952. The @var{width} expression can reference the value set by the
  9953. @var{height} expression, and vice versa.
  9954. The default value of @var{width} and @var{height} is 0.
  9955. @item x
  9956. @item y
  9957. Specify the offsets to place the input image at within the padded area,
  9958. with respect to the top/left border of the output image.
  9959. The @var{x} expression can reference the value set by the @var{y}
  9960. expression, and vice versa.
  9961. The default value of @var{x} and @var{y} is 0.
  9962. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9963. so the input image is centered on the padded area.
  9964. @item color
  9965. Specify the color of the padded area. For the syntax of this option,
  9966. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9967. manual,ffmpeg-utils}.
  9968. The default value of @var{color} is "black".
  9969. @item eval
  9970. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9971. It accepts the following values:
  9972. @table @samp
  9973. @item init
  9974. Only evaluate expressions once during the filter initialization or when
  9975. a command is processed.
  9976. @item frame
  9977. Evaluate expressions for each incoming frame.
  9978. @end table
  9979. Default value is @samp{init}.
  9980. @item aspect
  9981. Pad to aspect instead to a resolution.
  9982. @end table
  9983. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9984. options are expressions containing the following constants:
  9985. @table @option
  9986. @item in_w
  9987. @item in_h
  9988. The input video width and height.
  9989. @item iw
  9990. @item ih
  9991. These are the same as @var{in_w} and @var{in_h}.
  9992. @item out_w
  9993. @item out_h
  9994. The output width and height (the size of the padded area), as
  9995. specified by the @var{width} and @var{height} expressions.
  9996. @item ow
  9997. @item oh
  9998. These are the same as @var{out_w} and @var{out_h}.
  9999. @item x
  10000. @item y
  10001. The x and y offsets as specified by the @var{x} and @var{y}
  10002. expressions, or NAN if not yet specified.
  10003. @item a
  10004. same as @var{iw} / @var{ih}
  10005. @item sar
  10006. input sample aspect ratio
  10007. @item dar
  10008. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10009. @item hsub
  10010. @item vsub
  10011. The horizontal and vertical chroma subsample values. For example for the
  10012. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10013. @end table
  10014. @subsection Examples
  10015. @itemize
  10016. @item
  10017. Add paddings with the color "violet" to the input video. The output video
  10018. size is 640x480, and the top-left corner of the input video is placed at
  10019. column 0, row 40
  10020. @example
  10021. pad=640:480:0:40:violet
  10022. @end example
  10023. The example above is equivalent to the following command:
  10024. @example
  10025. pad=width=640:height=480:x=0:y=40:color=violet
  10026. @end example
  10027. @item
  10028. Pad the input to get an output with dimensions increased by 3/2,
  10029. and put the input video at the center of the padded area:
  10030. @example
  10031. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10032. @end example
  10033. @item
  10034. Pad the input to get a squared output with size equal to the maximum
  10035. value between the input width and height, and put the input video at
  10036. the center of the padded area:
  10037. @example
  10038. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10039. @end example
  10040. @item
  10041. Pad the input to get a final w/h ratio of 16:9:
  10042. @example
  10043. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10044. @end example
  10045. @item
  10046. In case of anamorphic video, in order to set the output display aspect
  10047. correctly, it is necessary to use @var{sar} in the expression,
  10048. according to the relation:
  10049. @example
  10050. (ih * X / ih) * sar = output_dar
  10051. X = output_dar / sar
  10052. @end example
  10053. Thus the previous example needs to be modified to:
  10054. @example
  10055. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10056. @end example
  10057. @item
  10058. Double the output size and put the input video in the bottom-right
  10059. corner of the output padded area:
  10060. @example
  10061. pad="2*iw:2*ih:ow-iw:oh-ih"
  10062. @end example
  10063. @end itemize
  10064. @anchor{palettegen}
  10065. @section palettegen
  10066. Generate one palette for a whole video stream.
  10067. It accepts the following options:
  10068. @table @option
  10069. @item max_colors
  10070. Set the maximum number of colors to quantize in the palette.
  10071. Note: the palette will still contain 256 colors; the unused palette entries
  10072. will be black.
  10073. @item reserve_transparent
  10074. Create a palette of 255 colors maximum and reserve the last one for
  10075. transparency. Reserving the transparency color is useful for GIF optimization.
  10076. If not set, the maximum of colors in the palette will be 256. You probably want
  10077. to disable this option for a standalone image.
  10078. Set by default.
  10079. @item transparency_color
  10080. Set the color that will be used as background for transparency.
  10081. @item stats_mode
  10082. Set statistics mode.
  10083. It accepts the following values:
  10084. @table @samp
  10085. @item full
  10086. Compute full frame histograms.
  10087. @item diff
  10088. Compute histograms only for the part that differs from previous frame. This
  10089. might be relevant to give more importance to the moving part of your input if
  10090. the background is static.
  10091. @item single
  10092. Compute new histogram for each frame.
  10093. @end table
  10094. Default value is @var{full}.
  10095. @end table
  10096. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10097. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10098. color quantization of the palette. This information is also visible at
  10099. @var{info} logging level.
  10100. @subsection Examples
  10101. @itemize
  10102. @item
  10103. Generate a representative palette of a given video using @command{ffmpeg}:
  10104. @example
  10105. ffmpeg -i input.mkv -vf palettegen palette.png
  10106. @end example
  10107. @end itemize
  10108. @section paletteuse
  10109. Use a palette to downsample an input video stream.
  10110. The filter takes two inputs: one video stream and a palette. The palette must
  10111. be a 256 pixels image.
  10112. It accepts the following options:
  10113. @table @option
  10114. @item dither
  10115. Select dithering mode. Available algorithms are:
  10116. @table @samp
  10117. @item bayer
  10118. Ordered 8x8 bayer dithering (deterministic)
  10119. @item heckbert
  10120. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10121. Note: this dithering is sometimes considered "wrong" and is included as a
  10122. reference.
  10123. @item floyd_steinberg
  10124. Floyd and Steingberg dithering (error diffusion)
  10125. @item sierra2
  10126. Frankie Sierra dithering v2 (error diffusion)
  10127. @item sierra2_4a
  10128. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10129. @end table
  10130. Default is @var{sierra2_4a}.
  10131. @item bayer_scale
  10132. When @var{bayer} dithering is selected, this option defines the scale of the
  10133. pattern (how much the crosshatch pattern is visible). A low value means more
  10134. visible pattern for less banding, and higher value means less visible pattern
  10135. at the cost of more banding.
  10136. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10137. @item diff_mode
  10138. If set, define the zone to process
  10139. @table @samp
  10140. @item rectangle
  10141. Only the changing rectangle will be reprocessed. This is similar to GIF
  10142. cropping/offsetting compression mechanism. This option can be useful for speed
  10143. if only a part of the image is changing, and has use cases such as limiting the
  10144. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10145. moving scene (it leads to more deterministic output if the scene doesn't change
  10146. much, and as a result less moving noise and better GIF compression).
  10147. @end table
  10148. Default is @var{none}.
  10149. @item new
  10150. Take new palette for each output frame.
  10151. @item alpha_threshold
  10152. Sets the alpha threshold for transparency. Alpha values above this threshold
  10153. will be treated as completely opaque, and values below this threshold will be
  10154. treated as completely transparent.
  10155. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10156. @end table
  10157. @subsection Examples
  10158. @itemize
  10159. @item
  10160. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10161. using @command{ffmpeg}:
  10162. @example
  10163. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10164. @end example
  10165. @end itemize
  10166. @section perspective
  10167. Correct perspective of video not recorded perpendicular to the screen.
  10168. A description of the accepted parameters follows.
  10169. @table @option
  10170. @item x0
  10171. @item y0
  10172. @item x1
  10173. @item y1
  10174. @item x2
  10175. @item y2
  10176. @item x3
  10177. @item y3
  10178. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10179. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10180. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10181. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10182. then the corners of the source will be sent to the specified coordinates.
  10183. The expressions can use the following variables:
  10184. @table @option
  10185. @item W
  10186. @item H
  10187. the width and height of video frame.
  10188. @item in
  10189. Input frame count.
  10190. @item on
  10191. Output frame count.
  10192. @end table
  10193. @item interpolation
  10194. Set interpolation for perspective correction.
  10195. It accepts the following values:
  10196. @table @samp
  10197. @item linear
  10198. @item cubic
  10199. @end table
  10200. Default value is @samp{linear}.
  10201. @item sense
  10202. Set interpretation of coordinate options.
  10203. It accepts the following values:
  10204. @table @samp
  10205. @item 0, source
  10206. Send point in the source specified by the given coordinates to
  10207. the corners of the destination.
  10208. @item 1, destination
  10209. Send the corners of the source to the point in the destination specified
  10210. by the given coordinates.
  10211. Default value is @samp{source}.
  10212. @end table
  10213. @item eval
  10214. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10215. It accepts the following values:
  10216. @table @samp
  10217. @item init
  10218. only evaluate expressions once during the filter initialization or
  10219. when a command is processed
  10220. @item frame
  10221. evaluate expressions for each incoming frame
  10222. @end table
  10223. Default value is @samp{init}.
  10224. @end table
  10225. @section phase
  10226. Delay interlaced video by one field time so that the field order changes.
  10227. The intended use is to fix PAL movies that have been captured with the
  10228. opposite field order to the film-to-video transfer.
  10229. A description of the accepted parameters follows.
  10230. @table @option
  10231. @item mode
  10232. Set phase mode.
  10233. It accepts the following values:
  10234. @table @samp
  10235. @item t
  10236. Capture field order top-first, transfer bottom-first.
  10237. Filter will delay the bottom field.
  10238. @item b
  10239. Capture field order bottom-first, transfer top-first.
  10240. Filter will delay the top field.
  10241. @item p
  10242. Capture and transfer with the same field order. This mode only exists
  10243. for the documentation of the other options to refer to, but if you
  10244. actually select it, the filter will faithfully do nothing.
  10245. @item a
  10246. Capture field order determined automatically by field flags, transfer
  10247. opposite.
  10248. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10249. basis using field flags. If no field information is available,
  10250. then this works just like @samp{u}.
  10251. @item u
  10252. Capture unknown or varying, transfer opposite.
  10253. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10254. analyzing the images and selecting the alternative that produces best
  10255. match between the fields.
  10256. @item T
  10257. Capture top-first, transfer unknown or varying.
  10258. Filter selects among @samp{t} and @samp{p} using image analysis.
  10259. @item B
  10260. Capture bottom-first, transfer unknown or varying.
  10261. Filter selects among @samp{b} and @samp{p} using image analysis.
  10262. @item A
  10263. Capture determined by field flags, transfer unknown or varying.
  10264. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10265. image analysis. If no field information is available, then this works just
  10266. like @samp{U}. This is the default mode.
  10267. @item U
  10268. Both capture and transfer unknown or varying.
  10269. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10270. @end table
  10271. @end table
  10272. @section pixdesctest
  10273. Pixel format descriptor test filter, mainly useful for internal
  10274. testing. The output video should be equal to the input video.
  10275. For example:
  10276. @example
  10277. format=monow, pixdesctest
  10278. @end example
  10279. can be used to test the monowhite pixel format descriptor definition.
  10280. @section pixscope
  10281. Display sample values of color channels. Mainly useful for checking color
  10282. and levels. Minimum supported resolution is 640x480.
  10283. The filters accept the following options:
  10284. @table @option
  10285. @item x
  10286. Set scope X position, relative offset on X axis.
  10287. @item y
  10288. Set scope Y position, relative offset on Y axis.
  10289. @item w
  10290. Set scope width.
  10291. @item h
  10292. Set scope height.
  10293. @item o
  10294. Set window opacity. This window also holds statistics about pixel area.
  10295. @item wx
  10296. Set window X position, relative offset on X axis.
  10297. @item wy
  10298. Set window Y position, relative offset on Y axis.
  10299. @end table
  10300. @section pp
  10301. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10302. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10303. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10304. Each subfilter and some options have a short and a long name that can be used
  10305. interchangeably, i.e. dr/dering are the same.
  10306. The filters accept the following options:
  10307. @table @option
  10308. @item subfilters
  10309. Set postprocessing subfilters string.
  10310. @end table
  10311. All subfilters share common options to determine their scope:
  10312. @table @option
  10313. @item a/autoq
  10314. Honor the quality commands for this subfilter.
  10315. @item c/chrom
  10316. Do chrominance filtering, too (default).
  10317. @item y/nochrom
  10318. Do luminance filtering only (no chrominance).
  10319. @item n/noluma
  10320. Do chrominance filtering only (no luminance).
  10321. @end table
  10322. These options can be appended after the subfilter name, separated by a '|'.
  10323. Available subfilters are:
  10324. @table @option
  10325. @item hb/hdeblock[|difference[|flatness]]
  10326. Horizontal deblocking filter
  10327. @table @option
  10328. @item difference
  10329. Difference factor where higher values mean more deblocking (default: @code{32}).
  10330. @item flatness
  10331. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10332. @end table
  10333. @item vb/vdeblock[|difference[|flatness]]
  10334. Vertical deblocking filter
  10335. @table @option
  10336. @item difference
  10337. Difference factor where higher values mean more deblocking (default: @code{32}).
  10338. @item flatness
  10339. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10340. @end table
  10341. @item ha/hadeblock[|difference[|flatness]]
  10342. Accurate horizontal deblocking filter
  10343. @table @option
  10344. @item difference
  10345. Difference factor where higher values mean more deblocking (default: @code{32}).
  10346. @item flatness
  10347. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10348. @end table
  10349. @item va/vadeblock[|difference[|flatness]]
  10350. Accurate vertical deblocking filter
  10351. @table @option
  10352. @item difference
  10353. Difference factor where higher values mean more deblocking (default: @code{32}).
  10354. @item flatness
  10355. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10356. @end table
  10357. @end table
  10358. The horizontal and vertical deblocking filters share the difference and
  10359. flatness values so you cannot set different horizontal and vertical
  10360. thresholds.
  10361. @table @option
  10362. @item h1/x1hdeblock
  10363. Experimental horizontal deblocking filter
  10364. @item v1/x1vdeblock
  10365. Experimental vertical deblocking filter
  10366. @item dr/dering
  10367. Deringing filter
  10368. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10369. @table @option
  10370. @item threshold1
  10371. larger -> stronger filtering
  10372. @item threshold2
  10373. larger -> stronger filtering
  10374. @item threshold3
  10375. larger -> stronger filtering
  10376. @end table
  10377. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10378. @table @option
  10379. @item f/fullyrange
  10380. Stretch luminance to @code{0-255}.
  10381. @end table
  10382. @item lb/linblenddeint
  10383. Linear blend deinterlacing filter that deinterlaces the given block by
  10384. filtering all lines with a @code{(1 2 1)} filter.
  10385. @item li/linipoldeint
  10386. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10387. linearly interpolating every second line.
  10388. @item ci/cubicipoldeint
  10389. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10390. cubically interpolating every second line.
  10391. @item md/mediandeint
  10392. Median deinterlacing filter that deinterlaces the given block by applying a
  10393. median filter to every second line.
  10394. @item fd/ffmpegdeint
  10395. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10396. second line with a @code{(-1 4 2 4 -1)} filter.
  10397. @item l5/lowpass5
  10398. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10399. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10400. @item fq/forceQuant[|quantizer]
  10401. Overrides the quantizer table from the input with the constant quantizer you
  10402. specify.
  10403. @table @option
  10404. @item quantizer
  10405. Quantizer to use
  10406. @end table
  10407. @item de/default
  10408. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10409. @item fa/fast
  10410. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10411. @item ac
  10412. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10413. @end table
  10414. @subsection Examples
  10415. @itemize
  10416. @item
  10417. Apply horizontal and vertical deblocking, deringing and automatic
  10418. brightness/contrast:
  10419. @example
  10420. pp=hb/vb/dr/al
  10421. @end example
  10422. @item
  10423. Apply default filters without brightness/contrast correction:
  10424. @example
  10425. pp=de/-al
  10426. @end example
  10427. @item
  10428. Apply default filters and temporal denoiser:
  10429. @example
  10430. pp=default/tmpnoise|1|2|3
  10431. @end example
  10432. @item
  10433. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10434. automatically depending on available CPU time:
  10435. @example
  10436. pp=hb|y/vb|a
  10437. @end example
  10438. @end itemize
  10439. @section pp7
  10440. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10441. similar to spp = 6 with 7 point DCT, where only the center sample is
  10442. used after IDCT.
  10443. The filter accepts the following options:
  10444. @table @option
  10445. @item qp
  10446. Force a constant quantization parameter. It accepts an integer in range
  10447. 0 to 63. If not set, the filter will use the QP from the video stream
  10448. (if available).
  10449. @item mode
  10450. Set thresholding mode. Available modes are:
  10451. @table @samp
  10452. @item hard
  10453. Set hard thresholding.
  10454. @item soft
  10455. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10456. @item medium
  10457. Set medium thresholding (good results, default).
  10458. @end table
  10459. @end table
  10460. @section premultiply
  10461. Apply alpha premultiply effect to input video stream using first plane
  10462. of second stream as alpha.
  10463. Both streams must have same dimensions and same pixel format.
  10464. The filter accepts the following option:
  10465. @table @option
  10466. @item planes
  10467. Set which planes will be processed, unprocessed planes will be copied.
  10468. By default value 0xf, all planes will be processed.
  10469. @item inplace
  10470. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10471. @end table
  10472. @section prewitt
  10473. Apply prewitt operator to input video stream.
  10474. The filter accepts the following option:
  10475. @table @option
  10476. @item planes
  10477. Set which planes will be processed, unprocessed planes will be copied.
  10478. By default value 0xf, all planes will be processed.
  10479. @item scale
  10480. Set value which will be multiplied with filtered result.
  10481. @item delta
  10482. Set value which will be added to filtered result.
  10483. @end table
  10484. @anchor{program_opencl}
  10485. @section program_opencl
  10486. Filter video using an OpenCL program.
  10487. @table @option
  10488. @item source
  10489. OpenCL program source file.
  10490. @item kernel
  10491. Kernel name in program.
  10492. @item inputs
  10493. Number of inputs to the filter. Defaults to 1.
  10494. @item size, s
  10495. Size of output frames. Defaults to the same as the first input.
  10496. @end table
  10497. The program source file must contain a kernel function with the given name,
  10498. which will be run once for each plane of the output. Each run on a plane
  10499. gets enqueued as a separate 2D global NDRange with one work-item for each
  10500. pixel to be generated. The global ID offset for each work-item is therefore
  10501. the coordinates of a pixel in the destination image.
  10502. The kernel function needs to take the following arguments:
  10503. @itemize
  10504. @item
  10505. Destination image, @var{__write_only image2d_t}.
  10506. This image will become the output; the kernel should write all of it.
  10507. @item
  10508. Frame index, @var{unsigned int}.
  10509. This is a counter starting from zero and increasing by one for each frame.
  10510. @item
  10511. Source images, @var{__read_only image2d_t}.
  10512. These are the most recent images on each input. The kernel may read from
  10513. them to generate the output, but they can't be written to.
  10514. @end itemize
  10515. Example programs:
  10516. @itemize
  10517. @item
  10518. Copy the input to the output (output must be the same size as the input).
  10519. @verbatim
  10520. __kernel void copy(__write_only image2d_t destination,
  10521. unsigned int index,
  10522. __read_only image2d_t source)
  10523. {
  10524. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10525. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10526. float4 value = read_imagef(source, sampler, location);
  10527. write_imagef(destination, location, value);
  10528. }
  10529. @end verbatim
  10530. @item
  10531. Apply a simple transformation, rotating the input by an amount increasing
  10532. with the index counter. Pixel values are linearly interpolated by the
  10533. sampler, and the output need not have the same dimensions as the input.
  10534. @verbatim
  10535. __kernel void rotate_image(__write_only image2d_t dst,
  10536. unsigned int index,
  10537. __read_only image2d_t src)
  10538. {
  10539. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10540. CLK_FILTER_LINEAR);
  10541. float angle = (float)index / 100.0f;
  10542. float2 dst_dim = convert_float2(get_image_dim(dst));
  10543. float2 src_dim = convert_float2(get_image_dim(src));
  10544. float2 dst_cen = dst_dim / 2.0f;
  10545. float2 src_cen = src_dim / 2.0f;
  10546. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10547. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10548. float2 src_pos = {
  10549. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10550. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10551. };
  10552. src_pos = src_pos * src_dim / dst_dim;
  10553. float2 src_loc = src_pos + src_cen;
  10554. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10555. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10556. write_imagef(dst, dst_loc, 0.5f);
  10557. else
  10558. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10559. }
  10560. @end verbatim
  10561. @item
  10562. Blend two inputs together, with the amount of each input used varying
  10563. with the index counter.
  10564. @verbatim
  10565. __kernel void blend_images(__write_only image2d_t dst,
  10566. unsigned int index,
  10567. __read_only image2d_t src1,
  10568. __read_only image2d_t src2)
  10569. {
  10570. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10571. CLK_FILTER_LINEAR);
  10572. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10573. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10574. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10575. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10576. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10577. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10578. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10579. }
  10580. @end verbatim
  10581. @end itemize
  10582. @section pseudocolor
  10583. Alter frame colors in video with pseudocolors.
  10584. This filter accept the following options:
  10585. @table @option
  10586. @item c0
  10587. set pixel first component expression
  10588. @item c1
  10589. set pixel second component expression
  10590. @item c2
  10591. set pixel third component expression
  10592. @item c3
  10593. set pixel fourth component expression, corresponds to the alpha component
  10594. @item i
  10595. set component to use as base for altering colors
  10596. @end table
  10597. Each of them specifies the expression to use for computing the lookup table for
  10598. the corresponding pixel component values.
  10599. The expressions can contain the following constants and functions:
  10600. @table @option
  10601. @item w
  10602. @item h
  10603. The input width and height.
  10604. @item val
  10605. The input value for the pixel component.
  10606. @item ymin, umin, vmin, amin
  10607. The minimum allowed component value.
  10608. @item ymax, umax, vmax, amax
  10609. The maximum allowed component value.
  10610. @end table
  10611. All expressions default to "val".
  10612. @subsection Examples
  10613. @itemize
  10614. @item
  10615. Change too high luma values to gradient:
  10616. @example
  10617. 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'"
  10618. @end example
  10619. @end itemize
  10620. @section psnr
  10621. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10622. Ratio) between two input videos.
  10623. This filter takes in input two input videos, the first input is
  10624. considered the "main" source and is passed unchanged to the
  10625. output. The second input is used as a "reference" video for computing
  10626. the PSNR.
  10627. Both video inputs must have the same resolution and pixel format for
  10628. this filter to work correctly. Also it assumes that both inputs
  10629. have the same number of frames, which are compared one by one.
  10630. The obtained average PSNR is printed through the logging system.
  10631. The filter stores the accumulated MSE (mean squared error) of each
  10632. frame, and at the end of the processing it is averaged across all frames
  10633. equally, and the following formula is applied to obtain the PSNR:
  10634. @example
  10635. PSNR = 10*log10(MAX^2/MSE)
  10636. @end example
  10637. Where MAX is the average of the maximum values of each component of the
  10638. image.
  10639. The description of the accepted parameters follows.
  10640. @table @option
  10641. @item stats_file, f
  10642. If specified the filter will use the named file to save the PSNR of
  10643. each individual frame. When filename equals "-" the data is sent to
  10644. standard output.
  10645. @item stats_version
  10646. Specifies which version of the stats file format to use. Details of
  10647. each format are written below.
  10648. Default value is 1.
  10649. @item stats_add_max
  10650. Determines whether the max value is output to the stats log.
  10651. Default value is 0.
  10652. Requires stats_version >= 2. If this is set and stats_version < 2,
  10653. the filter will return an error.
  10654. @end table
  10655. This filter also supports the @ref{framesync} options.
  10656. The file printed if @var{stats_file} is selected, contains a sequence of
  10657. key/value pairs of the form @var{key}:@var{value} for each compared
  10658. couple of frames.
  10659. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10660. the list of per-frame-pair stats, with key value pairs following the frame
  10661. format with the following parameters:
  10662. @table @option
  10663. @item psnr_log_version
  10664. The version of the log file format. Will match @var{stats_version}.
  10665. @item fields
  10666. A comma separated list of the per-frame-pair parameters included in
  10667. the log.
  10668. @end table
  10669. A description of each shown per-frame-pair parameter follows:
  10670. @table @option
  10671. @item n
  10672. sequential number of the input frame, starting from 1
  10673. @item mse_avg
  10674. Mean Square Error pixel-by-pixel average difference of the compared
  10675. frames, averaged over all the image components.
  10676. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10677. Mean Square Error pixel-by-pixel average difference of the compared
  10678. frames for the component specified by the suffix.
  10679. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10680. Peak Signal to Noise ratio of the compared frames for the component
  10681. specified by the suffix.
  10682. @item max_avg, max_y, max_u, max_v
  10683. Maximum allowed value for each channel, and average over all
  10684. channels.
  10685. @end table
  10686. For example:
  10687. @example
  10688. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10689. [main][ref] psnr="stats_file=stats.log" [out]
  10690. @end example
  10691. On this example the input file being processed is compared with the
  10692. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10693. is stored in @file{stats.log}.
  10694. @anchor{pullup}
  10695. @section pullup
  10696. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10697. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10698. content.
  10699. The pullup filter is designed to take advantage of future context in making
  10700. its decisions. This filter is stateless in the sense that it does not lock
  10701. onto a pattern to follow, but it instead looks forward to the following
  10702. fields in order to identify matches and rebuild progressive frames.
  10703. To produce content with an even framerate, insert the fps filter after
  10704. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10705. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10706. The filter accepts the following options:
  10707. @table @option
  10708. @item jl
  10709. @item jr
  10710. @item jt
  10711. @item jb
  10712. These options set the amount of "junk" to ignore at the left, right, top, and
  10713. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10714. while top and bottom are in units of 2 lines.
  10715. The default is 8 pixels on each side.
  10716. @item sb
  10717. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10718. filter generating an occasional mismatched frame, but it may also cause an
  10719. excessive number of frames to be dropped during high motion sequences.
  10720. Conversely, setting it to -1 will make filter match fields more easily.
  10721. This may help processing of video where there is slight blurring between
  10722. the fields, but may also cause there to be interlaced frames in the output.
  10723. Default value is @code{0}.
  10724. @item mp
  10725. Set the metric plane to use. It accepts the following values:
  10726. @table @samp
  10727. @item l
  10728. Use luma plane.
  10729. @item u
  10730. Use chroma blue plane.
  10731. @item v
  10732. Use chroma red plane.
  10733. @end table
  10734. This option may be set to use chroma plane instead of the default luma plane
  10735. for doing filter's computations. This may improve accuracy on very clean
  10736. source material, but more likely will decrease accuracy, especially if there
  10737. is chroma noise (rainbow effect) or any grayscale video.
  10738. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10739. load and make pullup usable in realtime on slow machines.
  10740. @end table
  10741. For best results (without duplicated frames in the output file) it is
  10742. necessary to change the output frame rate. For example, to inverse
  10743. telecine NTSC input:
  10744. @example
  10745. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10746. @end example
  10747. @section qp
  10748. Change video quantization parameters (QP).
  10749. The filter accepts the following option:
  10750. @table @option
  10751. @item qp
  10752. Set expression for quantization parameter.
  10753. @end table
  10754. The expression is evaluated through the eval API and can contain, among others,
  10755. the following constants:
  10756. @table @var
  10757. @item known
  10758. 1 if index is not 129, 0 otherwise.
  10759. @item qp
  10760. Sequential index starting from -129 to 128.
  10761. @end table
  10762. @subsection Examples
  10763. @itemize
  10764. @item
  10765. Some equation like:
  10766. @example
  10767. qp=2+2*sin(PI*qp)
  10768. @end example
  10769. @end itemize
  10770. @section random
  10771. Flush video frames from internal cache of frames into a random order.
  10772. No frame is discarded.
  10773. Inspired by @ref{frei0r} nervous filter.
  10774. @table @option
  10775. @item frames
  10776. Set size in number of frames of internal cache, in range from @code{2} to
  10777. @code{512}. Default is @code{30}.
  10778. @item seed
  10779. Set seed for random number generator, must be an integer included between
  10780. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10781. less than @code{0}, the filter will try to use a good random seed on a
  10782. best effort basis.
  10783. @end table
  10784. @section readeia608
  10785. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10786. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10787. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10788. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10789. @table @option
  10790. @item lavfi.readeia608.X.cc
  10791. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10792. @item lavfi.readeia608.X.line
  10793. The number of the line on which the EIA-608 data was identified and read.
  10794. @end table
  10795. This filter accepts the following options:
  10796. @table @option
  10797. @item scan_min
  10798. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10799. @item scan_max
  10800. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10801. @item mac
  10802. Set minimal acceptable amplitude change for sync codes detection.
  10803. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10804. @item spw
  10805. Set the ratio of width reserved for sync code detection.
  10806. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10807. @item mhd
  10808. Set the max peaks height difference for sync code detection.
  10809. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10810. @item mpd
  10811. Set max peaks period difference for sync code detection.
  10812. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10813. @item msd
  10814. Set the first two max start code bits differences.
  10815. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10816. @item bhd
  10817. Set the minimum ratio of bits height compared to 3rd start code bit.
  10818. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10819. @item th_w
  10820. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10821. @item th_b
  10822. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10823. @item chp
  10824. Enable checking the parity bit. In the event of a parity error, the filter will output
  10825. @code{0x00} for that character. Default is false.
  10826. @end table
  10827. @subsection Examples
  10828. @itemize
  10829. @item
  10830. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10831. @example
  10832. 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
  10833. @end example
  10834. @end itemize
  10835. @section readvitc
  10836. Read vertical interval timecode (VITC) information from the top lines of a
  10837. video frame.
  10838. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10839. timecode value, if a valid timecode has been detected. Further metadata key
  10840. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10841. timecode data has been found or not.
  10842. This filter accepts the following options:
  10843. @table @option
  10844. @item scan_max
  10845. Set the maximum number of lines to scan for VITC data. If the value is set to
  10846. @code{-1} the full video frame is scanned. Default is @code{45}.
  10847. @item thr_b
  10848. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10849. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10850. @item thr_w
  10851. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10852. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10853. @end table
  10854. @subsection Examples
  10855. @itemize
  10856. @item
  10857. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10858. draw @code{--:--:--:--} as a placeholder:
  10859. @example
  10860. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10861. @end example
  10862. @end itemize
  10863. @section remap
  10864. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10865. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10866. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10867. value for pixel will be used for destination pixel.
  10868. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10869. will have Xmap/Ymap video stream dimensions.
  10870. Xmap and Ymap input video streams are 16bit depth, single channel.
  10871. @section removegrain
  10872. The removegrain filter is a spatial denoiser for progressive video.
  10873. @table @option
  10874. @item m0
  10875. Set mode for the first plane.
  10876. @item m1
  10877. Set mode for the second plane.
  10878. @item m2
  10879. Set mode for the third plane.
  10880. @item m3
  10881. Set mode for the fourth plane.
  10882. @end table
  10883. Range of mode is from 0 to 24. Description of each mode follows:
  10884. @table @var
  10885. @item 0
  10886. Leave input plane unchanged. Default.
  10887. @item 1
  10888. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10889. @item 2
  10890. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10891. @item 3
  10892. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10893. @item 4
  10894. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10895. This is equivalent to a median filter.
  10896. @item 5
  10897. Line-sensitive clipping giving the minimal change.
  10898. @item 6
  10899. Line-sensitive clipping, intermediate.
  10900. @item 7
  10901. Line-sensitive clipping, intermediate.
  10902. @item 8
  10903. Line-sensitive clipping, intermediate.
  10904. @item 9
  10905. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10906. @item 10
  10907. Replaces the target pixel with the closest neighbour.
  10908. @item 11
  10909. [1 2 1] horizontal and vertical kernel blur.
  10910. @item 12
  10911. Same as mode 11.
  10912. @item 13
  10913. Bob mode, interpolates top field from the line where the neighbours
  10914. pixels are the closest.
  10915. @item 14
  10916. Bob mode, interpolates bottom field from the line where the neighbours
  10917. pixels are the closest.
  10918. @item 15
  10919. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10920. interpolation formula.
  10921. @item 16
  10922. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10923. interpolation formula.
  10924. @item 17
  10925. Clips the pixel with the minimum and maximum of respectively the maximum and
  10926. minimum of each pair of opposite neighbour pixels.
  10927. @item 18
  10928. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10929. the current pixel is minimal.
  10930. @item 19
  10931. Replaces the pixel with the average of its 8 neighbours.
  10932. @item 20
  10933. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10934. @item 21
  10935. Clips pixels using the averages of opposite neighbour.
  10936. @item 22
  10937. Same as mode 21 but simpler and faster.
  10938. @item 23
  10939. Small edge and halo removal, but reputed useless.
  10940. @item 24
  10941. Similar as 23.
  10942. @end table
  10943. @section removelogo
  10944. Suppress a TV station logo, using an image file to determine which
  10945. pixels comprise the logo. It works by filling in the pixels that
  10946. comprise the logo with neighboring pixels.
  10947. The filter accepts the following options:
  10948. @table @option
  10949. @item filename, f
  10950. Set the filter bitmap file, which can be any image format supported by
  10951. libavformat. The width and height of the image file must match those of the
  10952. video stream being processed.
  10953. @end table
  10954. Pixels in the provided bitmap image with a value of zero are not
  10955. considered part of the logo, non-zero pixels are considered part of
  10956. the logo. If you use white (255) for the logo and black (0) for the
  10957. rest, you will be safe. For making the filter bitmap, it is
  10958. recommended to take a screen capture of a black frame with the logo
  10959. visible, and then using a threshold filter followed by the erode
  10960. filter once or twice.
  10961. If needed, little splotches can be fixed manually. Remember that if
  10962. logo pixels are not covered, the filter quality will be much
  10963. reduced. Marking too many pixels as part of the logo does not hurt as
  10964. much, but it will increase the amount of blurring needed to cover over
  10965. the image and will destroy more information than necessary, and extra
  10966. pixels will slow things down on a large logo.
  10967. @section repeatfields
  10968. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10969. fields based on its value.
  10970. @section reverse
  10971. Reverse a video clip.
  10972. Warning: This filter requires memory to buffer the entire clip, so trimming
  10973. is suggested.
  10974. @subsection Examples
  10975. @itemize
  10976. @item
  10977. Take the first 5 seconds of a clip, and reverse it.
  10978. @example
  10979. trim=end=5,reverse
  10980. @end example
  10981. @end itemize
  10982. @section rgbashift
  10983. Shift R/G/B/A pixels horizontally and/or vertically.
  10984. The filter accepts the following options:
  10985. @table @option
  10986. @item rh
  10987. Set amount to shift red horizontally.
  10988. @item rv
  10989. Set amount to shift red vertically.
  10990. @item gh
  10991. Set amount to shift green horizontally.
  10992. @item gv
  10993. Set amount to shift green vertically.
  10994. @item bh
  10995. Set amount to shift blue horizontally.
  10996. @item bv
  10997. Set amount to shift blue vertically.
  10998. @item ah
  10999. Set amount to shift alpha horizontally.
  11000. @item av
  11001. Set amount to shift alpha vertically.
  11002. @item edge
  11003. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11004. @end table
  11005. @section roberts
  11006. Apply roberts cross operator to input video stream.
  11007. The filter accepts the following option:
  11008. @table @option
  11009. @item planes
  11010. Set which planes will be processed, unprocessed planes will be copied.
  11011. By default value 0xf, all planes will be processed.
  11012. @item scale
  11013. Set value which will be multiplied with filtered result.
  11014. @item delta
  11015. Set value which will be added to filtered result.
  11016. @end table
  11017. @section rotate
  11018. Rotate video by an arbitrary angle expressed in radians.
  11019. The filter accepts the following options:
  11020. A description of the optional parameters follows.
  11021. @table @option
  11022. @item angle, a
  11023. Set an expression for the angle by which to rotate the input video
  11024. clockwise, expressed as a number of radians. A negative value will
  11025. result in a counter-clockwise rotation. By default it is set to "0".
  11026. This expression is evaluated for each frame.
  11027. @item out_w, ow
  11028. Set the output width expression, default value is "iw".
  11029. This expression is evaluated just once during configuration.
  11030. @item out_h, oh
  11031. Set the output height expression, default value is "ih".
  11032. This expression is evaluated just once during configuration.
  11033. @item bilinear
  11034. Enable bilinear interpolation if set to 1, a value of 0 disables
  11035. it. Default value is 1.
  11036. @item fillcolor, c
  11037. Set the color used to fill the output area not covered by the rotated
  11038. image. For the general syntax of this option, check the
  11039. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11040. If the special value "none" is selected then no
  11041. background is printed (useful for example if the background is never shown).
  11042. Default value is "black".
  11043. @end table
  11044. The expressions for the angle and the output size can contain the
  11045. following constants and functions:
  11046. @table @option
  11047. @item n
  11048. sequential number of the input frame, starting from 0. It is always NAN
  11049. before the first frame is filtered.
  11050. @item t
  11051. time in seconds of the input frame, it is set to 0 when the filter is
  11052. configured. It is always NAN before the first frame is filtered.
  11053. @item hsub
  11054. @item vsub
  11055. horizontal and vertical chroma subsample values. For example for the
  11056. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11057. @item in_w, iw
  11058. @item in_h, ih
  11059. the input video width and height
  11060. @item out_w, ow
  11061. @item out_h, oh
  11062. the output width and height, that is the size of the padded area as
  11063. specified by the @var{width} and @var{height} expressions
  11064. @item rotw(a)
  11065. @item roth(a)
  11066. the minimal width/height required for completely containing the input
  11067. video rotated by @var{a} radians.
  11068. These are only available when computing the @option{out_w} and
  11069. @option{out_h} expressions.
  11070. @end table
  11071. @subsection Examples
  11072. @itemize
  11073. @item
  11074. Rotate the input by PI/6 radians clockwise:
  11075. @example
  11076. rotate=PI/6
  11077. @end example
  11078. @item
  11079. Rotate the input by PI/6 radians counter-clockwise:
  11080. @example
  11081. rotate=-PI/6
  11082. @end example
  11083. @item
  11084. Rotate the input by 45 degrees clockwise:
  11085. @example
  11086. rotate=45*PI/180
  11087. @end example
  11088. @item
  11089. Apply a constant rotation with period T, starting from an angle of PI/3:
  11090. @example
  11091. rotate=PI/3+2*PI*t/T
  11092. @end example
  11093. @item
  11094. Make the input video rotation oscillating with a period of T
  11095. seconds and an amplitude of A radians:
  11096. @example
  11097. rotate=A*sin(2*PI/T*t)
  11098. @end example
  11099. @item
  11100. Rotate the video, output size is chosen so that the whole rotating
  11101. input video is always completely contained in the output:
  11102. @example
  11103. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11104. @end example
  11105. @item
  11106. Rotate the video, reduce the output size so that no background is ever
  11107. shown:
  11108. @example
  11109. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11110. @end example
  11111. @end itemize
  11112. @subsection Commands
  11113. The filter supports the following commands:
  11114. @table @option
  11115. @item a, angle
  11116. Set the angle expression.
  11117. The command accepts the same syntax of the corresponding option.
  11118. If the specified expression is not valid, it is kept at its current
  11119. value.
  11120. @end table
  11121. @section sab
  11122. Apply Shape Adaptive Blur.
  11123. The filter accepts the following options:
  11124. @table @option
  11125. @item luma_radius, lr
  11126. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11127. value is 1.0. A greater value will result in a more blurred image, and
  11128. in slower processing.
  11129. @item luma_pre_filter_radius, lpfr
  11130. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11131. value is 1.0.
  11132. @item luma_strength, ls
  11133. Set luma maximum difference between pixels to still be considered, must
  11134. be a value in the 0.1-100.0 range, default value is 1.0.
  11135. @item chroma_radius, cr
  11136. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11137. greater value will result in a more blurred image, and in slower
  11138. processing.
  11139. @item chroma_pre_filter_radius, cpfr
  11140. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11141. @item chroma_strength, cs
  11142. Set chroma maximum difference between pixels to still be considered,
  11143. must be a value in the -0.9-100.0 range.
  11144. @end table
  11145. Each chroma option value, if not explicitly specified, is set to the
  11146. corresponding luma option value.
  11147. @anchor{scale}
  11148. @section scale
  11149. Scale (resize) the input video, using the libswscale library.
  11150. The scale filter forces the output display aspect ratio to be the same
  11151. of the input, by changing the output sample aspect ratio.
  11152. If the input image format is different from the format requested by
  11153. the next filter, the scale filter will convert the input to the
  11154. requested format.
  11155. @subsection Options
  11156. The filter accepts the following options, or any of the options
  11157. supported by the libswscale scaler.
  11158. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11159. the complete list of scaler options.
  11160. @table @option
  11161. @item width, w
  11162. @item height, h
  11163. Set the output video dimension expression. Default value is the input
  11164. dimension.
  11165. If the @var{width} or @var{w} value is 0, the input width is used for
  11166. the output. If the @var{height} or @var{h} value is 0, the input height
  11167. is used for the output.
  11168. If one and only one of the values is -n with n >= 1, the scale filter
  11169. will use a value that maintains the aspect ratio of the input image,
  11170. calculated from the other specified dimension. After that it will,
  11171. however, make sure that the calculated dimension is divisible by n and
  11172. adjust the value if necessary.
  11173. If both values are -n with n >= 1, the behavior will be identical to
  11174. both values being set to 0 as previously detailed.
  11175. See below for the list of accepted constants for use in the dimension
  11176. expression.
  11177. @item eval
  11178. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11179. @table @samp
  11180. @item init
  11181. Only evaluate expressions once during the filter initialization or when a command is processed.
  11182. @item frame
  11183. Evaluate expressions for each incoming frame.
  11184. @end table
  11185. Default value is @samp{init}.
  11186. @item interl
  11187. Set the interlacing mode. It accepts the following values:
  11188. @table @samp
  11189. @item 1
  11190. Force interlaced aware scaling.
  11191. @item 0
  11192. Do not apply interlaced scaling.
  11193. @item -1
  11194. Select interlaced aware scaling depending on whether the source frames
  11195. are flagged as interlaced or not.
  11196. @end table
  11197. Default value is @samp{0}.
  11198. @item flags
  11199. Set libswscale scaling flags. See
  11200. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11201. complete list of values. If not explicitly specified the filter applies
  11202. the default flags.
  11203. @item param0, param1
  11204. Set libswscale input parameters for scaling algorithms that need them. See
  11205. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11206. complete documentation. If not explicitly specified the filter applies
  11207. empty parameters.
  11208. @item size, s
  11209. Set the video size. For the syntax of this option, check the
  11210. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11211. @item in_color_matrix
  11212. @item out_color_matrix
  11213. Set in/output YCbCr color space type.
  11214. This allows the autodetected value to be overridden as well as allows forcing
  11215. a specific value used for the output and encoder.
  11216. If not specified, the color space type depends on the pixel format.
  11217. Possible values:
  11218. @table @samp
  11219. @item auto
  11220. Choose automatically.
  11221. @item bt709
  11222. Format conforming to International Telecommunication Union (ITU)
  11223. Recommendation BT.709.
  11224. @item fcc
  11225. Set color space conforming to the United States Federal Communications
  11226. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11227. @item bt601
  11228. Set color space conforming to:
  11229. @itemize
  11230. @item
  11231. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11232. @item
  11233. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11234. @item
  11235. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11236. @end itemize
  11237. @item smpte240m
  11238. Set color space conforming to SMPTE ST 240:1999.
  11239. @end table
  11240. @item in_range
  11241. @item out_range
  11242. Set in/output YCbCr sample range.
  11243. This allows the autodetected value to be overridden as well as allows forcing
  11244. a specific value used for the output and encoder. If not specified, the
  11245. range depends on the pixel format. Possible values:
  11246. @table @samp
  11247. @item auto/unknown
  11248. Choose automatically.
  11249. @item jpeg/full/pc
  11250. Set full range (0-255 in case of 8-bit luma).
  11251. @item mpeg/limited/tv
  11252. Set "MPEG" range (16-235 in case of 8-bit luma).
  11253. @end table
  11254. @item force_original_aspect_ratio
  11255. Enable decreasing or increasing output video width or height if necessary to
  11256. keep the original aspect ratio. Possible values:
  11257. @table @samp
  11258. @item disable
  11259. Scale the video as specified and disable this feature.
  11260. @item decrease
  11261. The output video dimensions will automatically be decreased if needed.
  11262. @item increase
  11263. The output video dimensions will automatically be increased if needed.
  11264. @end table
  11265. One useful instance of this option is that when you know a specific device's
  11266. maximum allowed resolution, you can use this to limit the output video to
  11267. that, while retaining the aspect ratio. For example, device A allows
  11268. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11269. decrease) and specifying 1280x720 to the command line makes the output
  11270. 1280x533.
  11271. Please note that this is a different thing than specifying -1 for @option{w}
  11272. or @option{h}, you still need to specify the output resolution for this option
  11273. to work.
  11274. @end table
  11275. The values of the @option{w} and @option{h} options are expressions
  11276. containing the following constants:
  11277. @table @var
  11278. @item in_w
  11279. @item in_h
  11280. The input width and height
  11281. @item iw
  11282. @item ih
  11283. These are the same as @var{in_w} and @var{in_h}.
  11284. @item out_w
  11285. @item out_h
  11286. The output (scaled) width and height
  11287. @item ow
  11288. @item oh
  11289. These are the same as @var{out_w} and @var{out_h}
  11290. @item a
  11291. The same as @var{iw} / @var{ih}
  11292. @item sar
  11293. input sample aspect ratio
  11294. @item dar
  11295. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11296. @item hsub
  11297. @item vsub
  11298. horizontal and vertical input chroma subsample values. For example for the
  11299. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11300. @item ohsub
  11301. @item ovsub
  11302. horizontal and vertical output chroma subsample values. For example for the
  11303. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11304. @end table
  11305. @subsection Examples
  11306. @itemize
  11307. @item
  11308. Scale the input video to a size of 200x100
  11309. @example
  11310. scale=w=200:h=100
  11311. @end example
  11312. This is equivalent to:
  11313. @example
  11314. scale=200:100
  11315. @end example
  11316. or:
  11317. @example
  11318. scale=200x100
  11319. @end example
  11320. @item
  11321. Specify a size abbreviation for the output size:
  11322. @example
  11323. scale=qcif
  11324. @end example
  11325. which can also be written as:
  11326. @example
  11327. scale=size=qcif
  11328. @end example
  11329. @item
  11330. Scale the input to 2x:
  11331. @example
  11332. scale=w=2*iw:h=2*ih
  11333. @end example
  11334. @item
  11335. The above is the same as:
  11336. @example
  11337. scale=2*in_w:2*in_h
  11338. @end example
  11339. @item
  11340. Scale the input to 2x with forced interlaced scaling:
  11341. @example
  11342. scale=2*iw:2*ih:interl=1
  11343. @end example
  11344. @item
  11345. Scale the input to half size:
  11346. @example
  11347. scale=w=iw/2:h=ih/2
  11348. @end example
  11349. @item
  11350. Increase the width, and set the height to the same size:
  11351. @example
  11352. scale=3/2*iw:ow
  11353. @end example
  11354. @item
  11355. Seek Greek harmony:
  11356. @example
  11357. scale=iw:1/PHI*iw
  11358. scale=ih*PHI:ih
  11359. @end example
  11360. @item
  11361. Increase the height, and set the width to 3/2 of the height:
  11362. @example
  11363. scale=w=3/2*oh:h=3/5*ih
  11364. @end example
  11365. @item
  11366. Increase the size, making the size a multiple of the chroma
  11367. subsample values:
  11368. @example
  11369. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11370. @end example
  11371. @item
  11372. Increase the width to a maximum of 500 pixels,
  11373. keeping the same aspect ratio as the input:
  11374. @example
  11375. scale=w='min(500\, iw*3/2):h=-1'
  11376. @end example
  11377. @item
  11378. Make pixels square by combining scale and setsar:
  11379. @example
  11380. scale='trunc(ih*dar):ih',setsar=1/1
  11381. @end example
  11382. @item
  11383. Make pixels square by combining scale and setsar,
  11384. making sure the resulting resolution is even (required by some codecs):
  11385. @example
  11386. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11387. @end example
  11388. @end itemize
  11389. @subsection Commands
  11390. This filter supports the following commands:
  11391. @table @option
  11392. @item width, w
  11393. @item height, h
  11394. Set the output video dimension expression.
  11395. The command accepts the same syntax of the corresponding option.
  11396. If the specified expression is not valid, it is kept at its current
  11397. value.
  11398. @end table
  11399. @section scale_npp
  11400. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11401. format conversion on CUDA video frames. Setting the output width and height
  11402. works in the same way as for the @var{scale} filter.
  11403. The following additional options are accepted:
  11404. @table @option
  11405. @item format
  11406. The pixel format of the output CUDA frames. If set to the string "same" (the
  11407. default), the input format will be kept. Note that automatic format negotiation
  11408. and conversion is not yet supported for hardware frames
  11409. @item interp_algo
  11410. The interpolation algorithm used for resizing. One of the following:
  11411. @table @option
  11412. @item nn
  11413. Nearest neighbour.
  11414. @item linear
  11415. @item cubic
  11416. @item cubic2p_bspline
  11417. 2-parameter cubic (B=1, C=0)
  11418. @item cubic2p_catmullrom
  11419. 2-parameter cubic (B=0, C=1/2)
  11420. @item cubic2p_b05c03
  11421. 2-parameter cubic (B=1/2, C=3/10)
  11422. @item super
  11423. Supersampling
  11424. @item lanczos
  11425. @end table
  11426. @end table
  11427. @section scale2ref
  11428. Scale (resize) the input video, based on a reference video.
  11429. See the scale filter for available options, scale2ref supports the same but
  11430. uses the reference video instead of the main input as basis. scale2ref also
  11431. supports the following additional constants for the @option{w} and
  11432. @option{h} options:
  11433. @table @var
  11434. @item main_w
  11435. @item main_h
  11436. The main input video's width and height
  11437. @item main_a
  11438. The same as @var{main_w} / @var{main_h}
  11439. @item main_sar
  11440. The main input video's sample aspect ratio
  11441. @item main_dar, mdar
  11442. The main input video's display aspect ratio. Calculated from
  11443. @code{(main_w / main_h) * main_sar}.
  11444. @item main_hsub
  11445. @item main_vsub
  11446. The main input video's horizontal and vertical chroma subsample values.
  11447. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11448. is 1.
  11449. @end table
  11450. @subsection Examples
  11451. @itemize
  11452. @item
  11453. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11454. @example
  11455. 'scale2ref[b][a];[a][b]overlay'
  11456. @end example
  11457. @end itemize
  11458. @anchor{selectivecolor}
  11459. @section selectivecolor
  11460. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11461. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11462. by the "purity" of the color (that is, how saturated it already is).
  11463. This filter is similar to the Adobe Photoshop Selective Color tool.
  11464. The filter accepts the following options:
  11465. @table @option
  11466. @item correction_method
  11467. Select color correction method.
  11468. Available values are:
  11469. @table @samp
  11470. @item absolute
  11471. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11472. component value).
  11473. @item relative
  11474. Specified adjustments are relative to the original component value.
  11475. @end table
  11476. Default is @code{absolute}.
  11477. @item reds
  11478. Adjustments for red pixels (pixels where the red component is the maximum)
  11479. @item yellows
  11480. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11481. @item greens
  11482. Adjustments for green pixels (pixels where the green component is the maximum)
  11483. @item cyans
  11484. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11485. @item blues
  11486. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11487. @item magentas
  11488. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11489. @item whites
  11490. Adjustments for white pixels (pixels where all components are greater than 128)
  11491. @item neutrals
  11492. Adjustments for all pixels except pure black and pure white
  11493. @item blacks
  11494. Adjustments for black pixels (pixels where all components are lesser than 128)
  11495. @item psfile
  11496. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11497. @end table
  11498. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11499. 4 space separated floating point adjustment values in the [-1,1] range,
  11500. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11501. pixels of its range.
  11502. @subsection Examples
  11503. @itemize
  11504. @item
  11505. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11506. increase magenta by 27% in blue areas:
  11507. @example
  11508. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11509. @end example
  11510. @item
  11511. Use a Photoshop selective color preset:
  11512. @example
  11513. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11514. @end example
  11515. @end itemize
  11516. @anchor{separatefields}
  11517. @section separatefields
  11518. The @code{separatefields} takes a frame-based video input and splits
  11519. each frame into its components fields, producing a new half height clip
  11520. with twice the frame rate and twice the frame count.
  11521. This filter use field-dominance information in frame to decide which
  11522. of each pair of fields to place first in the output.
  11523. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11524. @section setdar, setsar
  11525. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11526. output video.
  11527. This is done by changing the specified Sample (aka Pixel) Aspect
  11528. Ratio, according to the following equation:
  11529. @example
  11530. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11531. @end example
  11532. Keep in mind that the @code{setdar} filter does not modify the pixel
  11533. dimensions of the video frame. Also, the display aspect ratio set by
  11534. this filter may be changed by later filters in the filterchain,
  11535. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11536. applied.
  11537. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11538. the filter output video.
  11539. Note that as a consequence of the application of this filter, the
  11540. output display aspect ratio will change according to the equation
  11541. above.
  11542. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11543. filter may be changed by later filters in the filterchain, e.g. if
  11544. another "setsar" or a "setdar" filter is applied.
  11545. It accepts the following parameters:
  11546. @table @option
  11547. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11548. Set the aspect ratio used by the filter.
  11549. The parameter can be a floating point number string, an expression, or
  11550. a string of the form @var{num}:@var{den}, where @var{num} and
  11551. @var{den} are the numerator and denominator of the aspect ratio. If
  11552. the parameter is not specified, it is assumed the value "0".
  11553. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11554. should be escaped.
  11555. @item max
  11556. Set the maximum integer value to use for expressing numerator and
  11557. denominator when reducing the expressed aspect ratio to a rational.
  11558. Default value is @code{100}.
  11559. @end table
  11560. The parameter @var{sar} is an expression containing
  11561. the following constants:
  11562. @table @option
  11563. @item E, PI, PHI
  11564. These are approximated values for the mathematical constants e
  11565. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11566. @item w, h
  11567. The input width and height.
  11568. @item a
  11569. These are the same as @var{w} / @var{h}.
  11570. @item sar
  11571. The input sample aspect ratio.
  11572. @item dar
  11573. The input display aspect ratio. It is the same as
  11574. (@var{w} / @var{h}) * @var{sar}.
  11575. @item hsub, vsub
  11576. Horizontal and vertical chroma subsample values. For example, for the
  11577. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11578. @end table
  11579. @subsection Examples
  11580. @itemize
  11581. @item
  11582. To change the display aspect ratio to 16:9, specify one of the following:
  11583. @example
  11584. setdar=dar=1.77777
  11585. setdar=dar=16/9
  11586. @end example
  11587. @item
  11588. To change the sample aspect ratio to 10:11, specify:
  11589. @example
  11590. setsar=sar=10/11
  11591. @end example
  11592. @item
  11593. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11594. 1000 in the aspect ratio reduction, use the command:
  11595. @example
  11596. setdar=ratio=16/9:max=1000
  11597. @end example
  11598. @end itemize
  11599. @anchor{setfield}
  11600. @section setfield
  11601. Force field for the output video frame.
  11602. The @code{setfield} filter marks the interlace type field for the
  11603. output frames. It does not change the input frame, but only sets the
  11604. corresponding property, which affects how the frame is treated by
  11605. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11606. The filter accepts the following options:
  11607. @table @option
  11608. @item mode
  11609. Available values are:
  11610. @table @samp
  11611. @item auto
  11612. Keep the same field property.
  11613. @item bff
  11614. Mark the frame as bottom-field-first.
  11615. @item tff
  11616. Mark the frame as top-field-first.
  11617. @item prog
  11618. Mark the frame as progressive.
  11619. @end table
  11620. @end table
  11621. @anchor{setparams}
  11622. @section setparams
  11623. Force frame parameter for the output video frame.
  11624. The @code{setparams} filter marks interlace and color range for the
  11625. output frames. It does not change the input frame, but only sets the
  11626. corresponding property, which affects how the frame is treated by
  11627. filters/encoders.
  11628. @table @option
  11629. @item field_mode
  11630. Available values are:
  11631. @table @samp
  11632. @item auto
  11633. Keep the same field property (default).
  11634. @item bff
  11635. Mark the frame as bottom-field-first.
  11636. @item tff
  11637. Mark the frame as top-field-first.
  11638. @item prog
  11639. Mark the frame as progressive.
  11640. @end table
  11641. @item range
  11642. Available values are:
  11643. @table @samp
  11644. @item auto
  11645. Keep the same color range property (default).
  11646. @item unspecified, unknown
  11647. Mark the frame as unspecified color range.
  11648. @item limited, tv, mpeg
  11649. Mark the frame as limited range.
  11650. @item full, pc, jpeg
  11651. Mark the frame as full range.
  11652. @end table
  11653. @item color_primaries
  11654. Set the color primaries.
  11655. Available values are:
  11656. @table @samp
  11657. @item auto
  11658. Keep the same color primaries property (default).
  11659. @item bt709
  11660. @item unknown
  11661. @item bt470m
  11662. @item bt470bg
  11663. @item smpte170m
  11664. @item smpte240m
  11665. @item film
  11666. @item bt2020
  11667. @item smpte428
  11668. @item smpte431
  11669. @item smpte432
  11670. @item jedec-p22
  11671. @end table
  11672. @item color_trc
  11673. Set the color transfert.
  11674. Available values are:
  11675. @table @samp
  11676. @item auto
  11677. Keep the same color trc property (default).
  11678. @item bt709
  11679. @item unknown
  11680. @item bt470m
  11681. @item bt470bg
  11682. @item smpte170m
  11683. @item smpte240m
  11684. @item linear
  11685. @item log100
  11686. @item log316
  11687. @item iec61966-2-4
  11688. @item bt1361e
  11689. @item iec61966-2-1
  11690. @item bt2020-10
  11691. @item bt2020-12
  11692. @item smpte2084
  11693. @item smpte428
  11694. @item arib-std-b67
  11695. @end table
  11696. @item colorspace
  11697. Set the colorspace.
  11698. Available values are:
  11699. @table @samp
  11700. @item auto
  11701. Keep the same colorspace property (default).
  11702. @item gbr
  11703. @item bt709
  11704. @item unknown
  11705. @item fcc
  11706. @item bt470bg
  11707. @item smpte170m
  11708. @item smpte240m
  11709. @item ycgco
  11710. @item bt2020nc
  11711. @item bt2020c
  11712. @item smpte2085
  11713. @item chroma-derived-nc
  11714. @item chroma-derived-c
  11715. @item ictcp
  11716. @end table
  11717. @end table
  11718. @section showinfo
  11719. Show a line containing various information for each input video frame.
  11720. The input video is not modified.
  11721. This filter supports the following options:
  11722. @table @option
  11723. @item checksum
  11724. Calculate checksums of each plane. By default enabled.
  11725. @end table
  11726. The shown line contains a sequence of key/value pairs of the form
  11727. @var{key}:@var{value}.
  11728. The following values are shown in the output:
  11729. @table @option
  11730. @item n
  11731. The (sequential) number of the input frame, starting from 0.
  11732. @item pts
  11733. The Presentation TimeStamp of the input frame, expressed as a number of
  11734. time base units. The time base unit depends on the filter input pad.
  11735. @item pts_time
  11736. The Presentation TimeStamp of the input frame, expressed as a number of
  11737. seconds.
  11738. @item pos
  11739. The position of the frame in the input stream, or -1 if this information is
  11740. unavailable and/or meaningless (for example in case of synthetic video).
  11741. @item fmt
  11742. The pixel format name.
  11743. @item sar
  11744. The sample aspect ratio of the input frame, expressed in the form
  11745. @var{num}/@var{den}.
  11746. @item s
  11747. The size of the input frame. For the syntax of this option, check the
  11748. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11749. @item i
  11750. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11751. for bottom field first).
  11752. @item iskey
  11753. This is 1 if the frame is a key frame, 0 otherwise.
  11754. @item type
  11755. The picture type of the input frame ("I" for an I-frame, "P" for a
  11756. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11757. Also refer to the documentation of the @code{AVPictureType} enum and of
  11758. the @code{av_get_picture_type_char} function defined in
  11759. @file{libavutil/avutil.h}.
  11760. @item checksum
  11761. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11762. @item plane_checksum
  11763. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11764. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11765. @end table
  11766. @section showpalette
  11767. Displays the 256 colors palette of each frame. This filter is only relevant for
  11768. @var{pal8} pixel format frames.
  11769. It accepts the following option:
  11770. @table @option
  11771. @item s
  11772. Set the size of the box used to represent one palette color entry. Default is
  11773. @code{30} (for a @code{30x30} pixel box).
  11774. @end table
  11775. @section shuffleframes
  11776. Reorder and/or duplicate and/or drop video frames.
  11777. It accepts the following parameters:
  11778. @table @option
  11779. @item mapping
  11780. Set the destination indexes of input frames.
  11781. This is space or '|' separated list of indexes that maps input frames to output
  11782. frames. Number of indexes also sets maximal value that each index may have.
  11783. '-1' index have special meaning and that is to drop frame.
  11784. @end table
  11785. The first frame has the index 0. The default is to keep the input unchanged.
  11786. @subsection Examples
  11787. @itemize
  11788. @item
  11789. Swap second and third frame of every three frames of the input:
  11790. @example
  11791. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11792. @end example
  11793. @item
  11794. Swap 10th and 1st frame of every ten frames of the input:
  11795. @example
  11796. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11797. @end example
  11798. @end itemize
  11799. @section shuffleplanes
  11800. Reorder and/or duplicate video planes.
  11801. It accepts the following parameters:
  11802. @table @option
  11803. @item map0
  11804. The index of the input plane to be used as the first output plane.
  11805. @item map1
  11806. The index of the input plane to be used as the second output plane.
  11807. @item map2
  11808. The index of the input plane to be used as the third output plane.
  11809. @item map3
  11810. The index of the input plane to be used as the fourth output plane.
  11811. @end table
  11812. The first plane has the index 0. The default is to keep the input unchanged.
  11813. @subsection Examples
  11814. @itemize
  11815. @item
  11816. Swap the second and third planes of the input:
  11817. @example
  11818. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11819. @end example
  11820. @end itemize
  11821. @anchor{signalstats}
  11822. @section signalstats
  11823. Evaluate various visual metrics that assist in determining issues associated
  11824. with the digitization of analog video media.
  11825. By default the filter will log these metadata values:
  11826. @table @option
  11827. @item YMIN
  11828. Display the minimal Y value contained within the input frame. Expressed in
  11829. range of [0-255].
  11830. @item YLOW
  11831. Display the Y value at the 10% percentile within the input frame. Expressed in
  11832. range of [0-255].
  11833. @item YAVG
  11834. Display the average Y value within the input frame. Expressed in range of
  11835. [0-255].
  11836. @item YHIGH
  11837. Display the Y value at the 90% percentile within the input frame. Expressed in
  11838. range of [0-255].
  11839. @item YMAX
  11840. Display the maximum Y value contained within the input frame. Expressed in
  11841. range of [0-255].
  11842. @item UMIN
  11843. Display the minimal U value contained within the input frame. Expressed in
  11844. range of [0-255].
  11845. @item ULOW
  11846. Display the U value at the 10% percentile within the input frame. Expressed in
  11847. range of [0-255].
  11848. @item UAVG
  11849. Display the average U value within the input frame. Expressed in range of
  11850. [0-255].
  11851. @item UHIGH
  11852. Display the U value at the 90% percentile within the input frame. Expressed in
  11853. range of [0-255].
  11854. @item UMAX
  11855. Display the maximum U value contained within the input frame. Expressed in
  11856. range of [0-255].
  11857. @item VMIN
  11858. Display the minimal V value contained within the input frame. Expressed in
  11859. range of [0-255].
  11860. @item VLOW
  11861. Display the V value at the 10% percentile within the input frame. Expressed in
  11862. range of [0-255].
  11863. @item VAVG
  11864. Display the average V value within the input frame. Expressed in range of
  11865. [0-255].
  11866. @item VHIGH
  11867. Display the V value at the 90% percentile within the input frame. Expressed in
  11868. range of [0-255].
  11869. @item VMAX
  11870. Display the maximum V value contained within the input frame. Expressed in
  11871. range of [0-255].
  11872. @item SATMIN
  11873. Display the minimal saturation value contained within the input frame.
  11874. Expressed in range of [0-~181.02].
  11875. @item SATLOW
  11876. Display the saturation value at the 10% percentile within the input frame.
  11877. Expressed in range of [0-~181.02].
  11878. @item SATAVG
  11879. Display the average saturation value within the input frame. Expressed in range
  11880. of [0-~181.02].
  11881. @item SATHIGH
  11882. Display the saturation value at the 90% percentile within the input frame.
  11883. Expressed in range of [0-~181.02].
  11884. @item SATMAX
  11885. Display the maximum saturation value contained within the input frame.
  11886. Expressed in range of [0-~181.02].
  11887. @item HUEMED
  11888. Display the median value for hue within the input frame. Expressed in range of
  11889. [0-360].
  11890. @item HUEAVG
  11891. Display the average value for hue within the input frame. Expressed in range of
  11892. [0-360].
  11893. @item YDIF
  11894. Display the average of sample value difference between all values of the Y
  11895. plane in the current frame and corresponding values of the previous input frame.
  11896. Expressed in range of [0-255].
  11897. @item UDIF
  11898. Display the average of sample value difference between all values of the U
  11899. plane in the current frame and corresponding values of the previous input frame.
  11900. Expressed in range of [0-255].
  11901. @item VDIF
  11902. Display the average of sample value difference between all values of the V
  11903. plane in the current frame and corresponding values of the previous input frame.
  11904. Expressed in range of [0-255].
  11905. @item YBITDEPTH
  11906. Display bit depth of Y plane in current frame.
  11907. Expressed in range of [0-16].
  11908. @item UBITDEPTH
  11909. Display bit depth of U plane in current frame.
  11910. Expressed in range of [0-16].
  11911. @item VBITDEPTH
  11912. Display bit depth of V plane in current frame.
  11913. Expressed in range of [0-16].
  11914. @end table
  11915. The filter accepts the following options:
  11916. @table @option
  11917. @item stat
  11918. @item out
  11919. @option{stat} specify an additional form of image analysis.
  11920. @option{out} output video with the specified type of pixel highlighted.
  11921. Both options accept the following values:
  11922. @table @samp
  11923. @item tout
  11924. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11925. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11926. include the results of video dropouts, head clogs, or tape tracking issues.
  11927. @item vrep
  11928. Identify @var{vertical line repetition}. Vertical line repetition includes
  11929. similar rows of pixels within a frame. In born-digital video vertical line
  11930. repetition is common, but this pattern is uncommon in video digitized from an
  11931. analog source. When it occurs in video that results from the digitization of an
  11932. analog source it can indicate concealment from a dropout compensator.
  11933. @item brng
  11934. Identify pixels that fall outside of legal broadcast range.
  11935. @end table
  11936. @item color, c
  11937. Set the highlight color for the @option{out} option. The default color is
  11938. yellow.
  11939. @end table
  11940. @subsection Examples
  11941. @itemize
  11942. @item
  11943. Output data of various video metrics:
  11944. @example
  11945. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11946. @end example
  11947. @item
  11948. Output specific data about the minimum and maximum values of the Y plane per frame:
  11949. @example
  11950. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11951. @end example
  11952. @item
  11953. Playback video while highlighting pixels that are outside of broadcast range in red.
  11954. @example
  11955. ffplay example.mov -vf signalstats="out=brng:color=red"
  11956. @end example
  11957. @item
  11958. Playback video with signalstats metadata drawn over the frame.
  11959. @example
  11960. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11961. @end example
  11962. The contents of signalstat_drawtext.txt used in the command are:
  11963. @example
  11964. time %@{pts:hms@}
  11965. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11966. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11967. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11968. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11969. @end example
  11970. @end itemize
  11971. @anchor{signature}
  11972. @section signature
  11973. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11974. input. In this case the matching between the inputs can be calculated additionally.
  11975. The filter always passes through the first input. The signature of each stream can
  11976. be written into a file.
  11977. It accepts the following options:
  11978. @table @option
  11979. @item detectmode
  11980. Enable or disable the matching process.
  11981. Available values are:
  11982. @table @samp
  11983. @item off
  11984. Disable the calculation of a matching (default).
  11985. @item full
  11986. Calculate the matching for the whole video and output whether the whole video
  11987. matches or only parts.
  11988. @item fast
  11989. Calculate only until a matching is found or the video ends. Should be faster in
  11990. some cases.
  11991. @end table
  11992. @item nb_inputs
  11993. Set the number of inputs. The option value must be a non negative integer.
  11994. Default value is 1.
  11995. @item filename
  11996. Set the path to which the output is written. If there is more than one input,
  11997. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11998. integer), that will be replaced with the input number. If no filename is
  11999. specified, no output will be written. This is the default.
  12000. @item format
  12001. Choose the output format.
  12002. Available values are:
  12003. @table @samp
  12004. @item binary
  12005. Use the specified binary representation (default).
  12006. @item xml
  12007. Use the specified xml representation.
  12008. @end table
  12009. @item th_d
  12010. Set threshold to detect one word as similar. The option value must be an integer
  12011. greater than zero. The default value is 9000.
  12012. @item th_dc
  12013. Set threshold to detect all words as similar. The option value must be an integer
  12014. greater than zero. The default value is 60000.
  12015. @item th_xh
  12016. Set threshold to detect frames as similar. The option value must be an integer
  12017. greater than zero. The default value is 116.
  12018. @item th_di
  12019. Set the minimum length of a sequence in frames to recognize it as matching
  12020. sequence. The option value must be a non negative integer value.
  12021. The default value is 0.
  12022. @item th_it
  12023. Set the minimum relation, that matching frames to all frames must have.
  12024. The option value must be a double value between 0 and 1. The default value is 0.5.
  12025. @end table
  12026. @subsection Examples
  12027. @itemize
  12028. @item
  12029. To calculate the signature of an input video and store it in signature.bin:
  12030. @example
  12031. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12032. @end example
  12033. @item
  12034. To detect whether two videos match and store the signatures in XML format in
  12035. signature0.xml and signature1.xml:
  12036. @example
  12037. 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 -
  12038. @end example
  12039. @end itemize
  12040. @anchor{smartblur}
  12041. @section smartblur
  12042. Blur the input video without impacting the outlines.
  12043. It accepts the following options:
  12044. @table @option
  12045. @item luma_radius, lr
  12046. Set the luma radius. The option value must be a float number in
  12047. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12048. used to blur the image (slower if larger). Default value is 1.0.
  12049. @item luma_strength, ls
  12050. Set the luma strength. The option value must be a float number
  12051. in the range [-1.0,1.0] that configures the blurring. A value included
  12052. in [0.0,1.0] will blur the image whereas a value included in
  12053. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12054. @item luma_threshold, lt
  12055. Set the luma threshold used as a coefficient to determine
  12056. whether a pixel should be blurred or not. The option value must be an
  12057. integer in the range [-30,30]. A value of 0 will filter all the image,
  12058. a value included in [0,30] will filter flat areas and a value included
  12059. in [-30,0] will filter edges. Default value is 0.
  12060. @item chroma_radius, cr
  12061. Set the chroma radius. The option value must be a float number in
  12062. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12063. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12064. @item chroma_strength, cs
  12065. Set the chroma strength. The option value must be a float number
  12066. in the range [-1.0,1.0] that configures the blurring. A value included
  12067. in [0.0,1.0] will blur the image whereas a value included in
  12068. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12069. @item chroma_threshold, ct
  12070. Set the chroma threshold used as a coefficient to determine
  12071. whether a pixel should be blurred or not. The option value must be an
  12072. integer in the range [-30,30]. A value of 0 will filter all the image,
  12073. a value included in [0,30] will filter flat areas and a value included
  12074. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12075. @end table
  12076. If a chroma option is not explicitly set, the corresponding luma value
  12077. is set.
  12078. @section ssim
  12079. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12080. This filter takes in input two input videos, the first input is
  12081. considered the "main" source and is passed unchanged to the
  12082. output. The second input is used as a "reference" video for computing
  12083. the SSIM.
  12084. Both video inputs must have the same resolution and pixel format for
  12085. this filter to work correctly. Also it assumes that both inputs
  12086. have the same number of frames, which are compared one by one.
  12087. The filter stores the calculated SSIM of each frame.
  12088. The description of the accepted parameters follows.
  12089. @table @option
  12090. @item stats_file, f
  12091. If specified the filter will use the named file to save the SSIM of
  12092. each individual frame. When filename equals "-" the data is sent to
  12093. standard output.
  12094. @end table
  12095. The file printed if @var{stats_file} is selected, contains a sequence of
  12096. key/value pairs of the form @var{key}:@var{value} for each compared
  12097. couple of frames.
  12098. A description of each shown parameter follows:
  12099. @table @option
  12100. @item n
  12101. sequential number of the input frame, starting from 1
  12102. @item Y, U, V, R, G, B
  12103. SSIM of the compared frames for the component specified by the suffix.
  12104. @item All
  12105. SSIM of the compared frames for the whole frame.
  12106. @item dB
  12107. Same as above but in dB representation.
  12108. @end table
  12109. This filter also supports the @ref{framesync} options.
  12110. For example:
  12111. @example
  12112. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12113. [main][ref] ssim="stats_file=stats.log" [out]
  12114. @end example
  12115. On this example the input file being processed is compared with the
  12116. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12117. is stored in @file{stats.log}.
  12118. Another example with both psnr and ssim at same time:
  12119. @example
  12120. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12121. @end example
  12122. @section stereo3d
  12123. Convert between different stereoscopic image formats.
  12124. The filters accept the following options:
  12125. @table @option
  12126. @item in
  12127. Set stereoscopic image format of input.
  12128. Available values for input image formats are:
  12129. @table @samp
  12130. @item sbsl
  12131. side by side parallel (left eye left, right eye right)
  12132. @item sbsr
  12133. side by side crosseye (right eye left, left eye right)
  12134. @item sbs2l
  12135. side by side parallel with half width resolution
  12136. (left eye left, right eye right)
  12137. @item sbs2r
  12138. side by side crosseye with half width resolution
  12139. (right eye left, left eye right)
  12140. @item abl
  12141. above-below (left eye above, right eye below)
  12142. @item abr
  12143. above-below (right eye above, left eye below)
  12144. @item ab2l
  12145. above-below with half height resolution
  12146. (left eye above, right eye below)
  12147. @item ab2r
  12148. above-below with half height resolution
  12149. (right eye above, left eye below)
  12150. @item al
  12151. alternating frames (left eye first, right eye second)
  12152. @item ar
  12153. alternating frames (right eye first, left eye second)
  12154. @item irl
  12155. interleaved rows (left eye has top row, right eye starts on next row)
  12156. @item irr
  12157. interleaved rows (right eye has top row, left eye starts on next row)
  12158. @item icl
  12159. interleaved columns, left eye first
  12160. @item icr
  12161. interleaved columns, right eye first
  12162. Default value is @samp{sbsl}.
  12163. @end table
  12164. @item out
  12165. Set stereoscopic image format of output.
  12166. @table @samp
  12167. @item sbsl
  12168. side by side parallel (left eye left, right eye right)
  12169. @item sbsr
  12170. side by side crosseye (right eye left, left eye right)
  12171. @item sbs2l
  12172. side by side parallel with half width resolution
  12173. (left eye left, right eye right)
  12174. @item sbs2r
  12175. side by side crosseye with half width resolution
  12176. (right eye left, left eye right)
  12177. @item abl
  12178. above-below (left eye above, right eye below)
  12179. @item abr
  12180. above-below (right eye above, left eye below)
  12181. @item ab2l
  12182. above-below with half height resolution
  12183. (left eye above, right eye below)
  12184. @item ab2r
  12185. above-below with half height resolution
  12186. (right eye above, left eye below)
  12187. @item al
  12188. alternating frames (left eye first, right eye second)
  12189. @item ar
  12190. alternating frames (right eye first, left eye second)
  12191. @item irl
  12192. interleaved rows (left eye has top row, right eye starts on next row)
  12193. @item irr
  12194. interleaved rows (right eye has top row, left eye starts on next row)
  12195. @item arbg
  12196. anaglyph red/blue gray
  12197. (red filter on left eye, blue filter on right eye)
  12198. @item argg
  12199. anaglyph red/green gray
  12200. (red filter on left eye, green filter on right eye)
  12201. @item arcg
  12202. anaglyph red/cyan gray
  12203. (red filter on left eye, cyan filter on right eye)
  12204. @item arch
  12205. anaglyph red/cyan half colored
  12206. (red filter on left eye, cyan filter on right eye)
  12207. @item arcc
  12208. anaglyph red/cyan color
  12209. (red filter on left eye, cyan filter on right eye)
  12210. @item arcd
  12211. anaglyph red/cyan color optimized with the least squares projection of dubois
  12212. (red filter on left eye, cyan filter on right eye)
  12213. @item agmg
  12214. anaglyph green/magenta gray
  12215. (green filter on left eye, magenta filter on right eye)
  12216. @item agmh
  12217. anaglyph green/magenta half colored
  12218. (green filter on left eye, magenta filter on right eye)
  12219. @item agmc
  12220. anaglyph green/magenta colored
  12221. (green filter on left eye, magenta filter on right eye)
  12222. @item agmd
  12223. anaglyph green/magenta color optimized with the least squares projection of dubois
  12224. (green filter on left eye, magenta filter on right eye)
  12225. @item aybg
  12226. anaglyph yellow/blue gray
  12227. (yellow filter on left eye, blue filter on right eye)
  12228. @item aybh
  12229. anaglyph yellow/blue half colored
  12230. (yellow filter on left eye, blue filter on right eye)
  12231. @item aybc
  12232. anaglyph yellow/blue colored
  12233. (yellow filter on left eye, blue filter on right eye)
  12234. @item aybd
  12235. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12236. (yellow filter on left eye, blue filter on right eye)
  12237. @item ml
  12238. mono output (left eye only)
  12239. @item mr
  12240. mono output (right eye only)
  12241. @item chl
  12242. checkerboard, left eye first
  12243. @item chr
  12244. checkerboard, right eye first
  12245. @item icl
  12246. interleaved columns, left eye first
  12247. @item icr
  12248. interleaved columns, right eye first
  12249. @item hdmi
  12250. HDMI frame pack
  12251. @end table
  12252. Default value is @samp{arcd}.
  12253. @end table
  12254. @subsection Examples
  12255. @itemize
  12256. @item
  12257. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12258. @example
  12259. stereo3d=sbsl:aybd
  12260. @end example
  12261. @item
  12262. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12263. @example
  12264. stereo3d=abl:sbsr
  12265. @end example
  12266. @end itemize
  12267. @section streamselect, astreamselect
  12268. Select video or audio streams.
  12269. The filter accepts the following options:
  12270. @table @option
  12271. @item inputs
  12272. Set number of inputs. Default is 2.
  12273. @item map
  12274. Set input indexes to remap to outputs.
  12275. @end table
  12276. @subsection Commands
  12277. The @code{streamselect} and @code{astreamselect} filter supports the following
  12278. commands:
  12279. @table @option
  12280. @item map
  12281. Set input indexes to remap to outputs.
  12282. @end table
  12283. @subsection Examples
  12284. @itemize
  12285. @item
  12286. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12287. @example
  12288. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12289. @end example
  12290. @item
  12291. Same as above, but for audio:
  12292. @example
  12293. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12294. @end example
  12295. @end itemize
  12296. @section sobel
  12297. Apply sobel operator to input video stream.
  12298. The filter accepts the following option:
  12299. @table @option
  12300. @item planes
  12301. Set which planes will be processed, unprocessed planes will be copied.
  12302. By default value 0xf, all planes will be processed.
  12303. @item scale
  12304. Set value which will be multiplied with filtered result.
  12305. @item delta
  12306. Set value which will be added to filtered result.
  12307. @end table
  12308. @anchor{spp}
  12309. @section spp
  12310. Apply a simple postprocessing filter that compresses and decompresses the image
  12311. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12312. and average the results.
  12313. The filter accepts the following options:
  12314. @table @option
  12315. @item quality
  12316. Set quality. This option defines the number of levels for averaging. It accepts
  12317. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12318. effect. A value of @code{6} means the higher quality. For each increment of
  12319. that value the speed drops by a factor of approximately 2. Default value is
  12320. @code{3}.
  12321. @item qp
  12322. Force a constant quantization parameter. If not set, the filter will use the QP
  12323. from the video stream (if available).
  12324. @item mode
  12325. Set thresholding mode. Available modes are:
  12326. @table @samp
  12327. @item hard
  12328. Set hard thresholding (default).
  12329. @item soft
  12330. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12331. @end table
  12332. @item use_bframe_qp
  12333. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12334. option may cause flicker since the B-Frames have often larger QP. Default is
  12335. @code{0} (not enabled).
  12336. @end table
  12337. @section sr
  12338. Scale the input by applying one of the super-resolution methods based on
  12339. convolutional neural networks. Supported models:
  12340. @itemize
  12341. @item
  12342. Super-Resolution Convolutional Neural Network model (SRCNN).
  12343. See @url{https://arxiv.org/abs/1501.00092}.
  12344. @item
  12345. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12346. See @url{https://arxiv.org/abs/1609.05158}.
  12347. @end itemize
  12348. Training scripts as well as scripts for model generation are provided in
  12349. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12350. The filter accepts the following options:
  12351. @table @option
  12352. @item dnn_backend
  12353. Specify which DNN backend to use for model loading and execution. This option accepts
  12354. the following values:
  12355. @table @samp
  12356. @item native
  12357. Native implementation of DNN loading and execution.
  12358. @item tensorflow
  12359. TensorFlow backend. To enable this backend you
  12360. need to install the TensorFlow for C library (see
  12361. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12362. @code{--enable-libtensorflow}
  12363. @end table
  12364. Default value is @samp{native}.
  12365. @item model
  12366. Set path to model file specifying network architecture and its parameters.
  12367. Note that different backends use different file formats. TensorFlow backend
  12368. can load files for both formats, while native backend can load files for only
  12369. its format.
  12370. @item scale_factor
  12371. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12372. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12373. input upscaled using bicubic upscaling with proper scale factor.
  12374. @end table
  12375. @anchor{subtitles}
  12376. @section subtitles
  12377. Draw subtitles on top of input video using the libass library.
  12378. To enable compilation of this filter you need to configure FFmpeg with
  12379. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12380. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12381. Alpha) subtitles format.
  12382. The filter accepts the following options:
  12383. @table @option
  12384. @item filename, f
  12385. Set the filename of the subtitle file to read. It must be specified.
  12386. @item original_size
  12387. Specify the size of the original video, the video for which the ASS file
  12388. was composed. For the syntax of this option, check the
  12389. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12390. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12391. correctly scale the fonts if the aspect ratio has been changed.
  12392. @item fontsdir
  12393. Set a directory path containing fonts that can be used by the filter.
  12394. These fonts will be used in addition to whatever the font provider uses.
  12395. @item alpha
  12396. Process alpha channel, by default alpha channel is untouched.
  12397. @item charenc
  12398. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12399. useful if not UTF-8.
  12400. @item stream_index, si
  12401. Set subtitles stream index. @code{subtitles} filter only.
  12402. @item force_style
  12403. Override default style or script info parameters of the subtitles. It accepts a
  12404. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12405. @end table
  12406. If the first key is not specified, it is assumed that the first value
  12407. specifies the @option{filename}.
  12408. For example, to render the file @file{sub.srt} on top of the input
  12409. video, use the command:
  12410. @example
  12411. subtitles=sub.srt
  12412. @end example
  12413. which is equivalent to:
  12414. @example
  12415. subtitles=filename=sub.srt
  12416. @end example
  12417. To render the default subtitles stream from file @file{video.mkv}, use:
  12418. @example
  12419. subtitles=video.mkv
  12420. @end example
  12421. To render the second subtitles stream from that file, use:
  12422. @example
  12423. subtitles=video.mkv:si=1
  12424. @end example
  12425. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12426. @code{DejaVu Serif}, use:
  12427. @example
  12428. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12429. @end example
  12430. @section super2xsai
  12431. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12432. Interpolate) pixel art scaling algorithm.
  12433. Useful for enlarging pixel art images without reducing sharpness.
  12434. @section swaprect
  12435. Swap two rectangular objects in video.
  12436. This filter accepts the following options:
  12437. @table @option
  12438. @item w
  12439. Set object width.
  12440. @item h
  12441. Set object height.
  12442. @item x1
  12443. Set 1st rect x coordinate.
  12444. @item y1
  12445. Set 1st rect y coordinate.
  12446. @item x2
  12447. Set 2nd rect x coordinate.
  12448. @item y2
  12449. Set 2nd rect y coordinate.
  12450. All expressions are evaluated once for each frame.
  12451. @end table
  12452. The all options are expressions containing the following constants:
  12453. @table @option
  12454. @item w
  12455. @item h
  12456. The input width and height.
  12457. @item a
  12458. same as @var{w} / @var{h}
  12459. @item sar
  12460. input sample aspect ratio
  12461. @item dar
  12462. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12463. @item n
  12464. The number of the input frame, starting from 0.
  12465. @item t
  12466. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12467. @item pos
  12468. the position in the file of the input frame, NAN if unknown
  12469. @end table
  12470. @section swapuv
  12471. Swap U & V plane.
  12472. @section telecine
  12473. Apply telecine process to the video.
  12474. This filter accepts the following options:
  12475. @table @option
  12476. @item first_field
  12477. @table @samp
  12478. @item top, t
  12479. top field first
  12480. @item bottom, b
  12481. bottom field first
  12482. The default value is @code{top}.
  12483. @end table
  12484. @item pattern
  12485. A string of numbers representing the pulldown pattern you wish to apply.
  12486. The default value is @code{23}.
  12487. @end table
  12488. @example
  12489. Some typical patterns:
  12490. NTSC output (30i):
  12491. 27.5p: 32222
  12492. 24p: 23 (classic)
  12493. 24p: 2332 (preferred)
  12494. 20p: 33
  12495. 18p: 334
  12496. 16p: 3444
  12497. PAL output (25i):
  12498. 27.5p: 12222
  12499. 24p: 222222222223 ("Euro pulldown")
  12500. 16.67p: 33
  12501. 16p: 33333334
  12502. @end example
  12503. @section threshold
  12504. Apply threshold effect to video stream.
  12505. This filter needs four video streams to perform thresholding.
  12506. First stream is stream we are filtering.
  12507. Second stream is holding threshold values, third stream is holding min values,
  12508. and last, fourth stream is holding max values.
  12509. The filter accepts the following option:
  12510. @table @option
  12511. @item planes
  12512. Set which planes will be processed, unprocessed planes will be copied.
  12513. By default value 0xf, all planes will be processed.
  12514. @end table
  12515. For example if first stream pixel's component value is less then threshold value
  12516. of pixel component from 2nd threshold stream, third stream value will picked,
  12517. otherwise fourth stream pixel component value will be picked.
  12518. Using color source filter one can perform various types of thresholding:
  12519. @subsection Examples
  12520. @itemize
  12521. @item
  12522. Binary threshold, using gray color as threshold:
  12523. @example
  12524. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12525. @end example
  12526. @item
  12527. Inverted binary threshold, using gray color as threshold:
  12528. @example
  12529. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12530. @end example
  12531. @item
  12532. Truncate binary threshold, using gray color as threshold:
  12533. @example
  12534. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12535. @end example
  12536. @item
  12537. Threshold to zero, using gray color as threshold:
  12538. @example
  12539. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12540. @end example
  12541. @item
  12542. Inverted threshold to zero, using gray color as threshold:
  12543. @example
  12544. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12545. @end example
  12546. @end itemize
  12547. @section thumbnail
  12548. Select the most representative frame in a given sequence of consecutive frames.
  12549. The filter accepts the following options:
  12550. @table @option
  12551. @item n
  12552. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12553. will pick one of them, and then handle the next batch of @var{n} frames until
  12554. the end. Default is @code{100}.
  12555. @end table
  12556. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12557. value will result in a higher memory usage, so a high value is not recommended.
  12558. @subsection Examples
  12559. @itemize
  12560. @item
  12561. Extract one picture each 50 frames:
  12562. @example
  12563. thumbnail=50
  12564. @end example
  12565. @item
  12566. Complete example of a thumbnail creation with @command{ffmpeg}:
  12567. @example
  12568. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12569. @end example
  12570. @end itemize
  12571. @section tile
  12572. Tile several successive frames together.
  12573. The filter accepts the following options:
  12574. @table @option
  12575. @item layout
  12576. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12577. this option, check the
  12578. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12579. @item nb_frames
  12580. Set the maximum number of frames to render in the given area. It must be less
  12581. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12582. the area will be used.
  12583. @item margin
  12584. Set the outer border margin in pixels.
  12585. @item padding
  12586. Set the inner border thickness (i.e. the number of pixels between frames). For
  12587. more advanced padding options (such as having different values for the edges),
  12588. refer to the pad video filter.
  12589. @item color
  12590. Specify the color of the unused area. For the syntax of this option, check the
  12591. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12592. The default value of @var{color} is "black".
  12593. @item overlap
  12594. Set the number of frames to overlap when tiling several successive frames together.
  12595. The value must be between @code{0} and @var{nb_frames - 1}.
  12596. @item init_padding
  12597. Set the number of frames to initially be empty before displaying first output frame.
  12598. This controls how soon will one get first output frame.
  12599. The value must be between @code{0} and @var{nb_frames - 1}.
  12600. @end table
  12601. @subsection Examples
  12602. @itemize
  12603. @item
  12604. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12605. @example
  12606. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12607. @end example
  12608. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12609. duplicating each output frame to accommodate the originally detected frame
  12610. rate.
  12611. @item
  12612. Display @code{5} pictures in an area of @code{3x2} frames,
  12613. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12614. mixed flat and named options:
  12615. @example
  12616. tile=3x2:nb_frames=5:padding=7:margin=2
  12617. @end example
  12618. @end itemize
  12619. @section tinterlace
  12620. Perform various types of temporal field interlacing.
  12621. Frames are counted starting from 1, so the first input frame is
  12622. considered odd.
  12623. The filter accepts the following options:
  12624. @table @option
  12625. @item mode
  12626. Specify the mode of the interlacing. This option can also be specified
  12627. as a value alone. See below for a list of values for this option.
  12628. Available values are:
  12629. @table @samp
  12630. @item merge, 0
  12631. Move odd frames into the upper field, even into the lower field,
  12632. generating a double height frame at half frame rate.
  12633. @example
  12634. ------> time
  12635. Input:
  12636. Frame 1 Frame 2 Frame 3 Frame 4
  12637. 11111 22222 33333 44444
  12638. 11111 22222 33333 44444
  12639. 11111 22222 33333 44444
  12640. 11111 22222 33333 44444
  12641. Output:
  12642. 11111 33333
  12643. 22222 44444
  12644. 11111 33333
  12645. 22222 44444
  12646. 11111 33333
  12647. 22222 44444
  12648. 11111 33333
  12649. 22222 44444
  12650. @end example
  12651. @item drop_even, 1
  12652. Only output odd frames, even frames are dropped, generating a frame with
  12653. unchanged height at half frame rate.
  12654. @example
  12655. ------> time
  12656. Input:
  12657. Frame 1 Frame 2 Frame 3 Frame 4
  12658. 11111 22222 33333 44444
  12659. 11111 22222 33333 44444
  12660. 11111 22222 33333 44444
  12661. 11111 22222 33333 44444
  12662. Output:
  12663. 11111 33333
  12664. 11111 33333
  12665. 11111 33333
  12666. 11111 33333
  12667. @end example
  12668. @item drop_odd, 2
  12669. Only output even frames, odd frames are dropped, generating a frame with
  12670. unchanged height at half frame rate.
  12671. @example
  12672. ------> time
  12673. Input:
  12674. Frame 1 Frame 2 Frame 3 Frame 4
  12675. 11111 22222 33333 44444
  12676. 11111 22222 33333 44444
  12677. 11111 22222 33333 44444
  12678. 11111 22222 33333 44444
  12679. Output:
  12680. 22222 44444
  12681. 22222 44444
  12682. 22222 44444
  12683. 22222 44444
  12684. @end example
  12685. @item pad, 3
  12686. Expand each frame to full height, but pad alternate lines with black,
  12687. generating a frame with double height at the same input frame rate.
  12688. @example
  12689. ------> time
  12690. Input:
  12691. Frame 1 Frame 2 Frame 3 Frame 4
  12692. 11111 22222 33333 44444
  12693. 11111 22222 33333 44444
  12694. 11111 22222 33333 44444
  12695. 11111 22222 33333 44444
  12696. Output:
  12697. 11111 ..... 33333 .....
  12698. ..... 22222 ..... 44444
  12699. 11111 ..... 33333 .....
  12700. ..... 22222 ..... 44444
  12701. 11111 ..... 33333 .....
  12702. ..... 22222 ..... 44444
  12703. 11111 ..... 33333 .....
  12704. ..... 22222 ..... 44444
  12705. @end example
  12706. @item interleave_top, 4
  12707. Interleave the upper field from odd frames with the lower field from
  12708. even frames, generating a frame with unchanged height at half frame rate.
  12709. @example
  12710. ------> time
  12711. Input:
  12712. Frame 1 Frame 2 Frame 3 Frame 4
  12713. 11111<- 22222 33333<- 44444
  12714. 11111 22222<- 33333 44444<-
  12715. 11111<- 22222 33333<- 44444
  12716. 11111 22222<- 33333 44444<-
  12717. Output:
  12718. 11111 33333
  12719. 22222 44444
  12720. 11111 33333
  12721. 22222 44444
  12722. @end example
  12723. @item interleave_bottom, 5
  12724. Interleave the lower field from odd frames with the upper field from
  12725. even frames, generating a frame with unchanged height at half frame rate.
  12726. @example
  12727. ------> time
  12728. Input:
  12729. Frame 1 Frame 2 Frame 3 Frame 4
  12730. 11111 22222<- 33333 44444<-
  12731. 11111<- 22222 33333<- 44444
  12732. 11111 22222<- 33333 44444<-
  12733. 11111<- 22222 33333<- 44444
  12734. Output:
  12735. 22222 44444
  12736. 11111 33333
  12737. 22222 44444
  12738. 11111 33333
  12739. @end example
  12740. @item interlacex2, 6
  12741. Double frame rate with unchanged height. Frames are inserted each
  12742. containing the second temporal field from the previous input frame and
  12743. the first temporal field from the next input frame. This mode relies on
  12744. the top_field_first flag. Useful for interlaced video displays with no
  12745. field synchronisation.
  12746. @example
  12747. ------> time
  12748. Input:
  12749. Frame 1 Frame 2 Frame 3 Frame 4
  12750. 11111 22222 33333 44444
  12751. 11111 22222 33333 44444
  12752. 11111 22222 33333 44444
  12753. 11111 22222 33333 44444
  12754. Output:
  12755. 11111 22222 22222 33333 33333 44444 44444
  12756. 11111 11111 22222 22222 33333 33333 44444
  12757. 11111 22222 22222 33333 33333 44444 44444
  12758. 11111 11111 22222 22222 33333 33333 44444
  12759. @end example
  12760. @item mergex2, 7
  12761. Move odd frames into the upper field, even into the lower field,
  12762. generating a double height frame at same frame rate.
  12763. @example
  12764. ------> time
  12765. Input:
  12766. Frame 1 Frame 2 Frame 3 Frame 4
  12767. 11111 22222 33333 44444
  12768. 11111 22222 33333 44444
  12769. 11111 22222 33333 44444
  12770. 11111 22222 33333 44444
  12771. Output:
  12772. 11111 33333 33333 55555
  12773. 22222 22222 44444 44444
  12774. 11111 33333 33333 55555
  12775. 22222 22222 44444 44444
  12776. 11111 33333 33333 55555
  12777. 22222 22222 44444 44444
  12778. 11111 33333 33333 55555
  12779. 22222 22222 44444 44444
  12780. @end example
  12781. @end table
  12782. Numeric values are deprecated but are accepted for backward
  12783. compatibility reasons.
  12784. Default mode is @code{merge}.
  12785. @item flags
  12786. Specify flags influencing the filter process.
  12787. Available value for @var{flags} is:
  12788. @table @option
  12789. @item low_pass_filter, vlfp
  12790. Enable linear vertical low-pass filtering in the filter.
  12791. Vertical low-pass filtering is required when creating an interlaced
  12792. destination from a progressive source which contains high-frequency
  12793. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12794. patterning.
  12795. @item complex_filter, cvlfp
  12796. Enable complex vertical low-pass filtering.
  12797. This will slightly less reduce interlace 'twitter' and Moire
  12798. patterning but better retain detail and subjective sharpness impression.
  12799. @end table
  12800. Vertical low-pass filtering can only be enabled for @option{mode}
  12801. @var{interleave_top} and @var{interleave_bottom}.
  12802. @end table
  12803. @section tmix
  12804. Mix successive video frames.
  12805. A description of the accepted options follows.
  12806. @table @option
  12807. @item frames
  12808. The number of successive frames to mix. If unspecified, it defaults to 3.
  12809. @item weights
  12810. Specify weight of each input video frame.
  12811. Each weight is separated by space. If number of weights is smaller than
  12812. number of @var{frames} last specified weight will be used for all remaining
  12813. unset weights.
  12814. @item scale
  12815. Specify scale, if it is set it will be multiplied with sum
  12816. of each weight multiplied with pixel values to give final destination
  12817. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12818. @end table
  12819. @subsection Examples
  12820. @itemize
  12821. @item
  12822. Average 7 successive frames:
  12823. @example
  12824. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12825. @end example
  12826. @item
  12827. Apply simple temporal convolution:
  12828. @example
  12829. tmix=frames=3:weights="-1 3 -1"
  12830. @end example
  12831. @item
  12832. Similar as above but only showing temporal differences:
  12833. @example
  12834. tmix=frames=3:weights="-1 2 -1":scale=1
  12835. @end example
  12836. @end itemize
  12837. @anchor{tonemap}
  12838. @section tonemap
  12839. Tone map colors from different dynamic ranges.
  12840. This filter expects data in single precision floating point, as it needs to
  12841. operate on (and can output) out-of-range values. Another filter, such as
  12842. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12843. The tonemapping algorithms implemented only work on linear light, so input
  12844. data should be linearized beforehand (and possibly correctly tagged).
  12845. @example
  12846. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12847. @end example
  12848. @subsection Options
  12849. The filter accepts the following options.
  12850. @table @option
  12851. @item tonemap
  12852. Set the tone map algorithm to use.
  12853. Possible values are:
  12854. @table @var
  12855. @item none
  12856. Do not apply any tone map, only desaturate overbright pixels.
  12857. @item clip
  12858. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12859. in-range values, while distorting out-of-range values.
  12860. @item linear
  12861. Stretch the entire reference gamut to a linear multiple of the display.
  12862. @item gamma
  12863. Fit a logarithmic transfer between the tone curves.
  12864. @item reinhard
  12865. Preserve overall image brightness with a simple curve, using nonlinear
  12866. contrast, which results in flattening details and degrading color accuracy.
  12867. @item hable
  12868. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12869. of slightly darkening everything. Use it when detail preservation is more
  12870. important than color and brightness accuracy.
  12871. @item mobius
  12872. Smoothly map out-of-range values, while retaining contrast and colors for
  12873. in-range material as much as possible. Use it when color accuracy is more
  12874. important than detail preservation.
  12875. @end table
  12876. Default is none.
  12877. @item param
  12878. Tune the tone mapping algorithm.
  12879. This affects the following algorithms:
  12880. @table @var
  12881. @item none
  12882. Ignored.
  12883. @item linear
  12884. Specifies the scale factor to use while stretching.
  12885. Default to 1.0.
  12886. @item gamma
  12887. Specifies the exponent of the function.
  12888. Default to 1.8.
  12889. @item clip
  12890. Specify an extra linear coefficient to multiply into the signal before clipping.
  12891. Default to 1.0.
  12892. @item reinhard
  12893. Specify the local contrast coefficient at the display peak.
  12894. Default to 0.5, which means that in-gamut values will be about half as bright
  12895. as when clipping.
  12896. @item hable
  12897. Ignored.
  12898. @item mobius
  12899. Specify the transition point from linear to mobius transform. Every value
  12900. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12901. more accurate the result will be, at the cost of losing bright details.
  12902. Default to 0.3, which due to the steep initial slope still preserves in-range
  12903. colors fairly accurately.
  12904. @end table
  12905. @item desat
  12906. Apply desaturation for highlights that exceed this level of brightness. The
  12907. higher the parameter, the more color information will be preserved. This
  12908. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12909. (smoothly) turning into white instead. This makes images feel more natural,
  12910. at the cost of reducing information about out-of-range colors.
  12911. The default of 2.0 is somewhat conservative and will mostly just apply to
  12912. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12913. This option works only if the input frame has a supported color tag.
  12914. @item peak
  12915. Override signal/nominal/reference peak with this value. Useful when the
  12916. embedded peak information in display metadata is not reliable or when tone
  12917. mapping from a lower range to a higher range.
  12918. @end table
  12919. @section tpad
  12920. Temporarily pad video frames.
  12921. The filter accepts the following options:
  12922. @table @option
  12923. @item start
  12924. Specify number of delay frames before input video stream.
  12925. @item stop
  12926. Specify number of padding frames after input video stream.
  12927. Set to -1 to pad indefinitely.
  12928. @item start_mode
  12929. Set kind of frames added to beginning of stream.
  12930. Can be either @var{add} or @var{clone}.
  12931. With @var{add} frames of solid-color are added.
  12932. With @var{clone} frames are clones of first frame.
  12933. @item stop_mode
  12934. Set kind of frames added to end of stream.
  12935. Can be either @var{add} or @var{clone}.
  12936. With @var{add} frames of solid-color are added.
  12937. With @var{clone} frames are clones of last frame.
  12938. @item start_duration, stop_duration
  12939. Specify the duration of the start/stop delay. See
  12940. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12941. for the accepted syntax.
  12942. These options override @var{start} and @var{stop}.
  12943. @item color
  12944. Specify the color of the padded area. For the syntax of this option,
  12945. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12946. manual,ffmpeg-utils}.
  12947. The default value of @var{color} is "black".
  12948. @end table
  12949. @anchor{transpose}
  12950. @section transpose
  12951. Transpose rows with columns in the input video and optionally flip it.
  12952. It accepts the following parameters:
  12953. @table @option
  12954. @item dir
  12955. Specify the transposition direction.
  12956. Can assume the following values:
  12957. @table @samp
  12958. @item 0, 4, cclock_flip
  12959. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12960. @example
  12961. L.R L.l
  12962. . . -> . .
  12963. l.r R.r
  12964. @end example
  12965. @item 1, 5, clock
  12966. Rotate by 90 degrees clockwise, that is:
  12967. @example
  12968. L.R l.L
  12969. . . -> . .
  12970. l.r r.R
  12971. @end example
  12972. @item 2, 6, cclock
  12973. Rotate by 90 degrees counterclockwise, that is:
  12974. @example
  12975. L.R R.r
  12976. . . -> . .
  12977. l.r L.l
  12978. @end example
  12979. @item 3, 7, clock_flip
  12980. Rotate by 90 degrees clockwise and vertically flip, that is:
  12981. @example
  12982. L.R r.R
  12983. . . -> . .
  12984. l.r l.L
  12985. @end example
  12986. @end table
  12987. For values between 4-7, the transposition is only done if the input
  12988. video geometry is portrait and not landscape. These values are
  12989. deprecated, the @code{passthrough} option should be used instead.
  12990. Numerical values are deprecated, and should be dropped in favor of
  12991. symbolic constants.
  12992. @item passthrough
  12993. Do not apply the transposition if the input geometry matches the one
  12994. specified by the specified value. It accepts the following values:
  12995. @table @samp
  12996. @item none
  12997. Always apply transposition.
  12998. @item portrait
  12999. Preserve portrait geometry (when @var{height} >= @var{width}).
  13000. @item landscape
  13001. Preserve landscape geometry (when @var{width} >= @var{height}).
  13002. @end table
  13003. Default value is @code{none}.
  13004. @end table
  13005. For example to rotate by 90 degrees clockwise and preserve portrait
  13006. layout:
  13007. @example
  13008. transpose=dir=1:passthrough=portrait
  13009. @end example
  13010. The command above can also be specified as:
  13011. @example
  13012. transpose=1:portrait
  13013. @end example
  13014. @section transpose_npp
  13015. Transpose rows with columns in the input video and optionally flip it.
  13016. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13017. It accepts the following parameters:
  13018. @table @option
  13019. @item dir
  13020. Specify the transposition direction.
  13021. Can assume the following values:
  13022. @table @samp
  13023. @item cclock_flip
  13024. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13025. @item clock
  13026. Rotate by 90 degrees clockwise.
  13027. @item cclock
  13028. Rotate by 90 degrees counterclockwise.
  13029. @item clock_flip
  13030. Rotate by 90 degrees clockwise and vertically flip.
  13031. @end table
  13032. @item passthrough
  13033. Do not apply the transposition if the input geometry matches the one
  13034. specified by the specified value. It accepts the following values:
  13035. @table @samp
  13036. @item none
  13037. Always apply transposition. (default)
  13038. @item portrait
  13039. Preserve portrait geometry (when @var{height} >= @var{width}).
  13040. @item landscape
  13041. Preserve landscape geometry (when @var{width} >= @var{height}).
  13042. @end table
  13043. @end table
  13044. @section trim
  13045. Trim the input so that the output contains one continuous subpart of the input.
  13046. It accepts the following parameters:
  13047. @table @option
  13048. @item start
  13049. Specify the time of the start of the kept section, i.e. the frame with the
  13050. timestamp @var{start} will be the first frame in the output.
  13051. @item end
  13052. Specify the time of the first frame that will be dropped, i.e. the frame
  13053. immediately preceding the one with the timestamp @var{end} will be the last
  13054. frame in the output.
  13055. @item start_pts
  13056. This is the same as @var{start}, except this option sets the start timestamp
  13057. in timebase units instead of seconds.
  13058. @item end_pts
  13059. This is the same as @var{end}, except this option sets the end timestamp
  13060. in timebase units instead of seconds.
  13061. @item duration
  13062. The maximum duration of the output in seconds.
  13063. @item start_frame
  13064. The number of the first frame that should be passed to the output.
  13065. @item end_frame
  13066. The number of the first frame that should be dropped.
  13067. @end table
  13068. @option{start}, @option{end}, and @option{duration} are expressed as time
  13069. duration specifications; see
  13070. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13071. for the accepted syntax.
  13072. Note that the first two sets of the start/end options and the @option{duration}
  13073. option look at the frame timestamp, while the _frame variants simply count the
  13074. frames that pass through the filter. Also note that this filter does not modify
  13075. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13076. setpts filter after the trim filter.
  13077. If multiple start or end options are set, this filter tries to be greedy and
  13078. keep all the frames that match at least one of the specified constraints. To keep
  13079. only the part that matches all the constraints at once, chain multiple trim
  13080. filters.
  13081. The defaults are such that all the input is kept. So it is possible to set e.g.
  13082. just the end values to keep everything before the specified time.
  13083. Examples:
  13084. @itemize
  13085. @item
  13086. Drop everything except the second minute of input:
  13087. @example
  13088. ffmpeg -i INPUT -vf trim=60:120
  13089. @end example
  13090. @item
  13091. Keep only the first second:
  13092. @example
  13093. ffmpeg -i INPUT -vf trim=duration=1
  13094. @end example
  13095. @end itemize
  13096. @section unpremultiply
  13097. Apply alpha unpremultiply effect to input video stream using first plane
  13098. of second stream as alpha.
  13099. Both streams must have same dimensions and same pixel format.
  13100. The filter accepts the following option:
  13101. @table @option
  13102. @item planes
  13103. Set which planes will be processed, unprocessed planes will be copied.
  13104. By default value 0xf, all planes will be processed.
  13105. If the format has 1 or 2 components, then luma is bit 0.
  13106. If the format has 3 or 4 components:
  13107. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13108. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13109. If present, the alpha channel is always the last bit.
  13110. @item inplace
  13111. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13112. @end table
  13113. @anchor{unsharp}
  13114. @section unsharp
  13115. Sharpen or blur the input video.
  13116. It accepts the following parameters:
  13117. @table @option
  13118. @item luma_msize_x, lx
  13119. Set the luma matrix horizontal size. It must be an odd integer between
  13120. 3 and 23. The default value is 5.
  13121. @item luma_msize_y, ly
  13122. Set the luma matrix vertical size. It must be an odd integer between 3
  13123. and 23. The default value is 5.
  13124. @item luma_amount, la
  13125. Set the luma effect strength. It must be a floating point number, reasonable
  13126. values lay between -1.5 and 1.5.
  13127. Negative values will blur the input video, while positive values will
  13128. sharpen it, a value of zero will disable the effect.
  13129. Default value is 1.0.
  13130. @item chroma_msize_x, cx
  13131. Set the chroma matrix horizontal size. It must be an odd integer
  13132. between 3 and 23. The default value is 5.
  13133. @item chroma_msize_y, cy
  13134. Set the chroma matrix vertical size. It must be an odd integer
  13135. between 3 and 23. The default value is 5.
  13136. @item chroma_amount, ca
  13137. Set the chroma effect strength. It must be a floating point number, reasonable
  13138. values lay between -1.5 and 1.5.
  13139. Negative values will blur the input video, while positive values will
  13140. sharpen it, a value of zero will disable the effect.
  13141. Default value is 0.0.
  13142. @end table
  13143. All parameters are optional and default to the equivalent of the
  13144. string '5:5:1.0:5:5:0.0'.
  13145. @subsection Examples
  13146. @itemize
  13147. @item
  13148. Apply strong luma sharpen effect:
  13149. @example
  13150. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13151. @end example
  13152. @item
  13153. Apply a strong blur of both luma and chroma parameters:
  13154. @example
  13155. unsharp=7:7:-2:7:7:-2
  13156. @end example
  13157. @end itemize
  13158. @section uspp
  13159. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13160. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13161. shifts and average the results.
  13162. The way this differs from the behavior of spp is that uspp actually encodes &
  13163. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13164. DCT similar to MJPEG.
  13165. The filter accepts the following options:
  13166. @table @option
  13167. @item quality
  13168. Set quality. This option defines the number of levels for averaging. It accepts
  13169. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13170. effect. A value of @code{8} means the higher quality. For each increment of
  13171. that value the speed drops by a factor of approximately 2. Default value is
  13172. @code{3}.
  13173. @item qp
  13174. Force a constant quantization parameter. If not set, the filter will use the QP
  13175. from the video stream (if available).
  13176. @end table
  13177. @section vaguedenoiser
  13178. Apply a wavelet based denoiser.
  13179. It transforms each frame from the video input into the wavelet domain,
  13180. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13181. the obtained coefficients. It does an inverse wavelet transform after.
  13182. Due to wavelet properties, it should give a nice smoothed result, and
  13183. reduced noise, without blurring picture features.
  13184. This filter accepts the following options:
  13185. @table @option
  13186. @item threshold
  13187. The filtering strength. The higher, the more filtered the video will be.
  13188. Hard thresholding can use a higher threshold than soft thresholding
  13189. before the video looks overfiltered. Default value is 2.
  13190. @item method
  13191. The filtering method the filter will use.
  13192. It accepts the following values:
  13193. @table @samp
  13194. @item hard
  13195. All values under the threshold will be zeroed.
  13196. @item soft
  13197. All values under the threshold will be zeroed. All values above will be
  13198. reduced by the threshold.
  13199. @item garrote
  13200. Scales or nullifies coefficients - intermediary between (more) soft and
  13201. (less) hard thresholding.
  13202. @end table
  13203. Default is garrote.
  13204. @item nsteps
  13205. Number of times, the wavelet will decompose the picture. Picture can't
  13206. be decomposed beyond a particular point (typically, 8 for a 640x480
  13207. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13208. @item percent
  13209. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13210. @item planes
  13211. A list of the planes to process. By default all planes are processed.
  13212. @end table
  13213. @section vectorscope
  13214. Display 2 color component values in the two dimensional graph (which is called
  13215. a vectorscope).
  13216. This filter accepts the following options:
  13217. @table @option
  13218. @item mode, m
  13219. Set vectorscope mode.
  13220. It accepts the following values:
  13221. @table @samp
  13222. @item gray
  13223. Gray values are displayed on graph, higher brightness means more pixels have
  13224. same component color value on location in graph. This is the default mode.
  13225. @item color
  13226. Gray values are displayed on graph. Surrounding pixels values which are not
  13227. present in video frame are drawn in gradient of 2 color components which are
  13228. set by option @code{x} and @code{y}. The 3rd color component is static.
  13229. @item color2
  13230. Actual color components values present in video frame are displayed on graph.
  13231. @item color3
  13232. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13233. on graph increases value of another color component, which is luminance by
  13234. default values of @code{x} and @code{y}.
  13235. @item color4
  13236. Actual colors present in video frame are displayed on graph. If two different
  13237. colors map to same position on graph then color with higher value of component
  13238. not present in graph is picked.
  13239. @item color5
  13240. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13241. component picked from radial gradient.
  13242. @end table
  13243. @item x
  13244. Set which color component will be represented on X-axis. Default is @code{1}.
  13245. @item y
  13246. Set which color component will be represented on Y-axis. Default is @code{2}.
  13247. @item intensity, i
  13248. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13249. of color component which represents frequency of (X, Y) location in graph.
  13250. @item envelope, e
  13251. @table @samp
  13252. @item none
  13253. No envelope, this is default.
  13254. @item instant
  13255. Instant envelope, even darkest single pixel will be clearly highlighted.
  13256. @item peak
  13257. Hold maximum and minimum values presented in graph over time. This way you
  13258. can still spot out of range values without constantly looking at vectorscope.
  13259. @item peak+instant
  13260. Peak and instant envelope combined together.
  13261. @end table
  13262. @item graticule, g
  13263. Set what kind of graticule to draw.
  13264. @table @samp
  13265. @item none
  13266. @item green
  13267. @item color
  13268. @end table
  13269. @item opacity, o
  13270. Set graticule opacity.
  13271. @item flags, f
  13272. Set graticule flags.
  13273. @table @samp
  13274. @item white
  13275. Draw graticule for white point.
  13276. @item black
  13277. Draw graticule for black point.
  13278. @item name
  13279. Draw color points short names.
  13280. @end table
  13281. @item bgopacity, b
  13282. Set background opacity.
  13283. @item lthreshold, l
  13284. Set low threshold for color component not represented on X or Y axis.
  13285. Values lower than this value will be ignored. Default is 0.
  13286. Note this value is multiplied with actual max possible value one pixel component
  13287. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13288. is 0.1 * 255 = 25.
  13289. @item hthreshold, h
  13290. Set high threshold for color component not represented on X or Y axis.
  13291. Values higher than this value will be ignored. Default is 1.
  13292. Note this value is multiplied with actual max possible value one pixel component
  13293. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13294. is 0.9 * 255 = 230.
  13295. @item colorspace, c
  13296. Set what kind of colorspace to use when drawing graticule.
  13297. @table @samp
  13298. @item auto
  13299. @item 601
  13300. @item 709
  13301. @end table
  13302. Default is auto.
  13303. @end table
  13304. @anchor{vidstabdetect}
  13305. @section vidstabdetect
  13306. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13307. @ref{vidstabtransform} for pass 2.
  13308. This filter generates a file with relative translation and rotation
  13309. transform information about subsequent frames, which is then used by
  13310. the @ref{vidstabtransform} filter.
  13311. To enable compilation of this filter you need to configure FFmpeg with
  13312. @code{--enable-libvidstab}.
  13313. This filter accepts the following options:
  13314. @table @option
  13315. @item result
  13316. Set the path to the file used to write the transforms information.
  13317. Default value is @file{transforms.trf}.
  13318. @item shakiness
  13319. Set how shaky the video is and how quick the camera is. It accepts an
  13320. integer in the range 1-10, a value of 1 means little shakiness, a
  13321. value of 10 means strong shakiness. Default value is 5.
  13322. @item accuracy
  13323. Set the accuracy of the detection process. It must be a value in the
  13324. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13325. accuracy. Default value is 15.
  13326. @item stepsize
  13327. Set stepsize of the search process. The region around minimum is
  13328. scanned with 1 pixel resolution. Default value is 6.
  13329. @item mincontrast
  13330. Set minimum contrast. Below this value a local measurement field is
  13331. discarded. Must be a floating point value in the range 0-1. Default
  13332. value is 0.3.
  13333. @item tripod
  13334. Set reference frame number for tripod mode.
  13335. If enabled, the motion of the frames is compared to a reference frame
  13336. in the filtered stream, identified by the specified number. The idea
  13337. is to compensate all movements in a more-or-less static scene and keep
  13338. the camera view absolutely still.
  13339. If set to 0, it is disabled. The frames are counted starting from 1.
  13340. @item show
  13341. Show fields and transforms in the resulting frames. It accepts an
  13342. integer in the range 0-2. Default value is 0, which disables any
  13343. visualization.
  13344. @end table
  13345. @subsection Examples
  13346. @itemize
  13347. @item
  13348. Use default values:
  13349. @example
  13350. vidstabdetect
  13351. @end example
  13352. @item
  13353. Analyze strongly shaky movie and put the results in file
  13354. @file{mytransforms.trf}:
  13355. @example
  13356. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13357. @end example
  13358. @item
  13359. Visualize the result of internal transformations in the resulting
  13360. video:
  13361. @example
  13362. vidstabdetect=show=1
  13363. @end example
  13364. @item
  13365. Analyze a video with medium shakiness using @command{ffmpeg}:
  13366. @example
  13367. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13368. @end example
  13369. @end itemize
  13370. @anchor{vidstabtransform}
  13371. @section vidstabtransform
  13372. Video stabilization/deshaking: pass 2 of 2,
  13373. see @ref{vidstabdetect} for pass 1.
  13374. Read a file with transform information for each frame and
  13375. apply/compensate them. Together with the @ref{vidstabdetect}
  13376. filter this can be used to deshake videos. See also
  13377. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13378. the @ref{unsharp} filter, see below.
  13379. To enable compilation of this filter you need to configure FFmpeg with
  13380. @code{--enable-libvidstab}.
  13381. @subsection Options
  13382. @table @option
  13383. @item input
  13384. Set path to the file used to read the transforms. Default value is
  13385. @file{transforms.trf}.
  13386. @item smoothing
  13387. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13388. camera movements. Default value is 10.
  13389. For example a number of 10 means that 21 frames are used (10 in the
  13390. past and 10 in the future) to smoothen the motion in the video. A
  13391. larger value leads to a smoother video, but limits the acceleration of
  13392. the camera (pan/tilt movements). 0 is a special case where a static
  13393. camera is simulated.
  13394. @item optalgo
  13395. Set the camera path optimization algorithm.
  13396. Accepted values are:
  13397. @table @samp
  13398. @item gauss
  13399. gaussian kernel low-pass filter on camera motion (default)
  13400. @item avg
  13401. averaging on transformations
  13402. @end table
  13403. @item maxshift
  13404. Set maximal number of pixels to translate frames. Default value is -1,
  13405. meaning no limit.
  13406. @item maxangle
  13407. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13408. value is -1, meaning no limit.
  13409. @item crop
  13410. Specify how to deal with borders that may be visible due to movement
  13411. compensation.
  13412. Available values are:
  13413. @table @samp
  13414. @item keep
  13415. keep image information from previous frame (default)
  13416. @item black
  13417. fill the border black
  13418. @end table
  13419. @item invert
  13420. Invert transforms if set to 1. Default value is 0.
  13421. @item relative
  13422. Consider transforms as relative to previous frame if set to 1,
  13423. absolute if set to 0. Default value is 0.
  13424. @item zoom
  13425. Set percentage to zoom. A positive value will result in a zoom-in
  13426. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13427. zoom).
  13428. @item optzoom
  13429. Set optimal zooming to avoid borders.
  13430. Accepted values are:
  13431. @table @samp
  13432. @item 0
  13433. disabled
  13434. @item 1
  13435. optimal static zoom value is determined (only very strong movements
  13436. will lead to visible borders) (default)
  13437. @item 2
  13438. optimal adaptive zoom value is determined (no borders will be
  13439. visible), see @option{zoomspeed}
  13440. @end table
  13441. Note that the value given at zoom is added to the one calculated here.
  13442. @item zoomspeed
  13443. Set percent to zoom maximally each frame (enabled when
  13444. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13445. 0.25.
  13446. @item interpol
  13447. Specify type of interpolation.
  13448. Available values are:
  13449. @table @samp
  13450. @item no
  13451. no interpolation
  13452. @item linear
  13453. linear only horizontal
  13454. @item bilinear
  13455. linear in both directions (default)
  13456. @item bicubic
  13457. cubic in both directions (slow)
  13458. @end table
  13459. @item tripod
  13460. Enable virtual tripod mode if set to 1, which is equivalent to
  13461. @code{relative=0:smoothing=0}. Default value is 0.
  13462. Use also @code{tripod} option of @ref{vidstabdetect}.
  13463. @item debug
  13464. Increase log verbosity if set to 1. Also the detected global motions
  13465. are written to the temporary file @file{global_motions.trf}. Default
  13466. value is 0.
  13467. @end table
  13468. @subsection Examples
  13469. @itemize
  13470. @item
  13471. Use @command{ffmpeg} for a typical stabilization with default values:
  13472. @example
  13473. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13474. @end example
  13475. Note the use of the @ref{unsharp} filter which is always recommended.
  13476. @item
  13477. Zoom in a bit more and load transform data from a given file:
  13478. @example
  13479. vidstabtransform=zoom=5:input="mytransforms.trf"
  13480. @end example
  13481. @item
  13482. Smoothen the video even more:
  13483. @example
  13484. vidstabtransform=smoothing=30
  13485. @end example
  13486. @end itemize
  13487. @section vflip
  13488. Flip the input video vertically.
  13489. For example, to vertically flip a video with @command{ffmpeg}:
  13490. @example
  13491. ffmpeg -i in.avi -vf "vflip" out.avi
  13492. @end example
  13493. @section vfrdet
  13494. Detect variable frame rate video.
  13495. This filter tries to detect if the input is variable or constant frame rate.
  13496. At end it will output number of frames detected as having variable delta pts,
  13497. and ones with constant delta pts.
  13498. If there was frames with variable delta, than it will also show min and max delta
  13499. encountered.
  13500. @section vibrance
  13501. Boost or alter saturation.
  13502. The filter accepts the following options:
  13503. @table @option
  13504. @item intensity
  13505. Set strength of boost if positive value or strength of alter if negative value.
  13506. Default is 0. Allowed range is from -2 to 2.
  13507. @item rbal
  13508. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13509. @item gbal
  13510. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13511. @item bbal
  13512. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13513. @item rlum
  13514. Set the red luma coefficient.
  13515. @item glum
  13516. Set the green luma coefficient.
  13517. @item blum
  13518. Set the blue luma coefficient.
  13519. @end table
  13520. @anchor{vignette}
  13521. @section vignette
  13522. Make or reverse a natural vignetting effect.
  13523. The filter accepts the following options:
  13524. @table @option
  13525. @item angle, a
  13526. Set lens angle expression as a number of radians.
  13527. The value is clipped in the @code{[0,PI/2]} range.
  13528. Default value: @code{"PI/5"}
  13529. @item x0
  13530. @item y0
  13531. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13532. by default.
  13533. @item mode
  13534. Set forward/backward mode.
  13535. Available modes are:
  13536. @table @samp
  13537. @item forward
  13538. The larger the distance from the central point, the darker the image becomes.
  13539. @item backward
  13540. The larger the distance from the central point, the brighter the image becomes.
  13541. This can be used to reverse a vignette effect, though there is no automatic
  13542. detection to extract the lens @option{angle} and other settings (yet). It can
  13543. also be used to create a burning effect.
  13544. @end table
  13545. Default value is @samp{forward}.
  13546. @item eval
  13547. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13548. It accepts the following values:
  13549. @table @samp
  13550. @item init
  13551. Evaluate expressions only once during the filter initialization.
  13552. @item frame
  13553. Evaluate expressions for each incoming frame. This is way slower than the
  13554. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13555. allows advanced dynamic expressions.
  13556. @end table
  13557. Default value is @samp{init}.
  13558. @item dither
  13559. Set dithering to reduce the circular banding effects. Default is @code{1}
  13560. (enabled).
  13561. @item aspect
  13562. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13563. Setting this value to the SAR of the input will make a rectangular vignetting
  13564. following the dimensions of the video.
  13565. Default is @code{1/1}.
  13566. @end table
  13567. @subsection Expressions
  13568. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13569. following parameters.
  13570. @table @option
  13571. @item w
  13572. @item h
  13573. input width and height
  13574. @item n
  13575. the number of input frame, starting from 0
  13576. @item pts
  13577. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13578. @var{TB} units, NAN if undefined
  13579. @item r
  13580. frame rate of the input video, NAN if the input frame rate is unknown
  13581. @item t
  13582. the PTS (Presentation TimeStamp) of the filtered video frame,
  13583. expressed in seconds, NAN if undefined
  13584. @item tb
  13585. time base of the input video
  13586. @end table
  13587. @subsection Examples
  13588. @itemize
  13589. @item
  13590. Apply simple strong vignetting effect:
  13591. @example
  13592. vignette=PI/4
  13593. @end example
  13594. @item
  13595. Make a flickering vignetting:
  13596. @example
  13597. vignette='PI/4+random(1)*PI/50':eval=frame
  13598. @end example
  13599. @end itemize
  13600. @section vmafmotion
  13601. Obtain the average vmaf motion score of a video.
  13602. It is one of the component filters of VMAF.
  13603. The obtained average motion score is printed through the logging system.
  13604. In the below example the input file @file{ref.mpg} is being processed and score
  13605. is computed.
  13606. @example
  13607. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13608. @end example
  13609. @section vstack
  13610. Stack input videos vertically.
  13611. All streams must be of same pixel format and of same width.
  13612. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13613. to create same output.
  13614. The filter accept the following option:
  13615. @table @option
  13616. @item inputs
  13617. Set number of input streams. Default is 2.
  13618. @item shortest
  13619. If set to 1, force the output to terminate when the shortest input
  13620. terminates. Default value is 0.
  13621. @end table
  13622. @section w3fdif
  13623. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13624. Deinterlacing Filter").
  13625. Based on the process described by Martin Weston for BBC R&D, and
  13626. implemented based on the de-interlace algorithm written by Jim
  13627. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13628. uses filter coefficients calculated by BBC R&D.
  13629. There are two sets of filter coefficients, so called "simple":
  13630. and "complex". Which set of filter coefficients is used can
  13631. be set by passing an optional parameter:
  13632. @table @option
  13633. @item filter
  13634. Set the interlacing filter coefficients. Accepts one of the following values:
  13635. @table @samp
  13636. @item simple
  13637. Simple filter coefficient set.
  13638. @item complex
  13639. More-complex filter coefficient set.
  13640. @end table
  13641. Default value is @samp{complex}.
  13642. @item deint
  13643. Specify which frames to deinterlace. Accept one of the following values:
  13644. @table @samp
  13645. @item all
  13646. Deinterlace all frames,
  13647. @item interlaced
  13648. Only deinterlace frames marked as interlaced.
  13649. @end table
  13650. Default value is @samp{all}.
  13651. @end table
  13652. @section waveform
  13653. Video waveform monitor.
  13654. The waveform monitor plots color component intensity. By default luminance
  13655. only. Each column of the waveform corresponds to a column of pixels in the
  13656. source video.
  13657. It accepts the following options:
  13658. @table @option
  13659. @item mode, m
  13660. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13661. In row mode, the graph on the left side represents color component value 0 and
  13662. the right side represents value = 255. In column mode, the top side represents
  13663. color component value = 0 and bottom side represents value = 255.
  13664. @item intensity, i
  13665. Set intensity. Smaller values are useful to find out how many values of the same
  13666. luminance are distributed across input rows/columns.
  13667. Default value is @code{0.04}. Allowed range is [0, 1].
  13668. @item mirror, r
  13669. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13670. In mirrored mode, higher values will be represented on the left
  13671. side for @code{row} mode and at the top for @code{column} mode. Default is
  13672. @code{1} (mirrored).
  13673. @item display, d
  13674. Set display mode.
  13675. It accepts the following values:
  13676. @table @samp
  13677. @item overlay
  13678. Presents information identical to that in the @code{parade}, except
  13679. that the graphs representing color components are superimposed directly
  13680. over one another.
  13681. This display mode makes it easier to spot relative differences or similarities
  13682. in overlapping areas of the color components that are supposed to be identical,
  13683. such as neutral whites, grays, or blacks.
  13684. @item stack
  13685. Display separate graph for the color components side by side in
  13686. @code{row} mode or one below the other in @code{column} mode.
  13687. @item parade
  13688. Display separate graph for the color components side by side in
  13689. @code{column} mode or one below the other in @code{row} mode.
  13690. Using this display mode makes it easy to spot color casts in the highlights
  13691. and shadows of an image, by comparing the contours of the top and the bottom
  13692. graphs of each waveform. Since whites, grays, and blacks are characterized
  13693. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13694. should display three waveforms of roughly equal width/height. If not, the
  13695. correction is easy to perform by making level adjustments the three waveforms.
  13696. @end table
  13697. Default is @code{stack}.
  13698. @item components, c
  13699. Set which color components to display. Default is 1, which means only luminance
  13700. or red color component if input is in RGB colorspace. If is set for example to
  13701. 7 it will display all 3 (if) available color components.
  13702. @item envelope, e
  13703. @table @samp
  13704. @item none
  13705. No envelope, this is default.
  13706. @item instant
  13707. Instant envelope, minimum and maximum values presented in graph will be easily
  13708. visible even with small @code{step} value.
  13709. @item peak
  13710. Hold minimum and maximum values presented in graph across time. This way you
  13711. can still spot out of range values without constantly looking at waveforms.
  13712. @item peak+instant
  13713. Peak and instant envelope combined together.
  13714. @end table
  13715. @item filter, f
  13716. @table @samp
  13717. @item lowpass
  13718. No filtering, this is default.
  13719. @item flat
  13720. Luma and chroma combined together.
  13721. @item aflat
  13722. Similar as above, but shows difference between blue and red chroma.
  13723. @item xflat
  13724. Similar as above, but use different colors.
  13725. @item chroma
  13726. Displays only chroma.
  13727. @item color
  13728. Displays actual color value on waveform.
  13729. @item acolor
  13730. Similar as above, but with luma showing frequency of chroma values.
  13731. @end table
  13732. @item graticule, g
  13733. Set which graticule to display.
  13734. @table @samp
  13735. @item none
  13736. Do not display graticule.
  13737. @item green
  13738. Display green graticule showing legal broadcast ranges.
  13739. @item orange
  13740. Display orange graticule showing legal broadcast ranges.
  13741. @end table
  13742. @item opacity, o
  13743. Set graticule opacity.
  13744. @item flags, fl
  13745. Set graticule flags.
  13746. @table @samp
  13747. @item numbers
  13748. Draw numbers above lines. By default enabled.
  13749. @item dots
  13750. Draw dots instead of lines.
  13751. @end table
  13752. @item scale, s
  13753. Set scale used for displaying graticule.
  13754. @table @samp
  13755. @item digital
  13756. @item millivolts
  13757. @item ire
  13758. @end table
  13759. Default is digital.
  13760. @item bgopacity, b
  13761. Set background opacity.
  13762. @end table
  13763. @section weave, doubleweave
  13764. The @code{weave} takes a field-based video input and join
  13765. each two sequential fields into single frame, producing a new double
  13766. height clip with half the frame rate and half the frame count.
  13767. The @code{doubleweave} works same as @code{weave} but without
  13768. halving frame rate and frame count.
  13769. It accepts the following option:
  13770. @table @option
  13771. @item first_field
  13772. Set first field. Available values are:
  13773. @table @samp
  13774. @item top, t
  13775. Set the frame as top-field-first.
  13776. @item bottom, b
  13777. Set the frame as bottom-field-first.
  13778. @end table
  13779. @end table
  13780. @subsection Examples
  13781. @itemize
  13782. @item
  13783. Interlace video using @ref{select} and @ref{separatefields} filter:
  13784. @example
  13785. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13786. @end example
  13787. @end itemize
  13788. @section xbr
  13789. Apply the xBR high-quality magnification filter which is designed for pixel
  13790. art. It follows a set of edge-detection rules, see
  13791. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13792. It accepts the following option:
  13793. @table @option
  13794. @item n
  13795. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13796. @code{3xBR} and @code{4} for @code{4xBR}.
  13797. Default is @code{3}.
  13798. @end table
  13799. @section xstack
  13800. Stack video inputs into custom layout.
  13801. All streams must be of same pixel format.
  13802. The filter accept the following option:
  13803. @table @option
  13804. @item inputs
  13805. Set number of input streams. Default is 2.
  13806. @item layout
  13807. Specify layout of inputs.
  13808. This option requires the desired layout configuration to be explicitly set by the user.
  13809. This sets position of each video input in output. Each input
  13810. is separated by '|'.
  13811. The first number represents the column, and the second number represents the row.
  13812. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  13813. where X is video input from which to take width or height.
  13814. Multiple values can be used when separated by '+'. In such
  13815. case values are summed together.
  13816. @item shortest
  13817. If set to 1, force the output to terminate when the shortest input
  13818. terminates. Default value is 0.
  13819. @end table
  13820. @subsection Examples
  13821. @itemize
  13822. @item
  13823. Display 4 inputs into 2x2 grid,
  13824. note that if inputs are of different sizes unused gaps might appear,
  13825. as not all of output video is used.
  13826. @example
  13827. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  13828. @end example
  13829. @item
  13830. Display 4 inputs into 1x4 grid,
  13831. note that if inputs are of different sizes unused gaps might appear,
  13832. as not all of output video is used.
  13833. @example
  13834. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  13835. @end example
  13836. @item
  13837. Display 9 inputs into 3x3 grid,
  13838. note that if inputs are of different sizes unused gaps might appear,
  13839. as not all of output video is used.
  13840. @example
  13841. xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
  13842. @end example
  13843. @end itemize
  13844. @anchor{yadif}
  13845. @section yadif
  13846. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13847. filter").
  13848. It accepts the following parameters:
  13849. @table @option
  13850. @item mode
  13851. The interlacing mode to adopt. It accepts one of the following values:
  13852. @table @option
  13853. @item 0, send_frame
  13854. Output one frame for each frame.
  13855. @item 1, send_field
  13856. Output one frame for each field.
  13857. @item 2, send_frame_nospatial
  13858. Like @code{send_frame}, but it skips the spatial interlacing check.
  13859. @item 3, send_field_nospatial
  13860. Like @code{send_field}, but it skips the spatial interlacing check.
  13861. @end table
  13862. The default value is @code{send_frame}.
  13863. @item parity
  13864. The picture field parity assumed for the input interlaced video. It accepts one
  13865. of the following values:
  13866. @table @option
  13867. @item 0, tff
  13868. Assume the top field is first.
  13869. @item 1, bff
  13870. Assume the bottom field is first.
  13871. @item -1, auto
  13872. Enable automatic detection of field parity.
  13873. @end table
  13874. The default value is @code{auto}.
  13875. If the interlacing is unknown or the decoder does not export this information,
  13876. top field first will be assumed.
  13877. @item deint
  13878. Specify which frames to deinterlace. Accept one of the following
  13879. values:
  13880. @table @option
  13881. @item 0, all
  13882. Deinterlace all frames.
  13883. @item 1, interlaced
  13884. Only deinterlace frames marked as interlaced.
  13885. @end table
  13886. The default value is @code{all}.
  13887. @end table
  13888. @section yadif_cuda
  13889. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  13890. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  13891. and/or nvenc.
  13892. It accepts the following parameters:
  13893. @table @option
  13894. @item mode
  13895. The interlacing mode to adopt. It accepts one of the following values:
  13896. @table @option
  13897. @item 0, send_frame
  13898. Output one frame for each frame.
  13899. @item 1, send_field
  13900. Output one frame for each field.
  13901. @item 2, send_frame_nospatial
  13902. Like @code{send_frame}, but it skips the spatial interlacing check.
  13903. @item 3, send_field_nospatial
  13904. Like @code{send_field}, but it skips the spatial interlacing check.
  13905. @end table
  13906. The default value is @code{send_frame}.
  13907. @item parity
  13908. The picture field parity assumed for the input interlaced video. It accepts one
  13909. of the following values:
  13910. @table @option
  13911. @item 0, tff
  13912. Assume the top field is first.
  13913. @item 1, bff
  13914. Assume the bottom field is first.
  13915. @item -1, auto
  13916. Enable automatic detection of field parity.
  13917. @end table
  13918. The default value is @code{auto}.
  13919. If the interlacing is unknown or the decoder does not export this information,
  13920. top field first will be assumed.
  13921. @item deint
  13922. Specify which frames to deinterlace. Accept one of the following
  13923. values:
  13924. @table @option
  13925. @item 0, all
  13926. Deinterlace all frames.
  13927. @item 1, interlaced
  13928. Only deinterlace frames marked as interlaced.
  13929. @end table
  13930. The default value is @code{all}.
  13931. @end table
  13932. @section zoompan
  13933. Apply Zoom & Pan effect.
  13934. This filter accepts the following options:
  13935. @table @option
  13936. @item zoom, z
  13937. Set the zoom expression. Default is 1.
  13938. @item x
  13939. @item y
  13940. Set the x and y expression. Default is 0.
  13941. @item d
  13942. Set the duration expression in number of frames.
  13943. This sets for how many number of frames effect will last for
  13944. single input image.
  13945. @item s
  13946. Set the output image size, default is 'hd720'.
  13947. @item fps
  13948. Set the output frame rate, default is '25'.
  13949. @end table
  13950. Each expression can contain the following constants:
  13951. @table @option
  13952. @item in_w, iw
  13953. Input width.
  13954. @item in_h, ih
  13955. Input height.
  13956. @item out_w, ow
  13957. Output width.
  13958. @item out_h, oh
  13959. Output height.
  13960. @item in
  13961. Input frame count.
  13962. @item on
  13963. Output frame count.
  13964. @item x
  13965. @item y
  13966. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  13967. for current input frame.
  13968. @item px
  13969. @item py
  13970. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  13971. not yet such frame (first input frame).
  13972. @item zoom
  13973. Last calculated zoom from 'z' expression for current input frame.
  13974. @item pzoom
  13975. Last calculated zoom of last output frame of previous input frame.
  13976. @item duration
  13977. Number of output frames for current input frame. Calculated from 'd' expression
  13978. for each input frame.
  13979. @item pduration
  13980. number of output frames created for previous input frame
  13981. @item a
  13982. Rational number: input width / input height
  13983. @item sar
  13984. sample aspect ratio
  13985. @item dar
  13986. display aspect ratio
  13987. @end table
  13988. @subsection Examples
  13989. @itemize
  13990. @item
  13991. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  13992. @example
  13993. 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
  13994. @end example
  13995. @item
  13996. Zoom-in up to 1.5 and pan always at center of picture:
  13997. @example
  13998. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13999. @end example
  14000. @item
  14001. Same as above but without pausing:
  14002. @example
  14003. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14004. @end example
  14005. @end itemize
  14006. @anchor{zscale}
  14007. @section zscale
  14008. Scale (resize) the input video, using the z.lib library:
  14009. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14010. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14011. The zscale filter forces the output display aspect ratio to be the same
  14012. as the input, by changing the output sample aspect ratio.
  14013. If the input image format is different from the format requested by
  14014. the next filter, the zscale filter will convert the input to the
  14015. requested format.
  14016. @subsection Options
  14017. The filter accepts the following options.
  14018. @table @option
  14019. @item width, w
  14020. @item height, h
  14021. Set the output video dimension expression. Default value is the input
  14022. dimension.
  14023. If the @var{width} or @var{w} value is 0, the input width is used for
  14024. the output. If the @var{height} or @var{h} value is 0, the input height
  14025. is used for the output.
  14026. If one and only one of the values is -n with n >= 1, the zscale filter
  14027. will use a value that maintains the aspect ratio of the input image,
  14028. calculated from the other specified dimension. After that it will,
  14029. however, make sure that the calculated dimension is divisible by n and
  14030. adjust the value if necessary.
  14031. If both values are -n with n >= 1, the behavior will be identical to
  14032. both values being set to 0 as previously detailed.
  14033. See below for the list of accepted constants for use in the dimension
  14034. expression.
  14035. @item size, s
  14036. Set the video size. For the syntax of this option, check the
  14037. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14038. @item dither, d
  14039. Set the dither type.
  14040. Possible values are:
  14041. @table @var
  14042. @item none
  14043. @item ordered
  14044. @item random
  14045. @item error_diffusion
  14046. @end table
  14047. Default is none.
  14048. @item filter, f
  14049. Set the resize filter type.
  14050. Possible values are:
  14051. @table @var
  14052. @item point
  14053. @item bilinear
  14054. @item bicubic
  14055. @item spline16
  14056. @item spline36
  14057. @item lanczos
  14058. @end table
  14059. Default is bilinear.
  14060. @item range, r
  14061. Set the color range.
  14062. Possible values are:
  14063. @table @var
  14064. @item input
  14065. @item limited
  14066. @item full
  14067. @end table
  14068. Default is same as input.
  14069. @item primaries, p
  14070. Set the color primaries.
  14071. Possible values are:
  14072. @table @var
  14073. @item input
  14074. @item 709
  14075. @item unspecified
  14076. @item 170m
  14077. @item 240m
  14078. @item 2020
  14079. @end table
  14080. Default is same as input.
  14081. @item transfer, t
  14082. Set the transfer characteristics.
  14083. Possible values are:
  14084. @table @var
  14085. @item input
  14086. @item 709
  14087. @item unspecified
  14088. @item 601
  14089. @item linear
  14090. @item 2020_10
  14091. @item 2020_12
  14092. @item smpte2084
  14093. @item iec61966-2-1
  14094. @item arib-std-b67
  14095. @end table
  14096. Default is same as input.
  14097. @item matrix, m
  14098. Set the colorspace matrix.
  14099. Possible value are:
  14100. @table @var
  14101. @item input
  14102. @item 709
  14103. @item unspecified
  14104. @item 470bg
  14105. @item 170m
  14106. @item 2020_ncl
  14107. @item 2020_cl
  14108. @end table
  14109. Default is same as input.
  14110. @item rangein, rin
  14111. Set the input color range.
  14112. Possible values are:
  14113. @table @var
  14114. @item input
  14115. @item limited
  14116. @item full
  14117. @end table
  14118. Default is same as input.
  14119. @item primariesin, pin
  14120. Set the input color primaries.
  14121. Possible values are:
  14122. @table @var
  14123. @item input
  14124. @item 709
  14125. @item unspecified
  14126. @item 170m
  14127. @item 240m
  14128. @item 2020
  14129. @end table
  14130. Default is same as input.
  14131. @item transferin, tin
  14132. Set the input transfer characteristics.
  14133. Possible values are:
  14134. @table @var
  14135. @item input
  14136. @item 709
  14137. @item unspecified
  14138. @item 601
  14139. @item linear
  14140. @item 2020_10
  14141. @item 2020_12
  14142. @end table
  14143. Default is same as input.
  14144. @item matrixin, min
  14145. Set the input colorspace matrix.
  14146. Possible value are:
  14147. @table @var
  14148. @item input
  14149. @item 709
  14150. @item unspecified
  14151. @item 470bg
  14152. @item 170m
  14153. @item 2020_ncl
  14154. @item 2020_cl
  14155. @end table
  14156. @item chromal, c
  14157. Set the output chroma location.
  14158. Possible values are:
  14159. @table @var
  14160. @item input
  14161. @item left
  14162. @item center
  14163. @item topleft
  14164. @item top
  14165. @item bottomleft
  14166. @item bottom
  14167. @end table
  14168. @item chromalin, cin
  14169. Set the input chroma location.
  14170. Possible values are:
  14171. @table @var
  14172. @item input
  14173. @item left
  14174. @item center
  14175. @item topleft
  14176. @item top
  14177. @item bottomleft
  14178. @item bottom
  14179. @end table
  14180. @item npl
  14181. Set the nominal peak luminance.
  14182. @end table
  14183. The values of the @option{w} and @option{h} options are expressions
  14184. containing the following constants:
  14185. @table @var
  14186. @item in_w
  14187. @item in_h
  14188. The input width and height
  14189. @item iw
  14190. @item ih
  14191. These are the same as @var{in_w} and @var{in_h}.
  14192. @item out_w
  14193. @item out_h
  14194. The output (scaled) width and height
  14195. @item ow
  14196. @item oh
  14197. These are the same as @var{out_w} and @var{out_h}
  14198. @item a
  14199. The same as @var{iw} / @var{ih}
  14200. @item sar
  14201. input sample aspect ratio
  14202. @item dar
  14203. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14204. @item hsub
  14205. @item vsub
  14206. horizontal and vertical input chroma subsample values. For example for the
  14207. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14208. @item ohsub
  14209. @item ovsub
  14210. horizontal and vertical output chroma subsample values. For example for the
  14211. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14212. @end table
  14213. @table @option
  14214. @end table
  14215. @c man end VIDEO FILTERS
  14216. @chapter OpenCL Video Filters
  14217. @c man begin OPENCL VIDEO FILTERS
  14218. Below is a description of the currently available OpenCL video filters.
  14219. To enable compilation of these filters you need to configure FFmpeg with
  14220. @code{--enable-opencl}.
  14221. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14222. @table @option
  14223. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14224. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14225. given device parameters.
  14226. @item -filter_hw_device @var{name}
  14227. Pass the hardware device called @var{name} to all filters in any filter graph.
  14228. @end table
  14229. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14230. @itemize
  14231. @item
  14232. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14233. @example
  14234. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14235. @end example
  14236. @end itemize
  14237. Since OpenCL filters are not able to access frame data in normal memory, all frame data needs to be uploaded(@ref{hwupload}) to hardware surfaces connected to the appropriate device before being used and then downloaded(@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} will upload to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before to get the input into the right format and @ref{hwdownload} does not support all formats on the output - it may be necessary to insert an additional @ref{format} filter immediately following in the graph to get the output in a supported format.
  14238. @section avgblur_opencl
  14239. Apply average blur filter.
  14240. The filter accepts the following options:
  14241. @table @option
  14242. @item sizeX
  14243. Set horizontal radius size.
  14244. Range is @code{[1, 1024]} and default value is @code{1}.
  14245. @item planes
  14246. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14247. @item sizeY
  14248. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14249. @end table
  14250. @subsection Example
  14251. @itemize
  14252. @item
  14253. Apply average blur filter with horizontal and vertical size of 3, setting each pixel of the output to the average value of the 7x7 region centered on it in the input. For pixels on the edges of the image, the region does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  14254. @example
  14255. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14256. @end example
  14257. @end itemize
  14258. @section boxblur_opencl
  14259. Apply a boxblur algorithm to the input video.
  14260. It accepts the following parameters:
  14261. @table @option
  14262. @item luma_radius, lr
  14263. @item luma_power, lp
  14264. @item chroma_radius, cr
  14265. @item chroma_power, cp
  14266. @item alpha_radius, ar
  14267. @item alpha_power, ap
  14268. @end table
  14269. A description of the accepted options follows.
  14270. @table @option
  14271. @item luma_radius, lr
  14272. @item chroma_radius, cr
  14273. @item alpha_radius, ar
  14274. Set an expression for the box radius in pixels used for blurring the
  14275. corresponding input plane.
  14276. The radius value must be a non-negative number, and must not be
  14277. greater than the value of the expression @code{min(w,h)/2} for the
  14278. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14279. planes.
  14280. Default value for @option{luma_radius} is "2". If not specified,
  14281. @option{chroma_radius} and @option{alpha_radius} default to the
  14282. corresponding value set for @option{luma_radius}.
  14283. The expressions can contain the following constants:
  14284. @table @option
  14285. @item w
  14286. @item h
  14287. The input width and height in pixels.
  14288. @item cw
  14289. @item ch
  14290. The input chroma image width and height in pixels.
  14291. @item hsub
  14292. @item vsub
  14293. The horizontal and vertical chroma subsample values. For example, for the
  14294. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14295. @end table
  14296. @item luma_power, lp
  14297. @item chroma_power, cp
  14298. @item alpha_power, ap
  14299. Specify how many times the boxblur filter is applied to the
  14300. corresponding plane.
  14301. Default value for @option{luma_power} is 2. If not specified,
  14302. @option{chroma_power} and @option{alpha_power} default to the
  14303. corresponding value set for @option{luma_power}.
  14304. A value of 0 will disable the effect.
  14305. @end table
  14306. @subsection Examples
  14307. Apply boxblur filter, setting each pixel of the output to the average value of box-radiuses @var{luma_radius}, @var{chroma_radius}, @var{alpha_radius} for each plane respectively. The filter will apply @var{luma_power}, @var{chroma_power}, @var{alpha_power} times onto the corresponding plane. For pixels on the edges of the image, the radius does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  14308. @itemize
  14309. @item
  14310. Apply a boxblur filter with the luma, chroma, and alpha radius
  14311. set to 2 and luma, chroma, and alpha power set to 3. The filter will run 3 times with box-radius set to 2 for every plane of the image.
  14312. @example
  14313. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14314. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14315. @end example
  14316. @item
  14317. Apply a boxblur filter with luma radius set to 2, luma_power to 1, chroma_radius to 4, chroma_power to 5, alpha_radius to 3 and alpha_power to 7.
  14318. For the luma plane, a 2x2 box radius will be run once.
  14319. For the chroma plane, a 4x4 box radius will be run 5 times.
  14320. For the alpha plane, a 3x3 box radius will be run 7 times.
  14321. @example
  14322. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14323. @end example
  14324. @end itemize
  14325. @section convolution_opencl
  14326. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14327. The filter accepts the following options:
  14328. @table @option
  14329. @item 0m
  14330. @item 1m
  14331. @item 2m
  14332. @item 3m
  14333. Set matrix for each plane.
  14334. Matrix is sequence of 9, 25 or 49 signed numbers.
  14335. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14336. @item 0rdiv
  14337. @item 1rdiv
  14338. @item 2rdiv
  14339. @item 3rdiv
  14340. Set multiplier for calculated value for each plane.
  14341. If unset or 0, it will be sum of all matrix elements.
  14342. The option value must be an float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14343. @item 0bias
  14344. @item 1bias
  14345. @item 2bias
  14346. @item 3bias
  14347. Set bias for each plane. This value is added to the result of the multiplication.
  14348. Useful for making the overall image brighter or darker.
  14349. The option value must be an float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14350. @end table
  14351. @subsection Examples
  14352. @itemize
  14353. @item
  14354. Apply sharpen:
  14355. @example
  14356. -i INPUT -vf "hwupload, convolution_opencl=0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0, hwdownload" OUTPUT
  14357. @end example
  14358. @item
  14359. Apply blur:
  14360. @example
  14361. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9, hwdownload" OUTPUT
  14362. @end example
  14363. @item
  14364. Apply edge enhance:
  14365. @example
  14366. -i INPUT -vf "hwupload, convolution_opencl=0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128, hwdownload" OUTPUT
  14367. @end example
  14368. @item
  14369. Apply edge detect:
  14370. @example
  14371. -i INPUT -vf "hwupload, convolution_opencl=0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128, hwdownload" OUTPUT
  14372. @end example
  14373. @item
  14374. Apply laplacian edge detector which includes diagonals:
  14375. @example
  14376. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0, hwdownload" OUTPUT
  14377. @end example
  14378. @item
  14379. Apply emboss:
  14380. @example
  14381. -i INPUT -vf "hwupload, convolution_opencl=-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2, hwdownload" OUTPUT
  14382. @end example
  14383. @end itemize
  14384. @section dilation_opencl
  14385. Apply dilation effect to the video.
  14386. This filter replaces the pixel by the local(3x3) maximum.
  14387. It accepts the following options:
  14388. @table @option
  14389. @item threshold0
  14390. @item threshold1
  14391. @item threshold2
  14392. @item threshold3
  14393. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14394. If @code{0}, plane will remain unchanged.
  14395. @item coordinates
  14396. Flag which specifies the pixel to refer to.
  14397. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14398. Flags to local 3x3 coordinates region centered on @code{x}:
  14399. 1 2 3
  14400. 4 x 5
  14401. 6 7 8
  14402. @end table
  14403. @subsection Example
  14404. @itemize
  14405. @item
  14406. Apply dilation filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local maximum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local maximum is more then threshold of the corresponding plane, output pixel will be set to input pixel + threshold of corresponding plane.
  14407. @example
  14408. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14409. @end example
  14410. @end itemize
  14411. @section erosion_opencl
  14412. Apply erosion effect to the video.
  14413. This filter replaces the pixel by the local(3x3) minimum.
  14414. It accepts the following options:
  14415. @table @option
  14416. @item threshold0
  14417. @item threshold1
  14418. @item threshold2
  14419. @item threshold3
  14420. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14421. If @code{0}, plane will remain unchanged.
  14422. @item coordinates
  14423. Flag which specifies the pixel to refer to.
  14424. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14425. Flags to local 3x3 coordinates region centered on @code{x}:
  14426. 1 2 3
  14427. 4 x 5
  14428. 6 7 8
  14429. @end table
  14430. @subsection Example
  14431. @itemize
  14432. @item
  14433. Apply erosion filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local minimum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local minimum is more then threshold of the corresponding plane, output pixel will be set to input pixel - threshold of corresponding plane.
  14434. @example
  14435. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14436. @end example
  14437. @end itemize
  14438. @section overlay_opencl
  14439. Overlay one video on top of another.
  14440. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14441. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14442. The filter accepts the following options:
  14443. @table @option
  14444. @item x
  14445. Set the x coordinate of the overlaid video on the main video.
  14446. Default value is @code{0}.
  14447. @item y
  14448. Set the x coordinate of the overlaid video on the main video.
  14449. Default value is @code{0}.
  14450. @end table
  14451. @subsection Examples
  14452. @itemize
  14453. @item
  14454. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14455. @example
  14456. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14457. @end example
  14458. @item
  14459. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14460. @example
  14461. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14462. @end example
  14463. @end itemize
  14464. @section prewitt_opencl
  14465. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14466. The filter accepts the following option:
  14467. @table @option
  14468. @item planes
  14469. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14470. @item scale
  14471. Set value which will be multiplied with filtered result.
  14472. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14473. @item delta
  14474. Set value which will be added to filtered result.
  14475. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14476. @end table
  14477. @subsection Example
  14478. @itemize
  14479. @item
  14480. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14481. @example
  14482. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14483. @end example
  14484. @end itemize
  14485. @section roberts_opencl
  14486. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14487. The filter accepts the following option:
  14488. @table @option
  14489. @item planes
  14490. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14491. @item scale
  14492. Set value which will be multiplied with filtered result.
  14493. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14494. @item delta
  14495. Set value which will be added to filtered result.
  14496. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14497. @end table
  14498. @subsection Example
  14499. @itemize
  14500. @item
  14501. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14502. @example
  14503. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14504. @end example
  14505. @end itemize
  14506. @section sobel_opencl
  14507. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14508. The filter accepts the following option:
  14509. @table @option
  14510. @item planes
  14511. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14512. @item scale
  14513. Set value which will be multiplied with filtered result.
  14514. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14515. @item delta
  14516. Set value which will be added to filtered result.
  14517. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14518. @end table
  14519. @subsection Example
  14520. @itemize
  14521. @item
  14522. Apply sobel operator with scale set to 2 and delta set to 10
  14523. @example
  14524. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14525. @end example
  14526. @end itemize
  14527. @section tonemap_opencl
  14528. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14529. It accepts the following parameters:
  14530. @table @option
  14531. @item tonemap
  14532. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14533. @item param
  14534. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14535. @item desat
  14536. Apply desaturation for highlights that exceed this level of brightness. The
  14537. higher the parameter, the more color information will be preserved. This
  14538. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14539. (smoothly) turning into white instead. This makes images feel more natural,
  14540. at the cost of reducing information about out-of-range colors.
  14541. The default value is 0.5, and the algorithm here is a little different from
  14542. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14543. @item threshold
  14544. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14545. is used to detect whether the scene has changed or not. If the distance beween
  14546. the current frame average brightness and the current running average exceeds
  14547. a threshold value, we would re-calculate scene average and peak brightness.
  14548. The default value is 0.2.
  14549. @item format
  14550. Specify the output pixel format.
  14551. Currently supported formats are:
  14552. @table @var
  14553. @item p010
  14554. @item nv12
  14555. @end table
  14556. @item range, r
  14557. Set the output color range.
  14558. Possible values are:
  14559. @table @var
  14560. @item tv/mpeg
  14561. @item pc/jpeg
  14562. @end table
  14563. Default is same as input.
  14564. @item primaries, p
  14565. Set the output color primaries.
  14566. Possible values are:
  14567. @table @var
  14568. @item bt709
  14569. @item bt2020
  14570. @end table
  14571. Default is same as input.
  14572. @item transfer, t
  14573. Set the output transfer characteristics.
  14574. Possible values are:
  14575. @table @var
  14576. @item bt709
  14577. @item bt2020
  14578. @end table
  14579. Default is bt709.
  14580. @item matrix, m
  14581. Set the output colorspace matrix.
  14582. Possible value are:
  14583. @table @var
  14584. @item bt709
  14585. @item bt2020
  14586. @end table
  14587. Default is same as input.
  14588. @end table
  14589. @subsection Example
  14590. @itemize
  14591. @item
  14592. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14593. @example
  14594. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14595. @end example
  14596. @end itemize
  14597. @section unsharp_opencl
  14598. Sharpen or blur the input video.
  14599. It accepts the following parameters:
  14600. @table @option
  14601. @item luma_msize_x, lx
  14602. Set the luma matrix horizontal size.
  14603. Range is @code{[1, 23]} and default value is @code{5}.
  14604. @item luma_msize_y, ly
  14605. Set the luma matrix vertical size.
  14606. Range is @code{[1, 23]} and default value is @code{5}.
  14607. @item luma_amount, la
  14608. Set the luma effect strength.
  14609. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14610. Negative values will blur the input video, while positive values will
  14611. sharpen it, a value of zero will disable the effect.
  14612. @item chroma_msize_x, cx
  14613. Set the chroma matrix horizontal size.
  14614. Range is @code{[1, 23]} and default value is @code{5}.
  14615. @item chroma_msize_y, cy
  14616. Set the chroma matrix vertical size.
  14617. Range is @code{[1, 23]} and default value is @code{5}.
  14618. @item chroma_amount, ca
  14619. Set the chroma effect strength.
  14620. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14621. Negative values will blur the input video, while positive values will
  14622. sharpen it, a value of zero will disable the effect.
  14623. @end table
  14624. All parameters are optional and default to the equivalent of the
  14625. string '5:5:1.0:5:5:0.0'.
  14626. @subsection Examples
  14627. @itemize
  14628. @item
  14629. Apply strong luma sharpen effect:
  14630. @example
  14631. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14632. @end example
  14633. @item
  14634. Apply a strong blur of both luma and chroma parameters:
  14635. @example
  14636. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14637. @end example
  14638. @end itemize
  14639. @c man end OPENCL VIDEO FILTERS
  14640. @chapter Video Sources
  14641. @c man begin VIDEO SOURCES
  14642. Below is a description of the currently available video sources.
  14643. @section buffer
  14644. Buffer video frames, and make them available to the filter chain.
  14645. This source is mainly intended for a programmatic use, in particular
  14646. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14647. It accepts the following parameters:
  14648. @table @option
  14649. @item video_size
  14650. Specify the size (width and height) of the buffered video frames. For the
  14651. syntax of this option, check the
  14652. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14653. @item width
  14654. The input video width.
  14655. @item height
  14656. The input video height.
  14657. @item pix_fmt
  14658. A string representing the pixel format of the buffered video frames.
  14659. It may be a number corresponding to a pixel format, or a pixel format
  14660. name.
  14661. @item time_base
  14662. Specify the timebase assumed by the timestamps of the buffered frames.
  14663. @item frame_rate
  14664. Specify the frame rate expected for the video stream.
  14665. @item pixel_aspect, sar
  14666. The sample (pixel) aspect ratio of the input video.
  14667. @item sws_param
  14668. Specify the optional parameters to be used for the scale filter which
  14669. is automatically inserted when an input change is detected in the
  14670. input size or format.
  14671. @item hw_frames_ctx
  14672. When using a hardware pixel format, this should be a reference to an
  14673. AVHWFramesContext describing input frames.
  14674. @end table
  14675. For example:
  14676. @example
  14677. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14678. @end example
  14679. will instruct the source to accept video frames with size 320x240 and
  14680. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14681. square pixels (1:1 sample aspect ratio).
  14682. Since the pixel format with name "yuv410p" corresponds to the number 6
  14683. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14684. this example corresponds to:
  14685. @example
  14686. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14687. @end example
  14688. Alternatively, the options can be specified as a flat string, but this
  14689. syntax is deprecated:
  14690. @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}]
  14691. @section cellauto
  14692. Create a pattern generated by an elementary cellular automaton.
  14693. The initial state of the cellular automaton can be defined through the
  14694. @option{filename} and @option{pattern} options. If such options are
  14695. not specified an initial state is created randomly.
  14696. At each new frame a new row in the video is filled with the result of
  14697. the cellular automaton next generation. The behavior when the whole
  14698. frame is filled is defined by the @option{scroll} option.
  14699. This source accepts the following options:
  14700. @table @option
  14701. @item filename, f
  14702. Read the initial cellular automaton state, i.e. the starting row, from
  14703. the specified file.
  14704. In the file, each non-whitespace character is considered an alive
  14705. cell, a newline will terminate the row, and further characters in the
  14706. file will be ignored.
  14707. @item pattern, p
  14708. Read the initial cellular automaton state, i.e. the starting row, from
  14709. the specified string.
  14710. Each non-whitespace character in the string is considered an alive
  14711. cell, a newline will terminate the row, and further characters in the
  14712. string will be ignored.
  14713. @item rate, r
  14714. Set the video rate, that is the number of frames generated per second.
  14715. Default is 25.
  14716. @item random_fill_ratio, ratio
  14717. Set the random fill ratio for the initial cellular automaton row. It
  14718. is a floating point number value ranging from 0 to 1, defaults to
  14719. 1/PHI.
  14720. This option is ignored when a file or a pattern is specified.
  14721. @item random_seed, seed
  14722. Set the seed for filling randomly the initial row, must be an integer
  14723. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14724. set to -1, the filter will try to use a good random seed on a best
  14725. effort basis.
  14726. @item rule
  14727. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  14728. Default value is 110.
  14729. @item size, s
  14730. Set the size of the output video. For the syntax of this option, check the
  14731. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14732. If @option{filename} or @option{pattern} is specified, the size is set
  14733. by default to the width of the specified initial state row, and the
  14734. height is set to @var{width} * PHI.
  14735. If @option{size} is set, it must contain the width of the specified
  14736. pattern string, and the specified pattern will be centered in the
  14737. larger row.
  14738. If a filename or a pattern string is not specified, the size value
  14739. defaults to "320x518" (used for a randomly generated initial state).
  14740. @item scroll
  14741. If set to 1, scroll the output upward when all the rows in the output
  14742. have been already filled. If set to 0, the new generated row will be
  14743. written over the top row just after the bottom row is filled.
  14744. Defaults to 1.
  14745. @item start_full, full
  14746. If set to 1, completely fill the output with generated rows before
  14747. outputting the first frame.
  14748. This is the default behavior, for disabling set the value to 0.
  14749. @item stitch
  14750. If set to 1, stitch the left and right row edges together.
  14751. This is the default behavior, for disabling set the value to 0.
  14752. @end table
  14753. @subsection Examples
  14754. @itemize
  14755. @item
  14756. Read the initial state from @file{pattern}, and specify an output of
  14757. size 200x400.
  14758. @example
  14759. cellauto=f=pattern:s=200x400
  14760. @end example
  14761. @item
  14762. Generate a random initial row with a width of 200 cells, with a fill
  14763. ratio of 2/3:
  14764. @example
  14765. cellauto=ratio=2/3:s=200x200
  14766. @end example
  14767. @item
  14768. Create a pattern generated by rule 18 starting by a single alive cell
  14769. centered on an initial row with width 100:
  14770. @example
  14771. cellauto=p=@@:s=100x400:full=0:rule=18
  14772. @end example
  14773. @item
  14774. Specify a more elaborated initial pattern:
  14775. @example
  14776. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  14777. @end example
  14778. @end itemize
  14779. @anchor{coreimagesrc}
  14780. @section coreimagesrc
  14781. Video source generated on GPU using Apple's CoreImage API on OSX.
  14782. This video source is a specialized version of the @ref{coreimage} video filter.
  14783. Use a core image generator at the beginning of the applied filterchain to
  14784. generate the content.
  14785. The coreimagesrc video source accepts the following options:
  14786. @table @option
  14787. @item list_generators
  14788. List all available generators along with all their respective options as well as
  14789. possible minimum and maximum values along with the default values.
  14790. @example
  14791. list_generators=true
  14792. @end example
  14793. @item size, s
  14794. Specify the size of the sourced video. For the syntax of this option, check the
  14795. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14796. The default value is @code{320x240}.
  14797. @item rate, r
  14798. Specify the frame rate of the sourced video, as the number of frames
  14799. generated per second. It has to be a string in the format
  14800. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14801. number or a valid video frame rate abbreviation. The default value is
  14802. "25".
  14803. @item sar
  14804. Set the sample aspect ratio of the sourced video.
  14805. @item duration, d
  14806. Set the duration of the sourced video. See
  14807. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14808. for the accepted syntax.
  14809. If not specified, or the expressed duration is negative, the video is
  14810. supposed to be generated forever.
  14811. @end table
  14812. Additionally, all options of the @ref{coreimage} video filter are accepted.
  14813. A complete filterchain can be used for further processing of the
  14814. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  14815. and examples for details.
  14816. @subsection Examples
  14817. @itemize
  14818. @item
  14819. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  14820. given as complete and escaped command-line for Apple's standard bash shell:
  14821. @example
  14822. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  14823. @end example
  14824. This example is equivalent to the QRCode example of @ref{coreimage} without the
  14825. need for a nullsrc video source.
  14826. @end itemize
  14827. @section mandelbrot
  14828. Generate a Mandelbrot set fractal, and progressively zoom towards the
  14829. point specified with @var{start_x} and @var{start_y}.
  14830. This source accepts the following options:
  14831. @table @option
  14832. @item end_pts
  14833. Set the terminal pts value. Default value is 400.
  14834. @item end_scale
  14835. Set the terminal scale value.
  14836. Must be a floating point value. Default value is 0.3.
  14837. @item inner
  14838. Set the inner coloring mode, that is the algorithm used to draw the
  14839. Mandelbrot fractal internal region.
  14840. It shall assume one of the following values:
  14841. @table @option
  14842. @item black
  14843. Set black mode.
  14844. @item convergence
  14845. Show time until convergence.
  14846. @item mincol
  14847. Set color based on point closest to the origin of the iterations.
  14848. @item period
  14849. Set period mode.
  14850. @end table
  14851. Default value is @var{mincol}.
  14852. @item bailout
  14853. Set the bailout value. Default value is 10.0.
  14854. @item maxiter
  14855. Set the maximum of iterations performed by the rendering
  14856. algorithm. Default value is 7189.
  14857. @item outer
  14858. Set outer coloring mode.
  14859. It shall assume one of following values:
  14860. @table @option
  14861. @item iteration_count
  14862. Set iteration cound mode.
  14863. @item normalized_iteration_count
  14864. set normalized iteration count mode.
  14865. @end table
  14866. Default value is @var{normalized_iteration_count}.
  14867. @item rate, r
  14868. Set frame rate, expressed as number of frames per second. Default
  14869. value is "25".
  14870. @item size, s
  14871. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  14872. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  14873. @item start_scale
  14874. Set the initial scale value. Default value is 3.0.
  14875. @item start_x
  14876. Set the initial x position. Must be a floating point value between
  14877. -100 and 100. Default value is -0.743643887037158704752191506114774.
  14878. @item start_y
  14879. Set the initial y position. Must be a floating point value between
  14880. -100 and 100. Default value is -0.131825904205311970493132056385139.
  14881. @end table
  14882. @section mptestsrc
  14883. Generate various test patterns, as generated by the MPlayer test filter.
  14884. The size of the generated video is fixed, and is 256x256.
  14885. This source is useful in particular for testing encoding features.
  14886. This source accepts the following options:
  14887. @table @option
  14888. @item rate, r
  14889. Specify the frame rate of the sourced video, as the number of frames
  14890. generated per second. It has to be a string in the format
  14891. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14892. number or a valid video frame rate abbreviation. The default value is
  14893. "25".
  14894. @item duration, d
  14895. Set the duration of the sourced video. See
  14896. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14897. for the accepted syntax.
  14898. If not specified, or the expressed duration is negative, the video is
  14899. supposed to be generated forever.
  14900. @item test, t
  14901. Set the number or the name of the test to perform. Supported tests are:
  14902. @table @option
  14903. @item dc_luma
  14904. @item dc_chroma
  14905. @item freq_luma
  14906. @item freq_chroma
  14907. @item amp_luma
  14908. @item amp_chroma
  14909. @item cbp
  14910. @item mv
  14911. @item ring1
  14912. @item ring2
  14913. @item all
  14914. @end table
  14915. Default value is "all", which will cycle through the list of all tests.
  14916. @end table
  14917. Some examples:
  14918. @example
  14919. mptestsrc=t=dc_luma
  14920. @end example
  14921. will generate a "dc_luma" test pattern.
  14922. @section frei0r_src
  14923. Provide a frei0r source.
  14924. To enable compilation of this filter you need to install the frei0r
  14925. header and configure FFmpeg with @code{--enable-frei0r}.
  14926. This source accepts the following parameters:
  14927. @table @option
  14928. @item size
  14929. The size of the video to generate. For the syntax of this option, check the
  14930. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14931. @item framerate
  14932. The framerate of the generated video. It may be a string of the form
  14933. @var{num}/@var{den} or a frame rate abbreviation.
  14934. @item filter_name
  14935. The name to the frei0r source to load. For more information regarding frei0r and
  14936. how to set the parameters, read the @ref{frei0r} section in the video filters
  14937. documentation.
  14938. @item filter_params
  14939. A '|'-separated list of parameters to pass to the frei0r source.
  14940. @end table
  14941. For example, to generate a frei0r partik0l source with size 200x200
  14942. and frame rate 10 which is overlaid on the overlay filter main input:
  14943. @example
  14944. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  14945. @end example
  14946. @section life
  14947. Generate a life pattern.
  14948. This source is based on a generalization of John Conway's life game.
  14949. The sourced input represents a life grid, each pixel represents a cell
  14950. which can be in one of two possible states, alive or dead. Every cell
  14951. interacts with its eight neighbours, which are the cells that are
  14952. horizontally, vertically, or diagonally adjacent.
  14953. At each interaction the grid evolves according to the adopted rule,
  14954. which specifies the number of neighbor alive cells which will make a
  14955. cell stay alive or born. The @option{rule} option allows one to specify
  14956. the rule to adopt.
  14957. This source accepts the following options:
  14958. @table @option
  14959. @item filename, f
  14960. Set the file from which to read the initial grid state. In the file,
  14961. each non-whitespace character is considered an alive cell, and newline
  14962. is used to delimit the end of each row.
  14963. If this option is not specified, the initial grid is generated
  14964. randomly.
  14965. @item rate, r
  14966. Set the video rate, that is the number of frames generated per second.
  14967. Default is 25.
  14968. @item random_fill_ratio, ratio
  14969. Set the random fill ratio for the initial random grid. It is a
  14970. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  14971. It is ignored when a file is specified.
  14972. @item random_seed, seed
  14973. Set the seed for filling the initial random grid, must be an integer
  14974. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14975. set to -1, the filter will try to use a good random seed on a best
  14976. effort basis.
  14977. @item rule
  14978. Set the life rule.
  14979. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  14980. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  14981. @var{NS} specifies the number of alive neighbor cells which make a
  14982. live cell stay alive, and @var{NB} the number of alive neighbor cells
  14983. which make a dead cell to become alive (i.e. to "born").
  14984. "s" and "b" can be used in place of "S" and "B", respectively.
  14985. Alternatively a rule can be specified by an 18-bits integer. The 9
  14986. high order bits are used to encode the next cell state if it is alive
  14987. for each number of neighbor alive cells, the low order bits specify
  14988. the rule for "borning" new cells. Higher order bits encode for an
  14989. higher number of neighbor cells.
  14990. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  14991. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  14992. Default value is "S23/B3", which is the original Conway's game of life
  14993. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  14994. cells, and will born a new cell if there are three alive cells around
  14995. a dead cell.
  14996. @item size, s
  14997. Set the size of the output video. For the syntax of this option, check the
  14998. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14999. If @option{filename} is specified, the size is set by default to the
  15000. same size of the input file. If @option{size} is set, it must contain
  15001. the size specified in the input file, and the initial grid defined in
  15002. that file is centered in the larger resulting area.
  15003. If a filename is not specified, the size value defaults to "320x240"
  15004. (used for a randomly generated initial grid).
  15005. @item stitch
  15006. If set to 1, stitch the left and right grid edges together, and the
  15007. top and bottom edges also. Defaults to 1.
  15008. @item mold
  15009. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15010. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15011. value from 0 to 255.
  15012. @item life_color
  15013. Set the color of living (or new born) cells.
  15014. @item death_color
  15015. Set the color of dead cells. If @option{mold} is set, this is the first color
  15016. used to represent a dead cell.
  15017. @item mold_color
  15018. Set mold color, for definitely dead and moldy cells.
  15019. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15020. ffmpeg-utils manual,ffmpeg-utils}.
  15021. @end table
  15022. @subsection Examples
  15023. @itemize
  15024. @item
  15025. Read a grid from @file{pattern}, and center it on a grid of size
  15026. 300x300 pixels:
  15027. @example
  15028. life=f=pattern:s=300x300
  15029. @end example
  15030. @item
  15031. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15032. @example
  15033. life=ratio=2/3:s=200x200
  15034. @end example
  15035. @item
  15036. Specify a custom rule for evolving a randomly generated grid:
  15037. @example
  15038. life=rule=S14/B34
  15039. @end example
  15040. @item
  15041. Full example with slow death effect (mold) using @command{ffplay}:
  15042. @example
  15043. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15044. @end example
  15045. @end itemize
  15046. @anchor{allrgb}
  15047. @anchor{allyuv}
  15048. @anchor{color}
  15049. @anchor{haldclutsrc}
  15050. @anchor{nullsrc}
  15051. @anchor{pal75bars}
  15052. @anchor{pal100bars}
  15053. @anchor{rgbtestsrc}
  15054. @anchor{smptebars}
  15055. @anchor{smptehdbars}
  15056. @anchor{testsrc}
  15057. @anchor{testsrc2}
  15058. @anchor{yuvtestsrc}
  15059. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15060. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15061. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15062. The @code{color} source provides an uniformly colored input.
  15063. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15064. @ref{haldclut} filter.
  15065. The @code{nullsrc} source returns unprocessed video frames. It is
  15066. mainly useful to be employed in analysis / debugging tools, or as the
  15067. source for filters which ignore the input data.
  15068. The @code{pal75bars} source generates a color bars pattern, based on
  15069. EBU PAL recommendations with 75% color levels.
  15070. The @code{pal100bars} source generates a color bars pattern, based on
  15071. EBU PAL recommendations with 100% color levels.
  15072. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15073. detecting RGB vs BGR issues. You should see a red, green and blue
  15074. stripe from top to bottom.
  15075. The @code{smptebars} source generates a color bars pattern, based on
  15076. the SMPTE Engineering Guideline EG 1-1990.
  15077. The @code{smptehdbars} source generates a color bars pattern, based on
  15078. the SMPTE RP 219-2002.
  15079. The @code{testsrc} source generates a test video pattern, showing a
  15080. color pattern, a scrolling gradient and a timestamp. This is mainly
  15081. intended for testing purposes.
  15082. The @code{testsrc2} source is similar to testsrc, but supports more
  15083. pixel formats instead of just @code{rgb24}. This allows using it as an
  15084. input for other tests without requiring a format conversion.
  15085. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15086. see a y, cb and cr stripe from top to bottom.
  15087. The sources accept the following parameters:
  15088. @table @option
  15089. @item level
  15090. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15091. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15092. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15093. coded on a @code{1/(N*N)} scale.
  15094. @item color, c
  15095. Specify the color of the source, only available in the @code{color}
  15096. source. For the syntax of this option, check the
  15097. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15098. @item size, s
  15099. Specify the size of the sourced video. For the syntax of this option, check the
  15100. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15101. The default value is @code{320x240}.
  15102. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15103. @code{haldclutsrc} filters.
  15104. @item rate, r
  15105. Specify the frame rate of the sourced video, as the number of frames
  15106. generated per second. It has to be a string in the format
  15107. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15108. number or a valid video frame rate abbreviation. The default value is
  15109. "25".
  15110. @item duration, d
  15111. Set the duration of the sourced video. See
  15112. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15113. for the accepted syntax.
  15114. If not specified, or the expressed duration is negative, the video is
  15115. supposed to be generated forever.
  15116. @item sar
  15117. Set the sample aspect ratio of the sourced video.
  15118. @item alpha
  15119. Specify the alpha (opacity) of the background, only available in the
  15120. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15121. 255 (fully opaque, the default).
  15122. @item decimals, n
  15123. Set the number of decimals to show in the timestamp, only available in the
  15124. @code{testsrc} source.
  15125. The displayed timestamp value will correspond to the original
  15126. timestamp value multiplied by the power of 10 of the specified
  15127. value. Default value is 0.
  15128. @end table
  15129. @subsection Examples
  15130. @itemize
  15131. @item
  15132. Generate a video with a duration of 5.3 seconds, with size
  15133. 176x144 and a frame rate of 10 frames per second:
  15134. @example
  15135. testsrc=duration=5.3:size=qcif:rate=10
  15136. @end example
  15137. @item
  15138. The following graph description will generate a red source
  15139. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15140. frames per second:
  15141. @example
  15142. color=c=red@@0.2:s=qcif:r=10
  15143. @end example
  15144. @item
  15145. If the input content is to be ignored, @code{nullsrc} can be used. The
  15146. following command generates noise in the luminance plane by employing
  15147. the @code{geq} filter:
  15148. @example
  15149. nullsrc=s=256x256, geq=random(1)*255:128:128
  15150. @end example
  15151. @end itemize
  15152. @subsection Commands
  15153. The @code{color} source supports the following commands:
  15154. @table @option
  15155. @item c, color
  15156. Set the color of the created image. Accepts the same syntax of the
  15157. corresponding @option{color} option.
  15158. @end table
  15159. @section openclsrc
  15160. Generate video using an OpenCL program.
  15161. @table @option
  15162. @item source
  15163. OpenCL program source file.
  15164. @item kernel
  15165. Kernel name in program.
  15166. @item size, s
  15167. Size of frames to generate. This must be set.
  15168. @item format
  15169. Pixel format to use for the generated frames. This must be set.
  15170. @item rate, r
  15171. Number of frames generated every second. Default value is '25'.
  15172. @end table
  15173. For details of how the program loading works, see the @ref{program_opencl}
  15174. filter.
  15175. Example programs:
  15176. @itemize
  15177. @item
  15178. Generate a colour ramp by setting pixel values from the position of the pixel
  15179. in the output image. (Note that this will work with all pixel formats, but
  15180. the generated output will not be the same.)
  15181. @verbatim
  15182. __kernel void ramp(__write_only image2d_t dst,
  15183. unsigned int index)
  15184. {
  15185. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15186. float4 val;
  15187. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15188. write_imagef(dst, loc, val);
  15189. }
  15190. @end verbatim
  15191. @item
  15192. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15193. @verbatim
  15194. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15195. unsigned int index)
  15196. {
  15197. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15198. float4 value = 0.0f;
  15199. int x = loc.x + index;
  15200. int y = loc.y + index;
  15201. while (x > 0 || y > 0) {
  15202. if (x % 3 == 1 && y % 3 == 1) {
  15203. value = 1.0f;
  15204. break;
  15205. }
  15206. x /= 3;
  15207. y /= 3;
  15208. }
  15209. write_imagef(dst, loc, value);
  15210. }
  15211. @end verbatim
  15212. @end itemize
  15213. @c man end VIDEO SOURCES
  15214. @chapter Video Sinks
  15215. @c man begin VIDEO SINKS
  15216. Below is a description of the currently available video sinks.
  15217. @section buffersink
  15218. Buffer video frames, and make them available to the end of the filter
  15219. graph.
  15220. This sink is mainly intended for programmatic use, in particular
  15221. through the interface defined in @file{libavfilter/buffersink.h}
  15222. or the options system.
  15223. It accepts a pointer to an AVBufferSinkContext structure, which
  15224. defines the incoming buffers' formats, to be passed as the opaque
  15225. parameter to @code{avfilter_init_filter} for initialization.
  15226. @section nullsink
  15227. Null video sink: do absolutely nothing with the input video. It is
  15228. mainly useful as a template and for use in analysis / debugging
  15229. tools.
  15230. @c man end VIDEO SINKS
  15231. @chapter Multimedia Filters
  15232. @c man begin MULTIMEDIA FILTERS
  15233. Below is a description of the currently available multimedia filters.
  15234. @section abitscope
  15235. Convert input audio to a video output, displaying the audio bit scope.
  15236. The filter accepts the following options:
  15237. @table @option
  15238. @item rate, r
  15239. Set frame rate, expressed as number of frames per second. Default
  15240. value is "25".
  15241. @item size, s
  15242. Specify the video size for the output. For the syntax of this option, check the
  15243. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15244. Default value is @code{1024x256}.
  15245. @item colors
  15246. Specify list of colors separated by space or by '|' which will be used to
  15247. draw channels. Unrecognized or missing colors will be replaced
  15248. by white color.
  15249. @end table
  15250. @section ahistogram
  15251. Convert input audio to a video output, displaying the volume histogram.
  15252. The filter accepts the following options:
  15253. @table @option
  15254. @item dmode
  15255. Specify how histogram is calculated.
  15256. It accepts the following values:
  15257. @table @samp
  15258. @item single
  15259. Use single histogram for all channels.
  15260. @item separate
  15261. Use separate histogram for each channel.
  15262. @end table
  15263. Default is @code{single}.
  15264. @item rate, r
  15265. Set frame rate, expressed as number of frames per second. Default
  15266. value is "25".
  15267. @item size, s
  15268. Specify the video size for the output. For the syntax of this option, check the
  15269. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15270. Default value is @code{hd720}.
  15271. @item scale
  15272. Set display scale.
  15273. It accepts the following values:
  15274. @table @samp
  15275. @item log
  15276. logarithmic
  15277. @item sqrt
  15278. square root
  15279. @item cbrt
  15280. cubic root
  15281. @item lin
  15282. linear
  15283. @item rlog
  15284. reverse logarithmic
  15285. @end table
  15286. Default is @code{log}.
  15287. @item ascale
  15288. Set amplitude scale.
  15289. It accepts the following values:
  15290. @table @samp
  15291. @item log
  15292. logarithmic
  15293. @item lin
  15294. linear
  15295. @end table
  15296. Default is @code{log}.
  15297. @item acount
  15298. Set how much frames to accumulate in histogram.
  15299. Defauls is 1. Setting this to -1 accumulates all frames.
  15300. @item rheight
  15301. Set histogram ratio of window height.
  15302. @item slide
  15303. Set sonogram sliding.
  15304. It accepts the following values:
  15305. @table @samp
  15306. @item replace
  15307. replace old rows with new ones.
  15308. @item scroll
  15309. scroll from top to bottom.
  15310. @end table
  15311. Default is @code{replace}.
  15312. @end table
  15313. @section aphasemeter
  15314. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15315. representing mean phase of current audio frame. A video output can also be produced and is
  15316. enabled by default. The audio is passed through as first output.
  15317. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15318. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15319. and @code{1} means channels are in phase.
  15320. The filter accepts the following options, all related to its video output:
  15321. @table @option
  15322. @item rate, r
  15323. Set the output frame rate. Default value is @code{25}.
  15324. @item size, s
  15325. Set the video size for the output. For the syntax of this option, check the
  15326. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15327. Default value is @code{800x400}.
  15328. @item rc
  15329. @item gc
  15330. @item bc
  15331. Specify the red, green, blue contrast. Default values are @code{2},
  15332. @code{7} and @code{1}.
  15333. Allowed range is @code{[0, 255]}.
  15334. @item mpc
  15335. Set color which will be used for drawing median phase. If color is
  15336. @code{none} which is default, no median phase value will be drawn.
  15337. @item video
  15338. Enable video output. Default is enabled.
  15339. @end table
  15340. @section avectorscope
  15341. Convert input audio to a video output, representing the audio vector
  15342. scope.
  15343. The filter is used to measure the difference between channels of stereo
  15344. audio stream. A monoaural signal, consisting of identical left and right
  15345. signal, results in straight vertical line. Any stereo separation is visible
  15346. as a deviation from this line, creating a Lissajous figure.
  15347. If the straight (or deviation from it) but horizontal line appears this
  15348. indicates that the left and right channels are out of phase.
  15349. The filter accepts the following options:
  15350. @table @option
  15351. @item mode, m
  15352. Set the vectorscope mode.
  15353. Available values are:
  15354. @table @samp
  15355. @item lissajous
  15356. Lissajous rotated by 45 degrees.
  15357. @item lissajous_xy
  15358. Same as above but not rotated.
  15359. @item polar
  15360. Shape resembling half of circle.
  15361. @end table
  15362. Default value is @samp{lissajous}.
  15363. @item size, s
  15364. Set the video size for the output. For the syntax of this option, check the
  15365. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15366. Default value is @code{400x400}.
  15367. @item rate, r
  15368. Set the output frame rate. Default value is @code{25}.
  15369. @item rc
  15370. @item gc
  15371. @item bc
  15372. @item ac
  15373. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15374. @code{160}, @code{80} and @code{255}.
  15375. Allowed range is @code{[0, 255]}.
  15376. @item rf
  15377. @item gf
  15378. @item bf
  15379. @item af
  15380. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15381. @code{10}, @code{5} and @code{5}.
  15382. Allowed range is @code{[0, 255]}.
  15383. @item zoom
  15384. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15385. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15386. @item draw
  15387. Set the vectorscope drawing mode.
  15388. Available values are:
  15389. @table @samp
  15390. @item dot
  15391. Draw dot for each sample.
  15392. @item line
  15393. Draw line between previous and current sample.
  15394. @end table
  15395. Default value is @samp{dot}.
  15396. @item scale
  15397. Specify amplitude scale of audio samples.
  15398. Available values are:
  15399. @table @samp
  15400. @item lin
  15401. Linear.
  15402. @item sqrt
  15403. Square root.
  15404. @item cbrt
  15405. Cubic root.
  15406. @item log
  15407. Logarithmic.
  15408. @end table
  15409. @item swap
  15410. Swap left channel axis with right channel axis.
  15411. @item mirror
  15412. Mirror axis.
  15413. @table @samp
  15414. @item none
  15415. No mirror.
  15416. @item x
  15417. Mirror only x axis.
  15418. @item y
  15419. Mirror only y axis.
  15420. @item xy
  15421. Mirror both axis.
  15422. @end table
  15423. @end table
  15424. @subsection Examples
  15425. @itemize
  15426. @item
  15427. Complete example using @command{ffplay}:
  15428. @example
  15429. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15430. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15431. @end example
  15432. @end itemize
  15433. @section bench, abench
  15434. Benchmark part of a filtergraph.
  15435. The filter accepts the following options:
  15436. @table @option
  15437. @item action
  15438. Start or stop a timer.
  15439. Available values are:
  15440. @table @samp
  15441. @item start
  15442. Get the current time, set it as frame metadata (using the key
  15443. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15444. @item stop
  15445. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15446. the input frame metadata to get the time difference. Time difference, average,
  15447. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15448. @code{min}) are then printed. The timestamps are expressed in seconds.
  15449. @end table
  15450. @end table
  15451. @subsection Examples
  15452. @itemize
  15453. @item
  15454. Benchmark @ref{selectivecolor} filter:
  15455. @example
  15456. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15457. @end example
  15458. @end itemize
  15459. @section concat
  15460. Concatenate audio and video streams, joining them together one after the
  15461. other.
  15462. The filter works on segments of synchronized video and audio streams. All
  15463. segments must have the same number of streams of each type, and that will
  15464. also be the number of streams at output.
  15465. The filter accepts the following options:
  15466. @table @option
  15467. @item n
  15468. Set the number of segments. Default is 2.
  15469. @item v
  15470. Set the number of output video streams, that is also the number of video
  15471. streams in each segment. Default is 1.
  15472. @item a
  15473. Set the number of output audio streams, that is also the number of audio
  15474. streams in each segment. Default is 0.
  15475. @item unsafe
  15476. Activate unsafe mode: do not fail if segments have a different format.
  15477. @end table
  15478. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15479. @var{a} audio outputs.
  15480. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15481. segment, in the same order as the outputs, then the inputs for the second
  15482. segment, etc.
  15483. Related streams do not always have exactly the same duration, for various
  15484. reasons including codec frame size or sloppy authoring. For that reason,
  15485. related synchronized streams (e.g. a video and its audio track) should be
  15486. concatenated at once. The concat filter will use the duration of the longest
  15487. stream in each segment (except the last one), and if necessary pad shorter
  15488. audio streams with silence.
  15489. For this filter to work correctly, all segments must start at timestamp 0.
  15490. All corresponding streams must have the same parameters in all segments; the
  15491. filtering system will automatically select a common pixel format for video
  15492. streams, and a common sample format, sample rate and channel layout for
  15493. audio streams, but other settings, such as resolution, must be converted
  15494. explicitly by the user.
  15495. Different frame rates are acceptable but will result in variable frame rate
  15496. at output; be sure to configure the output file to handle it.
  15497. @subsection Examples
  15498. @itemize
  15499. @item
  15500. Concatenate an opening, an episode and an ending, all in bilingual version
  15501. (video in stream 0, audio in streams 1 and 2):
  15502. @example
  15503. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15504. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15505. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15506. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15507. @end example
  15508. @item
  15509. Concatenate two parts, handling audio and video separately, using the
  15510. (a)movie sources, and adjusting the resolution:
  15511. @example
  15512. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15513. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15514. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15515. @end example
  15516. Note that a desync will happen at the stitch if the audio and video streams
  15517. do not have exactly the same duration in the first file.
  15518. @end itemize
  15519. @subsection Commands
  15520. This filter supports the following commands:
  15521. @table @option
  15522. @item next
  15523. Close the current segment and step to the next one
  15524. @end table
  15525. @section drawgraph, adrawgraph
  15526. Draw a graph using input video or audio metadata.
  15527. It accepts the following parameters:
  15528. @table @option
  15529. @item m1
  15530. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15531. @item fg1
  15532. Set 1st foreground color expression.
  15533. @item m2
  15534. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15535. @item fg2
  15536. Set 2nd foreground color expression.
  15537. @item m3
  15538. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15539. @item fg3
  15540. Set 3rd foreground color expression.
  15541. @item m4
  15542. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15543. @item fg4
  15544. Set 4th foreground color expression.
  15545. @item min
  15546. Set minimal value of metadata value.
  15547. @item max
  15548. Set maximal value of metadata value.
  15549. @item bg
  15550. Set graph background color. Default is white.
  15551. @item mode
  15552. Set graph mode.
  15553. Available values for mode is:
  15554. @table @samp
  15555. @item bar
  15556. @item dot
  15557. @item line
  15558. @end table
  15559. Default is @code{line}.
  15560. @item slide
  15561. Set slide mode.
  15562. Available values for slide is:
  15563. @table @samp
  15564. @item frame
  15565. Draw new frame when right border is reached.
  15566. @item replace
  15567. Replace old columns with new ones.
  15568. @item scroll
  15569. Scroll from right to left.
  15570. @item rscroll
  15571. Scroll from left to right.
  15572. @item picture
  15573. Draw single picture.
  15574. @end table
  15575. Default is @code{frame}.
  15576. @item size
  15577. Set size of graph video. For the syntax of this option, check the
  15578. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15579. The default value is @code{900x256}.
  15580. The foreground color expressions can use the following variables:
  15581. @table @option
  15582. @item MIN
  15583. Minimal value of metadata value.
  15584. @item MAX
  15585. Maximal value of metadata value.
  15586. @item VAL
  15587. Current metadata key value.
  15588. @end table
  15589. The color is defined as 0xAABBGGRR.
  15590. @end table
  15591. Example using metadata from @ref{signalstats} filter:
  15592. @example
  15593. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15594. @end example
  15595. Example using metadata from @ref{ebur128} filter:
  15596. @example
  15597. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15598. @end example
  15599. @anchor{ebur128}
  15600. @section ebur128
  15601. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  15602. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  15603. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15604. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15605. The filter also has a video output (see the @var{video} option) with a real
  15606. time graph to observe the loudness evolution. The graphic contains the logged
  15607. message mentioned above, so it is not printed anymore when this option is set,
  15608. unless the verbose logging is set. The main graphing area contains the
  15609. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15610. the momentary loudness (400 milliseconds), but can optionally be configured
  15611. to instead display short-term loudness (see @var{gauge}).
  15612. The green area marks a +/- 1LU target range around the target loudness
  15613. (-23LUFS by default, unless modified through @var{target}).
  15614. More information about the Loudness Recommendation EBU R128 on
  15615. @url{http://tech.ebu.ch/loudness}.
  15616. The filter accepts the following options:
  15617. @table @option
  15618. @item video
  15619. Activate the video output. The audio stream is passed unchanged whether this
  15620. option is set or no. The video stream will be the first output stream if
  15621. activated. Default is @code{0}.
  15622. @item size
  15623. Set the video size. This option is for video only. For the syntax of this
  15624. option, check the
  15625. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15626. Default and minimum resolution is @code{640x480}.
  15627. @item meter
  15628. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15629. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15630. other integer value between this range is allowed.
  15631. @item metadata
  15632. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15633. into 100ms output frames, each of them containing various loudness information
  15634. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15635. Default is @code{0}.
  15636. @item framelog
  15637. Force the frame logging level.
  15638. Available values are:
  15639. @table @samp
  15640. @item info
  15641. information logging level
  15642. @item verbose
  15643. verbose logging level
  15644. @end table
  15645. By default, the logging level is set to @var{info}. If the @option{video} or
  15646. the @option{metadata} options are set, it switches to @var{verbose}.
  15647. @item peak
  15648. Set peak mode(s).
  15649. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15650. values are:
  15651. @table @samp
  15652. @item none
  15653. Disable any peak mode (default).
  15654. @item sample
  15655. Enable sample-peak mode.
  15656. Simple peak mode looking for the higher sample value. It logs a message
  15657. for sample-peak (identified by @code{SPK}).
  15658. @item true
  15659. Enable true-peak mode.
  15660. If enabled, the peak lookup is done on an over-sampled version of the input
  15661. stream for better peak accuracy. It logs a message for true-peak.
  15662. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15663. This mode requires a build with @code{libswresample}.
  15664. @end table
  15665. @item dualmono
  15666. Treat mono input files as "dual mono". If a mono file is intended for playback
  15667. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15668. If set to @code{true}, this option will compensate for this effect.
  15669. Multi-channel input files are not affected by this option.
  15670. @item panlaw
  15671. Set a specific pan law to be used for the measurement of dual mono files.
  15672. This parameter is optional, and has a default value of -3.01dB.
  15673. @item target
  15674. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15675. This parameter is optional and has a default value of -23LUFS as specified
  15676. by EBU R128. However, material published online may prefer a level of -16LUFS
  15677. (e.g. for use with podcasts or video platforms).
  15678. @item gauge
  15679. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15680. @code{shortterm}. By default the momentary value will be used, but in certain
  15681. scenarios it may be more useful to observe the short term value instead (e.g.
  15682. live mixing).
  15683. @item scale
  15684. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  15685. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  15686. video output, not the summary or continuous log output.
  15687. @end table
  15688. @subsection Examples
  15689. @itemize
  15690. @item
  15691. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  15692. @example
  15693. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  15694. @end example
  15695. @item
  15696. Run an analysis with @command{ffmpeg}:
  15697. @example
  15698. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  15699. @end example
  15700. @end itemize
  15701. @section interleave, ainterleave
  15702. Temporally interleave frames from several inputs.
  15703. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  15704. These filters read frames from several inputs and send the oldest
  15705. queued frame to the output.
  15706. Input streams must have well defined, monotonically increasing frame
  15707. timestamp values.
  15708. In order to submit one frame to output, these filters need to enqueue
  15709. at least one frame for each input, so they cannot work in case one
  15710. input is not yet terminated and will not receive incoming frames.
  15711. For example consider the case when one input is a @code{select} filter
  15712. which always drops input frames. The @code{interleave} filter will keep
  15713. reading from that input, but it will never be able to send new frames
  15714. to output until the input sends an end-of-stream signal.
  15715. Also, depending on inputs synchronization, the filters will drop
  15716. frames in case one input receives more frames than the other ones, and
  15717. the queue is already filled.
  15718. These filters accept the following options:
  15719. @table @option
  15720. @item nb_inputs, n
  15721. Set the number of different inputs, it is 2 by default.
  15722. @end table
  15723. @subsection Examples
  15724. @itemize
  15725. @item
  15726. Interleave frames belonging to different streams using @command{ffmpeg}:
  15727. @example
  15728. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  15729. @end example
  15730. @item
  15731. Add flickering blur effect:
  15732. @example
  15733. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  15734. @end example
  15735. @end itemize
  15736. @section metadata, ametadata
  15737. Manipulate frame metadata.
  15738. This filter accepts the following options:
  15739. @table @option
  15740. @item mode
  15741. Set mode of operation of the filter.
  15742. Can be one of the following:
  15743. @table @samp
  15744. @item select
  15745. If both @code{value} and @code{key} is set, select frames
  15746. which have such metadata. If only @code{key} is set, select
  15747. every frame that has such key in metadata.
  15748. @item add
  15749. Add new metadata @code{key} and @code{value}. If key is already available
  15750. do nothing.
  15751. @item modify
  15752. Modify value of already present key.
  15753. @item delete
  15754. If @code{value} is set, delete only keys that have such value.
  15755. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  15756. the frame.
  15757. @item print
  15758. Print key and its value if metadata was found. If @code{key} is not set print all
  15759. metadata values available in frame.
  15760. @end table
  15761. @item key
  15762. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  15763. @item value
  15764. Set metadata value which will be used. This option is mandatory for
  15765. @code{modify} and @code{add} mode.
  15766. @item function
  15767. Which function to use when comparing metadata value and @code{value}.
  15768. Can be one of following:
  15769. @table @samp
  15770. @item same_str
  15771. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  15772. @item starts_with
  15773. Values are interpreted as strings, returns true if metadata value starts with
  15774. the @code{value} option string.
  15775. @item less
  15776. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  15777. @item equal
  15778. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  15779. @item greater
  15780. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  15781. @item expr
  15782. Values are interpreted as floats, returns true if expression from option @code{expr}
  15783. evaluates to true.
  15784. @end table
  15785. @item expr
  15786. Set expression which is used when @code{function} is set to @code{expr}.
  15787. The expression is evaluated through the eval API and can contain the following
  15788. constants:
  15789. @table @option
  15790. @item VALUE1
  15791. Float representation of @code{value} from metadata key.
  15792. @item VALUE2
  15793. Float representation of @code{value} as supplied by user in @code{value} option.
  15794. @end table
  15795. @item file
  15796. If specified in @code{print} mode, output is written to the named file. Instead of
  15797. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  15798. for standard output. If @code{file} option is not set, output is written to the log
  15799. with AV_LOG_INFO loglevel.
  15800. @end table
  15801. @subsection Examples
  15802. @itemize
  15803. @item
  15804. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  15805. between 0 and 1.
  15806. @example
  15807. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  15808. @end example
  15809. @item
  15810. Print silencedetect output to file @file{metadata.txt}.
  15811. @example
  15812. silencedetect,ametadata=mode=print:file=metadata.txt
  15813. @end example
  15814. @item
  15815. Direct all metadata to a pipe with file descriptor 4.
  15816. @example
  15817. metadata=mode=print:file='pipe\:4'
  15818. @end example
  15819. @end itemize
  15820. @section perms, aperms
  15821. Set read/write permissions for the output frames.
  15822. These filters are mainly aimed at developers to test direct path in the
  15823. following filter in the filtergraph.
  15824. The filters accept the following options:
  15825. @table @option
  15826. @item mode
  15827. Select the permissions mode.
  15828. It accepts the following values:
  15829. @table @samp
  15830. @item none
  15831. Do nothing. This is the default.
  15832. @item ro
  15833. Set all the output frames read-only.
  15834. @item rw
  15835. Set all the output frames directly writable.
  15836. @item toggle
  15837. Make the frame read-only if writable, and writable if read-only.
  15838. @item random
  15839. Set each output frame read-only or writable randomly.
  15840. @end table
  15841. @item seed
  15842. Set the seed for the @var{random} mode, must be an integer included between
  15843. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15844. @code{-1}, the filter will try to use a good random seed on a best effort
  15845. basis.
  15846. @end table
  15847. Note: in case of auto-inserted filter between the permission filter and the
  15848. following one, the permission might not be received as expected in that
  15849. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  15850. perms/aperms filter can avoid this problem.
  15851. @section realtime, arealtime
  15852. Slow down filtering to match real time approximately.
  15853. These filters will pause the filtering for a variable amount of time to
  15854. match the output rate with the input timestamps.
  15855. They are similar to the @option{re} option to @code{ffmpeg}.
  15856. They accept the following options:
  15857. @table @option
  15858. @item limit
  15859. Time limit for the pauses. Any pause longer than that will be considered
  15860. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  15861. @end table
  15862. @anchor{select}
  15863. @section select, aselect
  15864. Select frames to pass in output.
  15865. This filter accepts the following options:
  15866. @table @option
  15867. @item expr, e
  15868. Set expression, which is evaluated for each input frame.
  15869. If the expression is evaluated to zero, the frame is discarded.
  15870. If the evaluation result is negative or NaN, the frame is sent to the
  15871. first output; otherwise it is sent to the output with index
  15872. @code{ceil(val)-1}, assuming that the input index starts from 0.
  15873. For example a value of @code{1.2} corresponds to the output with index
  15874. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  15875. @item outputs, n
  15876. Set the number of outputs. The output to which to send the selected
  15877. frame is based on the result of the evaluation. Default value is 1.
  15878. @end table
  15879. The expression can contain the following constants:
  15880. @table @option
  15881. @item n
  15882. The (sequential) number of the filtered frame, starting from 0.
  15883. @item selected_n
  15884. The (sequential) number of the selected frame, starting from 0.
  15885. @item prev_selected_n
  15886. The sequential number of the last selected frame. It's NAN if undefined.
  15887. @item TB
  15888. The timebase of the input timestamps.
  15889. @item pts
  15890. The PTS (Presentation TimeStamp) of the filtered video frame,
  15891. expressed in @var{TB} units. It's NAN if undefined.
  15892. @item t
  15893. The PTS of the filtered video frame,
  15894. expressed in seconds. It's NAN if undefined.
  15895. @item prev_pts
  15896. The PTS of the previously filtered video frame. It's NAN if undefined.
  15897. @item prev_selected_pts
  15898. The PTS of the last previously filtered video frame. It's NAN if undefined.
  15899. @item prev_selected_t
  15900. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  15901. @item start_pts
  15902. The PTS of the first video frame in the video. It's NAN if undefined.
  15903. @item start_t
  15904. The time of the first video frame in the video. It's NAN if undefined.
  15905. @item pict_type @emph{(video only)}
  15906. The type of the filtered frame. It can assume one of the following
  15907. values:
  15908. @table @option
  15909. @item I
  15910. @item P
  15911. @item B
  15912. @item S
  15913. @item SI
  15914. @item SP
  15915. @item BI
  15916. @end table
  15917. @item interlace_type @emph{(video only)}
  15918. The frame interlace type. It can assume one of the following values:
  15919. @table @option
  15920. @item PROGRESSIVE
  15921. The frame is progressive (not interlaced).
  15922. @item TOPFIRST
  15923. The frame is top-field-first.
  15924. @item BOTTOMFIRST
  15925. The frame is bottom-field-first.
  15926. @end table
  15927. @item consumed_sample_n @emph{(audio only)}
  15928. the number of selected samples before the current frame
  15929. @item samples_n @emph{(audio only)}
  15930. the number of samples in the current frame
  15931. @item sample_rate @emph{(audio only)}
  15932. the input sample rate
  15933. @item key
  15934. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  15935. @item pos
  15936. the position in the file of the filtered frame, -1 if the information
  15937. is not available (e.g. for synthetic video)
  15938. @item scene @emph{(video only)}
  15939. value between 0 and 1 to indicate a new scene; a low value reflects a low
  15940. probability for the current frame to introduce a new scene, while a higher
  15941. value means the current frame is more likely to be one (see the example below)
  15942. @item concatdec_select
  15943. The concat demuxer can select only part of a concat input file by setting an
  15944. inpoint and an outpoint, but the output packets may not be entirely contained
  15945. in the selected interval. By using this variable, it is possible to skip frames
  15946. generated by the concat demuxer which are not exactly contained in the selected
  15947. interval.
  15948. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  15949. and the @var{lavf.concat.duration} packet metadata values which are also
  15950. present in the decoded frames.
  15951. The @var{concatdec_select} variable is -1 if the frame pts is at least
  15952. start_time and either the duration metadata is missing or the frame pts is less
  15953. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  15954. missing.
  15955. That basically means that an input frame is selected if its pts is within the
  15956. interval set by the concat demuxer.
  15957. @end table
  15958. The default value of the select expression is "1".
  15959. @subsection Examples
  15960. @itemize
  15961. @item
  15962. Select all frames in input:
  15963. @example
  15964. select
  15965. @end example
  15966. The example above is the same as:
  15967. @example
  15968. select=1
  15969. @end example
  15970. @item
  15971. Skip all frames:
  15972. @example
  15973. select=0
  15974. @end example
  15975. @item
  15976. Select only I-frames:
  15977. @example
  15978. select='eq(pict_type\,I)'
  15979. @end example
  15980. @item
  15981. Select one frame every 100:
  15982. @example
  15983. select='not(mod(n\,100))'
  15984. @end example
  15985. @item
  15986. Select only frames contained in the 10-20 time interval:
  15987. @example
  15988. select=between(t\,10\,20)
  15989. @end example
  15990. @item
  15991. Select only I-frames contained in the 10-20 time interval:
  15992. @example
  15993. select=between(t\,10\,20)*eq(pict_type\,I)
  15994. @end example
  15995. @item
  15996. Select frames with a minimum distance of 10 seconds:
  15997. @example
  15998. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  15999. @end example
  16000. @item
  16001. Use aselect to select only audio frames with samples number > 100:
  16002. @example
  16003. aselect='gt(samples_n\,100)'
  16004. @end example
  16005. @item
  16006. Create a mosaic of the first scenes:
  16007. @example
  16008. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16009. @end example
  16010. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16011. choice.
  16012. @item
  16013. Send even and odd frames to separate outputs, and compose them:
  16014. @example
  16015. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16016. @end example
  16017. @item
  16018. Select useful frames from an ffconcat file which is using inpoints and
  16019. outpoints but where the source files are not intra frame only.
  16020. @example
  16021. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16022. @end example
  16023. @end itemize
  16024. @section sendcmd, asendcmd
  16025. Send commands to filters in the filtergraph.
  16026. These filters read commands to be sent to other filters in the
  16027. filtergraph.
  16028. @code{sendcmd} must be inserted between two video filters,
  16029. @code{asendcmd} must be inserted between two audio filters, but apart
  16030. from that they act the same way.
  16031. The specification of commands can be provided in the filter arguments
  16032. with the @var{commands} option, or in a file specified by the
  16033. @var{filename} option.
  16034. These filters accept the following options:
  16035. @table @option
  16036. @item commands, c
  16037. Set the commands to be read and sent to the other filters.
  16038. @item filename, f
  16039. Set the filename of the commands to be read and sent to the other
  16040. filters.
  16041. @end table
  16042. @subsection Commands syntax
  16043. A commands description consists of a sequence of interval
  16044. specifications, comprising a list of commands to be executed when a
  16045. particular event related to that interval occurs. The occurring event
  16046. is typically the current frame time entering or leaving a given time
  16047. interval.
  16048. An interval is specified by the following syntax:
  16049. @example
  16050. @var{START}[-@var{END}] @var{COMMANDS};
  16051. @end example
  16052. The time interval is specified by the @var{START} and @var{END} times.
  16053. @var{END} is optional and defaults to the maximum time.
  16054. The current frame time is considered within the specified interval if
  16055. it is included in the interval [@var{START}, @var{END}), that is when
  16056. the time is greater or equal to @var{START} and is lesser than
  16057. @var{END}.
  16058. @var{COMMANDS} consists of a sequence of one or more command
  16059. specifications, separated by ",", relating to that interval. The
  16060. syntax of a command specification is given by:
  16061. @example
  16062. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16063. @end example
  16064. @var{FLAGS} is optional and specifies the type of events relating to
  16065. the time interval which enable sending the specified command, and must
  16066. be a non-null sequence of identifier flags separated by "+" or "|" and
  16067. enclosed between "[" and "]".
  16068. The following flags are recognized:
  16069. @table @option
  16070. @item enter
  16071. The command is sent when the current frame timestamp enters the
  16072. specified interval. In other words, the command is sent when the
  16073. previous frame timestamp was not in the given interval, and the
  16074. current is.
  16075. @item leave
  16076. The command is sent when the current frame timestamp leaves the
  16077. specified interval. In other words, the command is sent when the
  16078. previous frame timestamp was in the given interval, and the
  16079. current is not.
  16080. @end table
  16081. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16082. assumed.
  16083. @var{TARGET} specifies the target of the command, usually the name of
  16084. the filter class or a specific filter instance name.
  16085. @var{COMMAND} specifies the name of the command for the target filter.
  16086. @var{ARG} is optional and specifies the optional list of argument for
  16087. the given @var{COMMAND}.
  16088. Between one interval specification and another, whitespaces, or
  16089. sequences of characters starting with @code{#} until the end of line,
  16090. are ignored and can be used to annotate comments.
  16091. A simplified BNF description of the commands specification syntax
  16092. follows:
  16093. @example
  16094. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16095. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16096. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16097. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16098. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16099. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16100. @end example
  16101. @subsection Examples
  16102. @itemize
  16103. @item
  16104. Specify audio tempo change at second 4:
  16105. @example
  16106. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16107. @end example
  16108. @item
  16109. Target a specific filter instance:
  16110. @example
  16111. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16112. @end example
  16113. @item
  16114. Specify a list of drawtext and hue commands in a file.
  16115. @example
  16116. # show text in the interval 5-10
  16117. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16118. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16119. # desaturate the image in the interval 15-20
  16120. 15.0-20.0 [enter] hue s 0,
  16121. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16122. [leave] hue s 1,
  16123. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16124. # apply an exponential saturation fade-out effect, starting from time 25
  16125. 25 [enter] hue s exp(25-t)
  16126. @end example
  16127. A filtergraph allowing to read and process the above command list
  16128. stored in a file @file{test.cmd}, can be specified with:
  16129. @example
  16130. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16131. @end example
  16132. @end itemize
  16133. @anchor{setpts}
  16134. @section setpts, asetpts
  16135. Change the PTS (presentation timestamp) of the input frames.
  16136. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16137. This filter accepts the following options:
  16138. @table @option
  16139. @item expr
  16140. The expression which is evaluated for each frame to construct its timestamp.
  16141. @end table
  16142. The expression is evaluated through the eval API and can contain the following
  16143. constants:
  16144. @table @option
  16145. @item FRAME_RATE, FR
  16146. frame rate, only defined for constant frame-rate video
  16147. @item PTS
  16148. The presentation timestamp in input
  16149. @item N
  16150. The count of the input frame for video or the number of consumed samples,
  16151. not including the current frame for audio, starting from 0.
  16152. @item NB_CONSUMED_SAMPLES
  16153. The number of consumed samples, not including the current frame (only
  16154. audio)
  16155. @item NB_SAMPLES, S
  16156. The number of samples in the current frame (only audio)
  16157. @item SAMPLE_RATE, SR
  16158. The audio sample rate.
  16159. @item STARTPTS
  16160. The PTS of the first frame.
  16161. @item STARTT
  16162. the time in seconds of the first frame
  16163. @item INTERLACED
  16164. State whether the current frame is interlaced.
  16165. @item T
  16166. the time in seconds of the current frame
  16167. @item POS
  16168. original position in the file of the frame, or undefined if undefined
  16169. for the current frame
  16170. @item PREV_INPTS
  16171. The previous input PTS.
  16172. @item PREV_INT
  16173. previous input time in seconds
  16174. @item PREV_OUTPTS
  16175. The previous output PTS.
  16176. @item PREV_OUTT
  16177. previous output time in seconds
  16178. @item RTCTIME
  16179. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16180. instead.
  16181. @item RTCSTART
  16182. The wallclock (RTC) time at the start of the movie in microseconds.
  16183. @item TB
  16184. The timebase of the input timestamps.
  16185. @end table
  16186. @subsection Examples
  16187. @itemize
  16188. @item
  16189. Start counting PTS from zero
  16190. @example
  16191. setpts=PTS-STARTPTS
  16192. @end example
  16193. @item
  16194. Apply fast motion effect:
  16195. @example
  16196. setpts=0.5*PTS
  16197. @end example
  16198. @item
  16199. Apply slow motion effect:
  16200. @example
  16201. setpts=2.0*PTS
  16202. @end example
  16203. @item
  16204. Set fixed rate of 25 frames per second:
  16205. @example
  16206. setpts=N/(25*TB)
  16207. @end example
  16208. @item
  16209. Set fixed rate 25 fps with some jitter:
  16210. @example
  16211. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16212. @end example
  16213. @item
  16214. Apply an offset of 10 seconds to the input PTS:
  16215. @example
  16216. setpts=PTS+10/TB
  16217. @end example
  16218. @item
  16219. Generate timestamps from a "live source" and rebase onto the current timebase:
  16220. @example
  16221. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16222. @end example
  16223. @item
  16224. Generate timestamps by counting samples:
  16225. @example
  16226. asetpts=N/SR/TB
  16227. @end example
  16228. @end itemize
  16229. @section setrange
  16230. Force color range for the output video frame.
  16231. The @code{setrange} filter marks the color range property for the
  16232. output frames. It does not change the input frame, but only sets the
  16233. corresponding property, which affects how the frame is treated by
  16234. following filters.
  16235. The filter accepts the following options:
  16236. @table @option
  16237. @item range
  16238. Available values are:
  16239. @table @samp
  16240. @item auto
  16241. Keep the same color range property.
  16242. @item unspecified, unknown
  16243. Set the color range as unspecified.
  16244. @item limited, tv, mpeg
  16245. Set the color range as limited.
  16246. @item full, pc, jpeg
  16247. Set the color range as full.
  16248. @end table
  16249. @end table
  16250. @section settb, asettb
  16251. Set the timebase to use for the output frames timestamps.
  16252. It is mainly useful for testing timebase configuration.
  16253. It accepts the following parameters:
  16254. @table @option
  16255. @item expr, tb
  16256. The expression which is evaluated into the output timebase.
  16257. @end table
  16258. The value for @option{tb} is an arithmetic expression representing a
  16259. rational. The expression can contain the constants "AVTB" (the default
  16260. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16261. audio only). Default value is "intb".
  16262. @subsection Examples
  16263. @itemize
  16264. @item
  16265. Set the timebase to 1/25:
  16266. @example
  16267. settb=expr=1/25
  16268. @end example
  16269. @item
  16270. Set the timebase to 1/10:
  16271. @example
  16272. settb=expr=0.1
  16273. @end example
  16274. @item
  16275. Set the timebase to 1001/1000:
  16276. @example
  16277. settb=1+0.001
  16278. @end example
  16279. @item
  16280. Set the timebase to 2*intb:
  16281. @example
  16282. settb=2*intb
  16283. @end example
  16284. @item
  16285. Set the default timebase value:
  16286. @example
  16287. settb=AVTB
  16288. @end example
  16289. @end itemize
  16290. @section showcqt
  16291. Convert input audio to a video output representing frequency spectrum
  16292. logarithmically using Brown-Puckette constant Q transform algorithm with
  16293. direct frequency domain coefficient calculation (but the transform itself
  16294. is not really constant Q, instead the Q factor is actually variable/clamped),
  16295. with musical tone scale, from E0 to D#10.
  16296. The filter accepts the following options:
  16297. @table @option
  16298. @item size, s
  16299. Specify the video size for the output. It must be even. For the syntax of this option,
  16300. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16301. Default value is @code{1920x1080}.
  16302. @item fps, rate, r
  16303. Set the output frame rate. Default value is @code{25}.
  16304. @item bar_h
  16305. Set the bargraph height. It must be even. Default value is @code{-1} which
  16306. computes the bargraph height automatically.
  16307. @item axis_h
  16308. Set the axis height. It must be even. Default value is @code{-1} which computes
  16309. the axis height automatically.
  16310. @item sono_h
  16311. Set the sonogram height. It must be even. Default value is @code{-1} which
  16312. computes the sonogram height automatically.
  16313. @item fullhd
  16314. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16315. instead. Default value is @code{1}.
  16316. @item sono_v, volume
  16317. Specify the sonogram volume expression. It can contain variables:
  16318. @table @option
  16319. @item bar_v
  16320. the @var{bar_v} evaluated expression
  16321. @item frequency, freq, f
  16322. the frequency where it is evaluated
  16323. @item timeclamp, tc
  16324. the value of @var{timeclamp} option
  16325. @end table
  16326. and functions:
  16327. @table @option
  16328. @item a_weighting(f)
  16329. A-weighting of equal loudness
  16330. @item b_weighting(f)
  16331. B-weighting of equal loudness
  16332. @item c_weighting(f)
  16333. C-weighting of equal loudness.
  16334. @end table
  16335. Default value is @code{16}.
  16336. @item bar_v, volume2
  16337. Specify the bargraph volume expression. It can contain variables:
  16338. @table @option
  16339. @item sono_v
  16340. the @var{sono_v} evaluated expression
  16341. @item frequency, freq, f
  16342. the frequency where it is evaluated
  16343. @item timeclamp, tc
  16344. the value of @var{timeclamp} option
  16345. @end table
  16346. and functions:
  16347. @table @option
  16348. @item a_weighting(f)
  16349. A-weighting of equal loudness
  16350. @item b_weighting(f)
  16351. B-weighting of equal loudness
  16352. @item c_weighting(f)
  16353. C-weighting of equal loudness.
  16354. @end table
  16355. Default value is @code{sono_v}.
  16356. @item sono_g, gamma
  16357. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16358. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16359. Acceptable range is @code{[1, 7]}.
  16360. @item bar_g, gamma2
  16361. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16362. @code{[1, 7]}.
  16363. @item bar_t
  16364. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16365. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16366. @item timeclamp, tc
  16367. Specify the transform timeclamp. At low frequency, there is trade-off between
  16368. accuracy in time domain and frequency domain. If timeclamp is lower,
  16369. event in time domain is represented more accurately (such as fast bass drum),
  16370. otherwise event in frequency domain is represented more accurately
  16371. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16372. @item attack
  16373. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16374. limits future samples by applying asymmetric windowing in time domain, useful
  16375. when low latency is required. Accepted range is @code{[0, 1]}.
  16376. @item basefreq
  16377. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16378. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16379. @item endfreq
  16380. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16381. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16382. @item coeffclamp
  16383. This option is deprecated and ignored.
  16384. @item tlength
  16385. Specify the transform length in time domain. Use this option to control accuracy
  16386. trade-off between time domain and frequency domain at every frequency sample.
  16387. It can contain variables:
  16388. @table @option
  16389. @item frequency, freq, f
  16390. the frequency where it is evaluated
  16391. @item timeclamp, tc
  16392. the value of @var{timeclamp} option.
  16393. @end table
  16394. Default value is @code{384*tc/(384+tc*f)}.
  16395. @item count
  16396. Specify the transform count for every video frame. Default value is @code{6}.
  16397. Acceptable range is @code{[1, 30]}.
  16398. @item fcount
  16399. Specify the transform count for every single pixel. Default value is @code{0},
  16400. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16401. @item fontfile
  16402. Specify font file for use with freetype to draw the axis. If not specified,
  16403. use embedded font. Note that drawing with font file or embedded font is not
  16404. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16405. option instead.
  16406. @item font
  16407. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16408. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16409. @item fontcolor
  16410. Specify font color expression. This is arithmetic expression that should return
  16411. integer value 0xRRGGBB. It can contain variables:
  16412. @table @option
  16413. @item frequency, freq, f
  16414. the frequency where it is evaluated
  16415. @item timeclamp, tc
  16416. the value of @var{timeclamp} option
  16417. @end table
  16418. and functions:
  16419. @table @option
  16420. @item midi(f)
  16421. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16422. @item r(x), g(x), b(x)
  16423. red, green, and blue value of intensity x.
  16424. @end table
  16425. Default value is @code{st(0, (midi(f)-59.5)/12);
  16426. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16427. r(1-ld(1)) + b(ld(1))}.
  16428. @item axisfile
  16429. Specify image file to draw the axis. This option override @var{fontfile} and
  16430. @var{fontcolor} option.
  16431. @item axis, text
  16432. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16433. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16434. Default value is @code{1}.
  16435. @item csp
  16436. Set colorspace. The accepted values are:
  16437. @table @samp
  16438. @item unspecified
  16439. Unspecified (default)
  16440. @item bt709
  16441. BT.709
  16442. @item fcc
  16443. FCC
  16444. @item bt470bg
  16445. BT.470BG or BT.601-6 625
  16446. @item smpte170m
  16447. SMPTE-170M or BT.601-6 525
  16448. @item smpte240m
  16449. SMPTE-240M
  16450. @item bt2020ncl
  16451. BT.2020 with non-constant luminance
  16452. @end table
  16453. @item cscheme
  16454. Set spectrogram color scheme. This is list of floating point values with format
  16455. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16456. The default is @code{1|0.5|0|0|0.5|1}.
  16457. @end table
  16458. @subsection Examples
  16459. @itemize
  16460. @item
  16461. Playing audio while showing the spectrum:
  16462. @example
  16463. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16464. @end example
  16465. @item
  16466. Same as above, but with frame rate 30 fps:
  16467. @example
  16468. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16469. @end example
  16470. @item
  16471. Playing at 1280x720:
  16472. @example
  16473. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16474. @end example
  16475. @item
  16476. Disable sonogram display:
  16477. @example
  16478. sono_h=0
  16479. @end example
  16480. @item
  16481. A1 and its harmonics: A1, A2, (near)E3, A3:
  16482. @example
  16483. 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),
  16484. asplit[a][out1]; [a] showcqt [out0]'
  16485. @end example
  16486. @item
  16487. Same as above, but with more accuracy in frequency domain:
  16488. @example
  16489. 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),
  16490. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16491. @end example
  16492. @item
  16493. Custom volume:
  16494. @example
  16495. bar_v=10:sono_v=bar_v*a_weighting(f)
  16496. @end example
  16497. @item
  16498. Custom gamma, now spectrum is linear to the amplitude.
  16499. @example
  16500. bar_g=2:sono_g=2
  16501. @end example
  16502. @item
  16503. Custom tlength equation:
  16504. @example
  16505. 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)))'
  16506. @end example
  16507. @item
  16508. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16509. @example
  16510. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16511. @end example
  16512. @item
  16513. Custom font using fontconfig:
  16514. @example
  16515. font='Courier New,Monospace,mono|bold'
  16516. @end example
  16517. @item
  16518. Custom frequency range with custom axis using image file:
  16519. @example
  16520. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16521. @end example
  16522. @end itemize
  16523. @section showfreqs
  16524. Convert input audio to video output representing the audio power spectrum.
  16525. Audio amplitude is on Y-axis while frequency is on X-axis.
  16526. The filter accepts the following options:
  16527. @table @option
  16528. @item size, s
  16529. Specify size of video. For the syntax of this option, check the
  16530. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16531. Default is @code{1024x512}.
  16532. @item mode
  16533. Set display mode.
  16534. This set how each frequency bin will be represented.
  16535. It accepts the following values:
  16536. @table @samp
  16537. @item line
  16538. @item bar
  16539. @item dot
  16540. @end table
  16541. Default is @code{bar}.
  16542. @item ascale
  16543. Set amplitude scale.
  16544. It accepts the following values:
  16545. @table @samp
  16546. @item lin
  16547. Linear scale.
  16548. @item sqrt
  16549. Square root scale.
  16550. @item cbrt
  16551. Cubic root scale.
  16552. @item log
  16553. Logarithmic scale.
  16554. @end table
  16555. Default is @code{log}.
  16556. @item fscale
  16557. Set frequency scale.
  16558. It accepts the following values:
  16559. @table @samp
  16560. @item lin
  16561. Linear scale.
  16562. @item log
  16563. Logarithmic scale.
  16564. @item rlog
  16565. Reverse logarithmic scale.
  16566. @end table
  16567. Default is @code{lin}.
  16568. @item win_size
  16569. Set window size.
  16570. It accepts the following values:
  16571. @table @samp
  16572. @item w16
  16573. @item w32
  16574. @item w64
  16575. @item w128
  16576. @item w256
  16577. @item w512
  16578. @item w1024
  16579. @item w2048
  16580. @item w4096
  16581. @item w8192
  16582. @item w16384
  16583. @item w32768
  16584. @item w65536
  16585. @end table
  16586. Default is @code{w2048}
  16587. @item win_func
  16588. Set windowing function.
  16589. It accepts the following values:
  16590. @table @samp
  16591. @item rect
  16592. @item bartlett
  16593. @item hanning
  16594. @item hamming
  16595. @item blackman
  16596. @item welch
  16597. @item flattop
  16598. @item bharris
  16599. @item bnuttall
  16600. @item bhann
  16601. @item sine
  16602. @item nuttall
  16603. @item lanczos
  16604. @item gauss
  16605. @item tukey
  16606. @item dolph
  16607. @item cauchy
  16608. @item parzen
  16609. @item poisson
  16610. @item bohman
  16611. @end table
  16612. Default is @code{hanning}.
  16613. @item overlap
  16614. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16615. which means optimal overlap for selected window function will be picked.
  16616. @item averaging
  16617. Set time averaging. Setting this to 0 will display current maximal peaks.
  16618. Default is @code{1}, which means time averaging is disabled.
  16619. @item colors
  16620. Specify list of colors separated by space or by '|' which will be used to
  16621. draw channel frequencies. Unrecognized or missing colors will be replaced
  16622. by white color.
  16623. @item cmode
  16624. Set channel display mode.
  16625. It accepts the following values:
  16626. @table @samp
  16627. @item combined
  16628. @item separate
  16629. @end table
  16630. Default is @code{combined}.
  16631. @item minamp
  16632. Set minimum amplitude used in @code{log} amplitude scaler.
  16633. @end table
  16634. @anchor{showspectrum}
  16635. @section showspectrum
  16636. Convert input audio to a video output, representing the audio frequency
  16637. spectrum.
  16638. The filter accepts the following options:
  16639. @table @option
  16640. @item size, s
  16641. Specify the video size for the output. For the syntax of this option, check the
  16642. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16643. Default value is @code{640x512}.
  16644. @item slide
  16645. Specify how the spectrum should slide along the window.
  16646. It accepts the following values:
  16647. @table @samp
  16648. @item replace
  16649. the samples start again on the left when they reach the right
  16650. @item scroll
  16651. the samples scroll from right to left
  16652. @item fullframe
  16653. frames are only produced when the samples reach the right
  16654. @item rscroll
  16655. the samples scroll from left to right
  16656. @end table
  16657. Default value is @code{replace}.
  16658. @item mode
  16659. Specify display mode.
  16660. It accepts the following values:
  16661. @table @samp
  16662. @item combined
  16663. all channels are displayed in the same row
  16664. @item separate
  16665. all channels are displayed in separate rows
  16666. @end table
  16667. Default value is @samp{combined}.
  16668. @item color
  16669. Specify display color mode.
  16670. It accepts the following values:
  16671. @table @samp
  16672. @item channel
  16673. each channel is displayed in a separate color
  16674. @item intensity
  16675. each channel is displayed using the same color scheme
  16676. @item rainbow
  16677. each channel is displayed using the rainbow color scheme
  16678. @item moreland
  16679. each channel is displayed using the moreland color scheme
  16680. @item nebulae
  16681. each channel is displayed using the nebulae color scheme
  16682. @item fire
  16683. each channel is displayed using the fire color scheme
  16684. @item fiery
  16685. each channel is displayed using the fiery color scheme
  16686. @item fruit
  16687. each channel is displayed using the fruit color scheme
  16688. @item cool
  16689. each channel is displayed using the cool color scheme
  16690. @item magma
  16691. each channel is displayed using the magma color scheme
  16692. @item green
  16693. each channel is displayed using the green color scheme
  16694. @item viridis
  16695. each channel is displayed using the viridis color scheme
  16696. @item plasma
  16697. each channel is displayed using the plasma color scheme
  16698. @item cividis
  16699. each channel is displayed using the cividis color scheme
  16700. @item terrain
  16701. each channel is displayed using the terrain color scheme
  16702. @end table
  16703. Default value is @samp{channel}.
  16704. @item scale
  16705. Specify scale used for calculating intensity color values.
  16706. It accepts the following values:
  16707. @table @samp
  16708. @item lin
  16709. linear
  16710. @item sqrt
  16711. square root, default
  16712. @item cbrt
  16713. cubic root
  16714. @item log
  16715. logarithmic
  16716. @item 4thrt
  16717. 4th root
  16718. @item 5thrt
  16719. 5th root
  16720. @end table
  16721. Default value is @samp{sqrt}.
  16722. @item saturation
  16723. Set saturation modifier for displayed colors. Negative values provide
  16724. alternative color scheme. @code{0} is no saturation at all.
  16725. Saturation must be in [-10.0, 10.0] range.
  16726. Default value is @code{1}.
  16727. @item win_func
  16728. Set window function.
  16729. It accepts the following values:
  16730. @table @samp
  16731. @item rect
  16732. @item bartlett
  16733. @item hann
  16734. @item hanning
  16735. @item hamming
  16736. @item blackman
  16737. @item welch
  16738. @item flattop
  16739. @item bharris
  16740. @item bnuttall
  16741. @item bhann
  16742. @item sine
  16743. @item nuttall
  16744. @item lanczos
  16745. @item gauss
  16746. @item tukey
  16747. @item dolph
  16748. @item cauchy
  16749. @item parzen
  16750. @item poisson
  16751. @item bohman
  16752. @end table
  16753. Default value is @code{hann}.
  16754. @item orientation
  16755. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16756. @code{horizontal}. Default is @code{vertical}.
  16757. @item overlap
  16758. Set ratio of overlap window. Default value is @code{0}.
  16759. When value is @code{1} overlap is set to recommended size for specific
  16760. window function currently used.
  16761. @item gain
  16762. Set scale gain for calculating intensity color values.
  16763. Default value is @code{1}.
  16764. @item data
  16765. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  16766. @item rotation
  16767. Set color rotation, must be in [-1.0, 1.0] range.
  16768. Default value is @code{0}.
  16769. @item start
  16770. Set start frequency from which to display spectrogram. Default is @code{0}.
  16771. @item stop
  16772. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16773. @item fps
  16774. Set upper frame rate limit. Default is @code{auto}, unlimited.
  16775. @item legend
  16776. Draw time and frequency axes and legends. Default is disabled.
  16777. @end table
  16778. The usage is very similar to the showwaves filter; see the examples in that
  16779. section.
  16780. @subsection Examples
  16781. @itemize
  16782. @item
  16783. Large window with logarithmic color scaling:
  16784. @example
  16785. showspectrum=s=1280x480:scale=log
  16786. @end example
  16787. @item
  16788. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  16789. @example
  16790. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16791. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  16792. @end example
  16793. @end itemize
  16794. @section showspectrumpic
  16795. Convert input audio to a single video frame, representing the audio frequency
  16796. spectrum.
  16797. The filter accepts the following options:
  16798. @table @option
  16799. @item size, s
  16800. Specify the video size for the output. For the syntax of this option, check the
  16801. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16802. Default value is @code{4096x2048}.
  16803. @item mode
  16804. Specify display mode.
  16805. It accepts the following values:
  16806. @table @samp
  16807. @item combined
  16808. all channels are displayed in the same row
  16809. @item separate
  16810. all channels are displayed in separate rows
  16811. @end table
  16812. Default value is @samp{combined}.
  16813. @item color
  16814. Specify display color mode.
  16815. It accepts the following values:
  16816. @table @samp
  16817. @item channel
  16818. each channel is displayed in a separate color
  16819. @item intensity
  16820. each channel is displayed using the same color scheme
  16821. @item rainbow
  16822. each channel is displayed using the rainbow color scheme
  16823. @item moreland
  16824. each channel is displayed using the moreland color scheme
  16825. @item nebulae
  16826. each channel is displayed using the nebulae color scheme
  16827. @item fire
  16828. each channel is displayed using the fire color scheme
  16829. @item fiery
  16830. each channel is displayed using the fiery color scheme
  16831. @item fruit
  16832. each channel is displayed using the fruit color scheme
  16833. @item cool
  16834. each channel is displayed using the cool color scheme
  16835. @item magma
  16836. each channel is displayed using the magma color scheme
  16837. @item green
  16838. each channel is displayed using the green color scheme
  16839. @item viridis
  16840. each channel is displayed using the viridis color scheme
  16841. @item plasma
  16842. each channel is displayed using the plasma color scheme
  16843. @item cividis
  16844. each channel is displayed using the cividis color scheme
  16845. @item terrain
  16846. each channel is displayed using the terrain color scheme
  16847. @end table
  16848. Default value is @samp{intensity}.
  16849. @item scale
  16850. Specify scale used for calculating intensity color values.
  16851. It accepts the following values:
  16852. @table @samp
  16853. @item lin
  16854. linear
  16855. @item sqrt
  16856. square root, default
  16857. @item cbrt
  16858. cubic root
  16859. @item log
  16860. logarithmic
  16861. @item 4thrt
  16862. 4th root
  16863. @item 5thrt
  16864. 5th root
  16865. @end table
  16866. Default value is @samp{log}.
  16867. @item saturation
  16868. Set saturation modifier for displayed colors. Negative values provide
  16869. alternative color scheme. @code{0} is no saturation at all.
  16870. Saturation must be in [-10.0, 10.0] range.
  16871. Default value is @code{1}.
  16872. @item win_func
  16873. Set window function.
  16874. It accepts the following values:
  16875. @table @samp
  16876. @item rect
  16877. @item bartlett
  16878. @item hann
  16879. @item hanning
  16880. @item hamming
  16881. @item blackman
  16882. @item welch
  16883. @item flattop
  16884. @item bharris
  16885. @item bnuttall
  16886. @item bhann
  16887. @item sine
  16888. @item nuttall
  16889. @item lanczos
  16890. @item gauss
  16891. @item tukey
  16892. @item dolph
  16893. @item cauchy
  16894. @item parzen
  16895. @item poisson
  16896. @item bohman
  16897. @end table
  16898. Default value is @code{hann}.
  16899. @item orientation
  16900. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16901. @code{horizontal}. Default is @code{vertical}.
  16902. @item gain
  16903. Set scale gain for calculating intensity color values.
  16904. Default value is @code{1}.
  16905. @item legend
  16906. Draw time and frequency axes and legends. Default is enabled.
  16907. @item rotation
  16908. Set color rotation, must be in [-1.0, 1.0] range.
  16909. Default value is @code{0}.
  16910. @item start
  16911. Set start frequency from which to display spectrogram. Default is @code{0}.
  16912. @item stop
  16913. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16914. @end table
  16915. @subsection Examples
  16916. @itemize
  16917. @item
  16918. Extract an audio spectrogram of a whole audio track
  16919. in a 1024x1024 picture using @command{ffmpeg}:
  16920. @example
  16921. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  16922. @end example
  16923. @end itemize
  16924. @section showvolume
  16925. Convert input audio volume to a video output.
  16926. The filter accepts the following options:
  16927. @table @option
  16928. @item rate, r
  16929. Set video rate.
  16930. @item b
  16931. Set border width, allowed range is [0, 5]. Default is 1.
  16932. @item w
  16933. Set channel width, allowed range is [80, 8192]. Default is 400.
  16934. @item h
  16935. Set channel height, allowed range is [1, 900]. Default is 20.
  16936. @item f
  16937. Set fade, allowed range is [0, 1]. Default is 0.95.
  16938. @item c
  16939. Set volume color expression.
  16940. The expression can use the following variables:
  16941. @table @option
  16942. @item VOLUME
  16943. Current max volume of channel in dB.
  16944. @item PEAK
  16945. Current peak.
  16946. @item CHANNEL
  16947. Current channel number, starting from 0.
  16948. @end table
  16949. @item t
  16950. If set, displays channel names. Default is enabled.
  16951. @item v
  16952. If set, displays volume values. Default is enabled.
  16953. @item o
  16954. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  16955. default is @code{h}.
  16956. @item s
  16957. Set step size, allowed range is [0, 5]. Default is 0, which means
  16958. step is disabled.
  16959. @item p
  16960. Set background opacity, allowed range is [0, 1]. Default is 0.
  16961. @item m
  16962. Set metering mode, can be peak: @code{p} or rms: @code{r},
  16963. default is @code{p}.
  16964. @item ds
  16965. Set display scale, can be linear: @code{lin} or log: @code{log},
  16966. default is @code{lin}.
  16967. @item dm
  16968. In second.
  16969. If set to > 0., display a line for the max level
  16970. in the previous seconds.
  16971. default is disabled: @code{0.}
  16972. @item dmc
  16973. The color of the max line. Use when @code{dm} option is set to > 0.
  16974. default is: @code{orange}
  16975. @end table
  16976. @section showwaves
  16977. Convert input audio to a video output, representing the samples waves.
  16978. The filter accepts the following options:
  16979. @table @option
  16980. @item size, s
  16981. Specify the video size for the output. For the syntax of this option, check the
  16982. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16983. Default value is @code{600x240}.
  16984. @item mode
  16985. Set display mode.
  16986. Available values are:
  16987. @table @samp
  16988. @item point
  16989. Draw a point for each sample.
  16990. @item line
  16991. Draw a vertical line for each sample.
  16992. @item p2p
  16993. Draw a point for each sample and a line between them.
  16994. @item cline
  16995. Draw a centered vertical line for each sample.
  16996. @end table
  16997. Default value is @code{point}.
  16998. @item n
  16999. Set the number of samples which are printed on the same column. A
  17000. larger value will decrease the frame rate. Must be a positive
  17001. integer. This option can be set only if the value for @var{rate}
  17002. is not explicitly specified.
  17003. @item rate, r
  17004. Set the (approximate) output frame rate. This is done by setting the
  17005. option @var{n}. Default value is "25".
  17006. @item split_channels
  17007. Set if channels should be drawn separately or overlap. Default value is 0.
  17008. @item colors
  17009. Set colors separated by '|' which are going to be used for drawing of each channel.
  17010. @item scale
  17011. Set amplitude scale.
  17012. Available values are:
  17013. @table @samp
  17014. @item lin
  17015. Linear.
  17016. @item log
  17017. Logarithmic.
  17018. @item sqrt
  17019. Square root.
  17020. @item cbrt
  17021. Cubic root.
  17022. @end table
  17023. Default is linear.
  17024. @item draw
  17025. Set the draw mode. This is mostly useful to set for high @var{n}.
  17026. Available values are:
  17027. @table @samp
  17028. @item scale
  17029. Scale pixel values for each drawn sample.
  17030. @item full
  17031. Draw every sample directly.
  17032. @end table
  17033. Default value is @code{scale}.
  17034. @end table
  17035. @subsection Examples
  17036. @itemize
  17037. @item
  17038. Output the input file audio and the corresponding video representation
  17039. at the same time:
  17040. @example
  17041. amovie=a.mp3,asplit[out0],showwaves[out1]
  17042. @end example
  17043. @item
  17044. Create a synthetic signal and show it with showwaves, forcing a
  17045. frame rate of 30 frames per second:
  17046. @example
  17047. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17048. @end example
  17049. @end itemize
  17050. @section showwavespic
  17051. Convert input audio to a single video frame, representing the samples waves.
  17052. The filter accepts the following options:
  17053. @table @option
  17054. @item size, s
  17055. Specify the video size for the output. For the syntax of this option, check the
  17056. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17057. Default value is @code{600x240}.
  17058. @item split_channels
  17059. Set if channels should be drawn separately or overlap. Default value is 0.
  17060. @item colors
  17061. Set colors separated by '|' which are going to be used for drawing of each channel.
  17062. @item scale
  17063. Set amplitude scale.
  17064. Available values are:
  17065. @table @samp
  17066. @item lin
  17067. Linear.
  17068. @item log
  17069. Logarithmic.
  17070. @item sqrt
  17071. Square root.
  17072. @item cbrt
  17073. Cubic root.
  17074. @end table
  17075. Default is linear.
  17076. @end table
  17077. @subsection Examples
  17078. @itemize
  17079. @item
  17080. Extract a channel split representation of the wave form of a whole audio track
  17081. in a 1024x800 picture using @command{ffmpeg}:
  17082. @example
  17083. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17084. @end example
  17085. @end itemize
  17086. @section sidedata, asidedata
  17087. Delete frame side data, or select frames based on it.
  17088. This filter accepts the following options:
  17089. @table @option
  17090. @item mode
  17091. Set mode of operation of the filter.
  17092. Can be one of the following:
  17093. @table @samp
  17094. @item select
  17095. Select every frame with side data of @code{type}.
  17096. @item delete
  17097. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17098. data in the frame.
  17099. @end table
  17100. @item type
  17101. Set side data type used with all modes. Must be set for @code{select} mode. For
  17102. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17103. in @file{libavutil/frame.h}. For example, to choose
  17104. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17105. @end table
  17106. @section spectrumsynth
  17107. Sythesize audio from 2 input video spectrums, first input stream represents
  17108. magnitude across time and second represents phase across time.
  17109. The filter will transform from frequency domain as displayed in videos back
  17110. to time domain as presented in audio output.
  17111. This filter is primarily created for reversing processed @ref{showspectrum}
  17112. filter outputs, but can synthesize sound from other spectrograms too.
  17113. But in such case results are going to be poor if the phase data is not
  17114. available, because in such cases phase data need to be recreated, usually
  17115. its just recreated from random noise.
  17116. For best results use gray only output (@code{channel} color mode in
  17117. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17118. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17119. @code{data} option. Inputs videos should generally use @code{fullframe}
  17120. slide mode as that saves resources needed for decoding video.
  17121. The filter accepts the following options:
  17122. @table @option
  17123. @item sample_rate
  17124. Specify sample rate of output audio, the sample rate of audio from which
  17125. spectrum was generated may differ.
  17126. @item channels
  17127. Set number of channels represented in input video spectrums.
  17128. @item scale
  17129. Set scale which was used when generating magnitude input spectrum.
  17130. Can be @code{lin} or @code{log}. Default is @code{log}.
  17131. @item slide
  17132. Set slide which was used when generating inputs spectrums.
  17133. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17134. Default is @code{fullframe}.
  17135. @item win_func
  17136. Set window function used for resynthesis.
  17137. @item overlap
  17138. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17139. which means optimal overlap for selected window function will be picked.
  17140. @item orientation
  17141. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17142. Default is @code{vertical}.
  17143. @end table
  17144. @subsection Examples
  17145. @itemize
  17146. @item
  17147. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17148. then resynthesize videos back to audio with spectrumsynth:
  17149. @example
  17150. 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
  17151. 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
  17152. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17153. @end example
  17154. @end itemize
  17155. @section split, asplit
  17156. Split input into several identical outputs.
  17157. @code{asplit} works with audio input, @code{split} with video.
  17158. The filter accepts a single parameter which specifies the number of outputs. If
  17159. unspecified, it defaults to 2.
  17160. @subsection Examples
  17161. @itemize
  17162. @item
  17163. Create two separate outputs from the same input:
  17164. @example
  17165. [in] split [out0][out1]
  17166. @end example
  17167. @item
  17168. To create 3 or more outputs, you need to specify the number of
  17169. outputs, like in:
  17170. @example
  17171. [in] asplit=3 [out0][out1][out2]
  17172. @end example
  17173. @item
  17174. Create two separate outputs from the same input, one cropped and
  17175. one padded:
  17176. @example
  17177. [in] split [splitout1][splitout2];
  17178. [splitout1] crop=100:100:0:0 [cropout];
  17179. [splitout2] pad=200:200:100:100 [padout];
  17180. @end example
  17181. @item
  17182. Create 5 copies of the input audio with @command{ffmpeg}:
  17183. @example
  17184. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17185. @end example
  17186. @end itemize
  17187. @section zmq, azmq
  17188. Receive commands sent through a libzmq client, and forward them to
  17189. filters in the filtergraph.
  17190. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17191. must be inserted between two video filters, @code{azmq} between two
  17192. audio filters. Both are capable to send messages to any filter type.
  17193. To enable these filters you need to install the libzmq library and
  17194. headers and configure FFmpeg with @code{--enable-libzmq}.
  17195. For more information about libzmq see:
  17196. @url{http://www.zeromq.org/}
  17197. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17198. receives messages sent through a network interface defined by the
  17199. @option{bind_address} (or the abbreviation "@option{b}") option.
  17200. Default value of this option is @file{tcp://localhost:5555}. You may
  17201. want to alter this value to your needs, but do not forget to escape any
  17202. ':' signs (see @ref{filtergraph escaping}).
  17203. The received message must be in the form:
  17204. @example
  17205. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17206. @end example
  17207. @var{TARGET} specifies the target of the command, usually the name of
  17208. the filter class or a specific filter instance name. The default
  17209. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17210. but you can override this by using the @samp{filter_name@@id} syntax
  17211. (see @ref{Filtergraph syntax}).
  17212. @var{COMMAND} specifies the name of the command for the target filter.
  17213. @var{ARG} is optional and specifies the optional argument list for the
  17214. given @var{COMMAND}.
  17215. Upon reception, the message is processed and the corresponding command
  17216. is injected into the filtergraph. Depending on the result, the filter
  17217. will send a reply to the client, adopting the format:
  17218. @example
  17219. @var{ERROR_CODE} @var{ERROR_REASON}
  17220. @var{MESSAGE}
  17221. @end example
  17222. @var{MESSAGE} is optional.
  17223. @subsection Examples
  17224. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17225. be used to send commands processed by these filters.
  17226. Consider the following filtergraph generated by @command{ffplay}.
  17227. In this example the last overlay filter has an instance name. All other
  17228. filters will have default instance names.
  17229. @example
  17230. ffplay -dumpgraph 1 -f lavfi "
  17231. color=s=100x100:c=red [l];
  17232. color=s=100x100:c=blue [r];
  17233. nullsrc=s=200x100, zmq [bg];
  17234. [bg][l] overlay [bg+l];
  17235. [bg+l][r] overlay@@my=x=100 "
  17236. @end example
  17237. To change the color of the left side of the video, the following
  17238. command can be used:
  17239. @example
  17240. echo Parsed_color_0 c yellow | tools/zmqsend
  17241. @end example
  17242. To change the right side:
  17243. @example
  17244. echo Parsed_color_1 c pink | tools/zmqsend
  17245. @end example
  17246. To change the position of the right side:
  17247. @example
  17248. echo overlay@@my x 150 | tools/zmqsend
  17249. @end example
  17250. @c man end MULTIMEDIA FILTERS
  17251. @chapter Multimedia Sources
  17252. @c man begin MULTIMEDIA SOURCES
  17253. Below is a description of the currently available multimedia sources.
  17254. @section amovie
  17255. This is the same as @ref{movie} source, except it selects an audio
  17256. stream by default.
  17257. @anchor{movie}
  17258. @section movie
  17259. Read audio and/or video stream(s) from a movie container.
  17260. It accepts the following parameters:
  17261. @table @option
  17262. @item filename
  17263. The name of the resource to read (not necessarily a file; it can also be a
  17264. device or a stream accessed through some protocol).
  17265. @item format_name, f
  17266. Specifies the format assumed for the movie to read, and can be either
  17267. the name of a container or an input device. If not specified, the
  17268. format is guessed from @var{movie_name} or by probing.
  17269. @item seek_point, sp
  17270. Specifies the seek point in seconds. The frames will be output
  17271. starting from this seek point. The parameter is evaluated with
  17272. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17273. postfix. The default value is "0".
  17274. @item streams, s
  17275. Specifies the streams to read. Several streams can be specified,
  17276. separated by "+". The source will then have as many outputs, in the
  17277. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17278. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17279. respectively the default (best suited) video and audio stream. Default
  17280. is "dv", or "da" if the filter is called as "amovie".
  17281. @item stream_index, si
  17282. Specifies the index of the video stream to read. If the value is -1,
  17283. the most suitable video stream will be automatically selected. The default
  17284. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17285. audio instead of video.
  17286. @item loop
  17287. Specifies how many times to read the stream in sequence.
  17288. If the value is 0, the stream will be looped infinitely.
  17289. Default value is "1".
  17290. Note that when the movie is looped the source timestamps are not
  17291. changed, so it will generate non monotonically increasing timestamps.
  17292. @item discontinuity
  17293. Specifies the time difference between frames above which the point is
  17294. considered a timestamp discontinuity which is removed by adjusting the later
  17295. timestamps.
  17296. @end table
  17297. It allows overlaying a second video on top of the main input of
  17298. a filtergraph, as shown in this graph:
  17299. @example
  17300. input -----------> deltapts0 --> overlay --> output
  17301. ^
  17302. |
  17303. movie --> scale--> deltapts1 -------+
  17304. @end example
  17305. @subsection Examples
  17306. @itemize
  17307. @item
  17308. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17309. on top of the input labelled "in":
  17310. @example
  17311. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17312. [in] setpts=PTS-STARTPTS [main];
  17313. [main][over] overlay=16:16 [out]
  17314. @end example
  17315. @item
  17316. Read from a video4linux2 device, and overlay it on top of the input
  17317. labelled "in":
  17318. @example
  17319. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17320. [in] setpts=PTS-STARTPTS [main];
  17321. [main][over] overlay=16:16 [out]
  17322. @end example
  17323. @item
  17324. Read the first video stream and the audio stream with id 0x81 from
  17325. dvd.vob; the video is connected to the pad named "video" and the audio is
  17326. connected to the pad named "audio":
  17327. @example
  17328. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17329. @end example
  17330. @end itemize
  17331. @subsection Commands
  17332. Both movie and amovie support the following commands:
  17333. @table @option
  17334. @item seek
  17335. Perform seek using "av_seek_frame".
  17336. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17337. @itemize
  17338. @item
  17339. @var{stream_index}: If stream_index is -1, a default
  17340. stream is selected, and @var{timestamp} is automatically converted
  17341. from AV_TIME_BASE units to the stream specific time_base.
  17342. @item
  17343. @var{timestamp}: Timestamp in AVStream.time_base units
  17344. or, if no stream is specified, in AV_TIME_BASE units.
  17345. @item
  17346. @var{flags}: Flags which select direction and seeking mode.
  17347. @end itemize
  17348. @item get_duration
  17349. Get movie duration in AV_TIME_BASE units.
  17350. @end table
  17351. @c man end MULTIMEDIA SOURCES