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.

24804 lines
661KB

  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{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  413. Default is @var{4th}.
  414. @end table
  415. @section acrusher
  416. Reduce audio bit resolution.
  417. This filter is bit crusher with enhanced functionality. A bit crusher
  418. is used to audibly reduce number of bits an audio signal is sampled
  419. with. This doesn't change the bit depth at all, it just produces the
  420. effect. Material reduced in bit depth sounds more harsh and "digital".
  421. This filter is able to even round to continuous values instead of discrete
  422. bit depths.
  423. Additionally it has a D/C offset which results in different crushing of
  424. the lower and the upper half of the signal.
  425. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  426. Another feature of this filter is the logarithmic mode.
  427. This setting switches from linear distances between bits to logarithmic ones.
  428. The result is a much more "natural" sounding crusher which doesn't gate low
  429. signals for example. The human ear has a logarithmic perception,
  430. so this kind of crushing is much more pleasant.
  431. Logarithmic crushing is also able to get anti-aliased.
  432. The filter accepts the following options:
  433. @table @option
  434. @item level_in
  435. Set level in.
  436. @item level_out
  437. Set level out.
  438. @item bits
  439. Set bit reduction.
  440. @item mix
  441. Set mixing amount.
  442. @item mode
  443. Can be linear: @code{lin} or logarithmic: @code{log}.
  444. @item dc
  445. Set DC.
  446. @item aa
  447. Set anti-aliasing.
  448. @item samples
  449. Set sample reduction.
  450. @item lfo
  451. Enable LFO. By default disabled.
  452. @item lforange
  453. Set LFO range.
  454. @item lforate
  455. Set LFO rate.
  456. @end table
  457. @section acue
  458. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  459. filter.
  460. @section adeclick
  461. Remove impulsive noise from input audio.
  462. Samples detected as impulsive noise are replaced by interpolated samples using
  463. autoregressive modelling.
  464. @table @option
  465. @item w
  466. Set window size, in milliseconds. Allowed range is from @code{10} to
  467. @code{100}. Default value is @code{55} milliseconds.
  468. This sets size of window which will be processed at once.
  469. @item o
  470. Set window overlap, in percentage of window size. Allowed range is from
  471. @code{50} to @code{95}. Default value is @code{75} percent.
  472. Setting this to a very high value increases impulsive noise removal but makes
  473. whole process much slower.
  474. @item a
  475. Set autoregression order, in percentage of window size. Allowed range is from
  476. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  477. controls quality of interpolated samples using neighbour good samples.
  478. @item t
  479. Set threshold value. Allowed range is from @code{1} to @code{100}.
  480. Default value is @code{2}.
  481. This controls the strength of impulsive noise which is going to be removed.
  482. The lower value, the more samples will be detected as impulsive noise.
  483. @item b
  484. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  485. @code{10}. Default value is @code{2}.
  486. If any two samples detected as noise are spaced less than this value then any
  487. sample between those two samples will be also detected as noise.
  488. @item m
  489. Set overlap method.
  490. It accepts the following values:
  491. @table @option
  492. @item a
  493. Select overlap-add method. Even not interpolated samples are slightly
  494. changed with this method.
  495. @item s
  496. Select overlap-save method. Not interpolated samples remain unchanged.
  497. @end table
  498. Default value is @code{a}.
  499. @end table
  500. @section adeclip
  501. Remove clipped samples from input audio.
  502. Samples detected as clipped are replaced by interpolated samples using
  503. autoregressive modelling.
  504. @table @option
  505. @item w
  506. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  507. Default value is @code{55} milliseconds.
  508. This sets size of window which will be processed at once.
  509. @item o
  510. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  511. to @code{95}. Default value is @code{75} percent.
  512. @item a
  513. Set autoregression order, in percentage of window size. Allowed range is from
  514. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  515. quality of interpolated samples using neighbour good samples.
  516. @item t
  517. Set threshold value. Allowed range is from @code{1} to @code{100}.
  518. Default value is @code{10}. Higher values make clip detection less aggressive.
  519. @item n
  520. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  521. Default value is @code{1000}. Higher values make clip detection less aggressive.
  522. @item m
  523. Set overlap method.
  524. It accepts the following values:
  525. @table @option
  526. @item a
  527. Select overlap-add method. Even not interpolated samples are slightly changed
  528. with this method.
  529. @item s
  530. Select overlap-save method. Not interpolated samples remain unchanged.
  531. @end table
  532. Default value is @code{a}.
  533. @end table
  534. @section adelay
  535. Delay one or more audio channels.
  536. Samples in delayed channel are filled with silence.
  537. The filter accepts the following option:
  538. @table @option
  539. @item delays
  540. Set list of delays in milliseconds for each channel separated by '|'.
  541. Unused delays will be silently ignored. If number of given delays is
  542. smaller than number of channels all remaining channels will not be delayed.
  543. If you want to delay exact number of samples, append 'S' to number.
  544. If you want instead to delay in seconds, append 's' to number.
  545. @item all
  546. Use last set delay for all remaining channels. By default is disabled.
  547. This option if enabled changes how option @code{delays} is interpreted.
  548. @end table
  549. @subsection Examples
  550. @itemize
  551. @item
  552. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  553. the second channel (and any other channels that may be present) unchanged.
  554. @example
  555. adelay=1500|0|500
  556. @end example
  557. @item
  558. Delay second channel by 500 samples, the third channel by 700 samples and leave
  559. the first channel (and any other channels that may be present) unchanged.
  560. @example
  561. adelay=0|500S|700S
  562. @end example
  563. @item
  564. Delay all channels by same number of samples:
  565. @example
  566. adelay=delays=64S:all=1
  567. @end example
  568. @end itemize
  569. @section aderivative, aintegral
  570. Compute derivative/integral of audio stream.
  571. Applying both filters one after another produces original audio.
  572. @section aecho
  573. Apply echoing to the input audio.
  574. Echoes are reflected sound and can occur naturally amongst mountains
  575. (and sometimes large buildings) when talking or shouting; digital echo
  576. effects emulate this behaviour and are often used to help fill out the
  577. sound of a single instrument or vocal. The time difference between the
  578. original signal and the reflection is the @code{delay}, and the
  579. loudness of the reflected signal is the @code{decay}.
  580. Multiple echoes can have different delays and decays.
  581. A description of the accepted parameters follows.
  582. @table @option
  583. @item in_gain
  584. Set input gain of reflected signal. Default is @code{0.6}.
  585. @item out_gain
  586. Set output gain of reflected signal. Default is @code{0.3}.
  587. @item delays
  588. Set list of time intervals in milliseconds between original signal and reflections
  589. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  590. Default is @code{1000}.
  591. @item decays
  592. Set list of loudness of reflected signals separated by '|'.
  593. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  594. Default is @code{0.5}.
  595. @end table
  596. @subsection Examples
  597. @itemize
  598. @item
  599. Make it sound as if there are twice as many instruments as are actually playing:
  600. @example
  601. aecho=0.8:0.88:60:0.4
  602. @end example
  603. @item
  604. If delay is very short, then it sounds like a (metallic) robot playing music:
  605. @example
  606. aecho=0.8:0.88:6:0.4
  607. @end example
  608. @item
  609. A longer delay will sound like an open air concert in the mountains:
  610. @example
  611. aecho=0.8:0.9:1000:0.3
  612. @end example
  613. @item
  614. Same as above but with one more mountain:
  615. @example
  616. aecho=0.8:0.9:1000|1800:0.3|0.25
  617. @end example
  618. @end itemize
  619. @section aemphasis
  620. Audio emphasis filter creates or restores material directly taken from LPs or
  621. emphased CDs with different filter curves. E.g. to store music on vinyl the
  622. signal has to be altered by a filter first to even out the disadvantages of
  623. this recording medium.
  624. Once the material is played back the inverse filter has to be applied to
  625. restore the distortion of the frequency response.
  626. The filter accepts the following options:
  627. @table @option
  628. @item level_in
  629. Set input gain.
  630. @item level_out
  631. Set output gain.
  632. @item mode
  633. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  634. use @code{production} mode. Default is @code{reproduction} mode.
  635. @item type
  636. Set filter type. Selects medium. Can be one of the following:
  637. @table @option
  638. @item col
  639. select Columbia.
  640. @item emi
  641. select EMI.
  642. @item bsi
  643. select BSI (78RPM).
  644. @item riaa
  645. select RIAA.
  646. @item cd
  647. select Compact Disc (CD).
  648. @item 50fm
  649. select 50µs (FM).
  650. @item 75fm
  651. select 75µs (FM).
  652. @item 50kf
  653. select 50µs (FM-KF).
  654. @item 75kf
  655. select 75µs (FM-KF).
  656. @end table
  657. @end table
  658. @section aeval
  659. Modify an audio signal according to the specified expressions.
  660. This filter accepts one or more expressions (one for each channel),
  661. which are evaluated and used to modify a corresponding audio signal.
  662. It accepts the following parameters:
  663. @table @option
  664. @item exprs
  665. Set the '|'-separated expressions list for each separate channel. If
  666. the number of input channels is greater than the number of
  667. expressions, the last specified expression is used for the remaining
  668. output channels.
  669. @item channel_layout, c
  670. Set output channel layout. If not specified, the channel layout is
  671. specified by the number of expressions. If set to @samp{same}, it will
  672. use by default the same input channel layout.
  673. @end table
  674. Each expression in @var{exprs} can contain the following constants and functions:
  675. @table @option
  676. @item ch
  677. channel number of the current expression
  678. @item n
  679. number of the evaluated sample, starting from 0
  680. @item s
  681. sample rate
  682. @item t
  683. time of the evaluated sample expressed in seconds
  684. @item nb_in_channels
  685. @item nb_out_channels
  686. input and output number of channels
  687. @item val(CH)
  688. the value of input channel with number @var{CH}
  689. @end table
  690. Note: this filter is slow. For faster processing you should use a
  691. dedicated filter.
  692. @subsection Examples
  693. @itemize
  694. @item
  695. Half volume:
  696. @example
  697. aeval=val(ch)/2:c=same
  698. @end example
  699. @item
  700. Invert phase of the second channel:
  701. @example
  702. aeval=val(0)|-val(1)
  703. @end example
  704. @end itemize
  705. @anchor{afade}
  706. @section afade
  707. Apply fade-in/out effect to input audio.
  708. A description of the accepted parameters follows.
  709. @table @option
  710. @item type, t
  711. Specify the effect type, can be either @code{in} for fade-in, or
  712. @code{out} for a fade-out effect. Default is @code{in}.
  713. @item start_sample, ss
  714. Specify the number of the start sample for starting to apply the fade
  715. effect. Default is 0.
  716. @item nb_samples, ns
  717. Specify the number of samples for which the fade effect has to last. At
  718. the end of the fade-in effect the output audio will have the same
  719. volume as the input audio, at the end of the fade-out transition
  720. the output audio will be silence. Default is 44100.
  721. @item start_time, st
  722. Specify the start time of the fade effect. Default is 0.
  723. The value must be specified as a time duration; see
  724. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  725. for the accepted syntax.
  726. If set this option is used instead of @var{start_sample}.
  727. @item duration, d
  728. Specify the duration of the fade effect. See
  729. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  730. for the accepted syntax.
  731. At the end of the fade-in effect the output audio will have the same
  732. volume as the input audio, at the end of the fade-out transition
  733. the output audio will be silence.
  734. By default the duration is determined by @var{nb_samples}.
  735. If set this option is used instead of @var{nb_samples}.
  736. @item curve
  737. Set curve for fade transition.
  738. It accepts the following values:
  739. @table @option
  740. @item tri
  741. select triangular, linear slope (default)
  742. @item qsin
  743. select quarter of sine wave
  744. @item hsin
  745. select half of sine wave
  746. @item esin
  747. select exponential sine wave
  748. @item log
  749. select logarithmic
  750. @item ipar
  751. select inverted parabola
  752. @item qua
  753. select quadratic
  754. @item cub
  755. select cubic
  756. @item squ
  757. select square root
  758. @item cbr
  759. select cubic root
  760. @item par
  761. select parabola
  762. @item exp
  763. select exponential
  764. @item iqsin
  765. select inverted quarter of sine wave
  766. @item ihsin
  767. select inverted half of sine wave
  768. @item dese
  769. select double-exponential seat
  770. @item desi
  771. select double-exponential sigmoid
  772. @item losi
  773. select logistic sigmoid
  774. @item nofade
  775. no fade applied
  776. @end table
  777. @end table
  778. @subsection Examples
  779. @itemize
  780. @item
  781. Fade in first 15 seconds of audio:
  782. @example
  783. afade=t=in:ss=0:d=15
  784. @end example
  785. @item
  786. Fade out last 25 seconds of a 900 seconds audio:
  787. @example
  788. afade=t=out:st=875:d=25
  789. @end example
  790. @end itemize
  791. @section afftdn
  792. Denoise audio samples with FFT.
  793. A description of the accepted parameters follows.
  794. @table @option
  795. @item nr
  796. Set the noise reduction in dB, allowed range is 0.01 to 97.
  797. Default value is 12 dB.
  798. @item nf
  799. Set the noise floor in dB, allowed range is -80 to -20.
  800. Default value is -50 dB.
  801. @item nt
  802. Set the noise type.
  803. It accepts the following values:
  804. @table @option
  805. @item w
  806. Select white noise.
  807. @item v
  808. Select vinyl noise.
  809. @item s
  810. Select shellac noise.
  811. @item c
  812. Select custom noise, defined in @code{bn} option.
  813. Default value is white noise.
  814. @end table
  815. @item bn
  816. Set custom band noise for every one of 15 bands.
  817. Bands are separated by ' ' or '|'.
  818. @item rf
  819. Set the residual floor in dB, allowed range is -80 to -20.
  820. Default value is -38 dB.
  821. @item tn
  822. Enable noise tracking. By default is disabled.
  823. With this enabled, noise floor is automatically adjusted.
  824. @item tr
  825. Enable residual tracking. By default is disabled.
  826. @item om
  827. Set the output mode.
  828. It accepts the following values:
  829. @table @option
  830. @item i
  831. Pass input unchanged.
  832. @item o
  833. Pass noise filtered out.
  834. @item n
  835. Pass only noise.
  836. Default value is @var{o}.
  837. @end table
  838. @end table
  839. @subsection Commands
  840. This filter supports the following commands:
  841. @table @option
  842. @item sample_noise, sn
  843. Start or stop measuring noise profile.
  844. Syntax for the command is : "start" or "stop" string.
  845. After measuring noise profile is stopped it will be
  846. automatically applied in filtering.
  847. @item noise_reduction, nr
  848. Change noise reduction. Argument is single float number.
  849. Syntax for the command is : "@var{noise_reduction}"
  850. @item noise_floor, nf
  851. Change noise floor. Argument is single float number.
  852. Syntax for the command is : "@var{noise_floor}"
  853. @item output_mode, om
  854. Change output mode operation.
  855. Syntax for the command is : "i", "o" or "n" string.
  856. @end table
  857. @section afftfilt
  858. Apply arbitrary expressions to samples in frequency domain.
  859. @table @option
  860. @item real
  861. Set frequency domain real expression for each separate channel separated
  862. by '|'. Default is "re".
  863. If the number of input channels is greater than the number of
  864. expressions, the last specified expression is used for the remaining
  865. output channels.
  866. @item imag
  867. Set frequency domain imaginary expression for each separate channel
  868. separated by '|'. Default is "im".
  869. Each expression in @var{real} and @var{imag} can contain the following
  870. constants and functions:
  871. @table @option
  872. @item sr
  873. sample rate
  874. @item b
  875. current frequency bin number
  876. @item nb
  877. number of available bins
  878. @item ch
  879. channel number of the current expression
  880. @item chs
  881. number of channels
  882. @item pts
  883. current frame pts
  884. @item re
  885. current real part of frequency bin of current channel
  886. @item im
  887. current imaginary part of frequency bin of current channel
  888. @item real(b, ch)
  889. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  890. @item imag(b, ch)
  891. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  892. @end table
  893. @item win_size
  894. Set window size. Allowed range is from 16 to 131072.
  895. Default is @code{4096}
  896. @item win_func
  897. Set window function. Default is @code{hann}.
  898. @item overlap
  899. Set window overlap. If set to 1, the recommended overlap for selected
  900. window function will be picked. Default is @code{0.75}.
  901. @end table
  902. @subsection Examples
  903. @itemize
  904. @item
  905. Leave almost only low frequencies in audio:
  906. @example
  907. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  908. @end example
  909. @item
  910. Apply robotize effect:
  911. @example
  912. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  913. @end example
  914. @item
  915. Apply whisper effect:
  916. @example
  917. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  918. @end example
  919. @end itemize
  920. @anchor{afir}
  921. @section afir
  922. Apply an arbitrary Finite Impulse Response filter.
  923. This filter is designed for applying long FIR filters,
  924. up to 60 seconds long.
  925. It can be used as component for digital crossover filters,
  926. room equalization, cross talk cancellation, wavefield synthesis,
  927. auralization, ambiophonics, ambisonics and spatialization.
  928. This filter uses the streams higher than first one as FIR coefficients.
  929. If the non-first stream holds a single channel, it will be used
  930. for all input channels in the first stream, otherwise
  931. the number of channels in the non-first stream must be same as
  932. the number of channels in the first stream.
  933. It accepts the following parameters:
  934. @table @option
  935. @item dry
  936. Set dry gain. This sets input gain.
  937. @item wet
  938. Set wet gain. This sets final output gain.
  939. @item length
  940. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  941. @item gtype
  942. Enable applying gain measured from power of IR.
  943. Set which approach to use for auto gain measurement.
  944. @table @option
  945. @item none
  946. Do not apply any gain.
  947. @item peak
  948. select peak gain, very conservative approach. This is default value.
  949. @item dc
  950. select DC gain, limited application.
  951. @item gn
  952. select gain to noise approach, this is most popular one.
  953. @end table
  954. @item irgain
  955. Set gain to be applied to IR coefficients before filtering.
  956. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  957. @item irfmt
  958. Set format of IR stream. Can be @code{mono} or @code{input}.
  959. Default is @code{input}.
  960. @item maxir
  961. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  962. Allowed range is 0.1 to 60 seconds.
  963. @item response
  964. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  965. By default it is disabled.
  966. @item channel
  967. Set for which IR channel to display frequency response. By default is first channel
  968. displayed. This option is used only when @var{response} is enabled.
  969. @item size
  970. Set video stream size. This option is used only when @var{response} is enabled.
  971. @item rate
  972. Set video stream frame rate. This option is used only when @var{response} is enabled.
  973. @item minp
  974. Set minimal partition size used for convolution. Default is @var{8192}.
  975. Allowed range is from @var{1} to @var{32768}.
  976. Lower values decreases latency at cost of higher CPU usage.
  977. @item maxp
  978. Set maximal partition size used for convolution. Default is @var{8192}.
  979. Allowed range is from @var{8} to @var{32768}.
  980. Lower values may increase CPU usage.
  981. @item nbirs
  982. Set number of input impulse responses streams which will be switchable at runtime.
  983. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  984. @item ir
  985. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  986. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  987. This option can be changed at runtime via @ref{commands}.
  988. @end table
  989. @subsection Examples
  990. @itemize
  991. @item
  992. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  993. @example
  994. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  995. @end example
  996. @end itemize
  997. @anchor{aformat}
  998. @section aformat
  999. Set output format constraints for the input audio. The framework will
  1000. negotiate the most appropriate format to minimize conversions.
  1001. It accepts the following parameters:
  1002. @table @option
  1003. @item sample_fmts, f
  1004. A '|'-separated list of requested sample formats.
  1005. @item sample_rates, r
  1006. A '|'-separated list of requested sample rates.
  1007. @item channel_layouts, cl
  1008. A '|'-separated list of requested channel layouts.
  1009. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1010. for the required syntax.
  1011. @end table
  1012. If a parameter is omitted, all values are allowed.
  1013. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1014. @example
  1015. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1016. @end example
  1017. @section agate
  1018. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1019. processing reduces disturbing noise between useful signals.
  1020. Gating is done by detecting the volume below a chosen level @var{threshold}
  1021. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1022. floor is set via @var{range}. Because an exact manipulation of the signal
  1023. would cause distortion of the waveform the reduction can be levelled over
  1024. time. This is done by setting @var{attack} and @var{release}.
  1025. @var{attack} determines how long the signal has to fall below the threshold
  1026. before any reduction will occur and @var{release} sets the time the signal
  1027. has to rise above the threshold to reduce the reduction again.
  1028. Shorter signals than the chosen attack time will be left untouched.
  1029. @table @option
  1030. @item level_in
  1031. Set input level before filtering.
  1032. Default is 1. Allowed range is from 0.015625 to 64.
  1033. @item mode
  1034. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1035. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1036. will be amplified, expanding dynamic range in upward direction.
  1037. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1038. @item range
  1039. Set the level of gain reduction when the signal is below the threshold.
  1040. Default is 0.06125. Allowed range is from 0 to 1.
  1041. Setting this to 0 disables reduction and then filter behaves like expander.
  1042. @item threshold
  1043. If a signal rises above this level the gain reduction is released.
  1044. Default is 0.125. Allowed range is from 0 to 1.
  1045. @item ratio
  1046. Set a ratio by which the signal is reduced.
  1047. Default is 2. Allowed range is from 1 to 9000.
  1048. @item attack
  1049. Amount of milliseconds the signal has to rise above the threshold before gain
  1050. reduction stops.
  1051. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1052. @item release
  1053. Amount of milliseconds the signal has to fall below the threshold before the
  1054. reduction is increased again. Default is 250 milliseconds.
  1055. Allowed range is from 0.01 to 9000.
  1056. @item makeup
  1057. Set amount of amplification of signal after processing.
  1058. Default is 1. Allowed range is from 1 to 64.
  1059. @item knee
  1060. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1061. Default is 2.828427125. Allowed range is from 1 to 8.
  1062. @item detection
  1063. Choose if exact signal should be taken for detection or an RMS like one.
  1064. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1065. @item link
  1066. Choose if the average level between all channels or the louder channel affects
  1067. the reduction.
  1068. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1069. @end table
  1070. @section aiir
  1071. Apply an arbitrary Infinite Impulse Response filter.
  1072. It accepts the following parameters:
  1073. @table @option
  1074. @item z
  1075. Set numerator/zeros coefficients.
  1076. @item p
  1077. Set denominator/poles coefficients.
  1078. @item k
  1079. Set channels gains.
  1080. @item dry_gain
  1081. Set input gain.
  1082. @item wet_gain
  1083. Set output gain.
  1084. @item f
  1085. Set coefficients format.
  1086. @table @samp
  1087. @item tf
  1088. transfer function
  1089. @item zp
  1090. Z-plane zeros/poles, cartesian (default)
  1091. @item pr
  1092. Z-plane zeros/poles, polar radians
  1093. @item pd
  1094. Z-plane zeros/poles, polar degrees
  1095. @end table
  1096. @item r
  1097. Set kind of processing.
  1098. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1099. @item e
  1100. Set filtering precision.
  1101. @table @samp
  1102. @item dbl
  1103. double-precision floating-point (default)
  1104. @item flt
  1105. single-precision floating-point
  1106. @item i32
  1107. 32-bit integers
  1108. @item i16
  1109. 16-bit integers
  1110. @end table
  1111. @item mix
  1112. How much to use filtered signal in output. Default is 1.
  1113. Range is between 0 and 1.
  1114. @item response
  1115. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1116. By default it is disabled.
  1117. @item channel
  1118. Set for which IR channel to display frequency response. By default is first channel
  1119. displayed. This option is used only when @var{response} is enabled.
  1120. @item size
  1121. Set video stream size. This option is used only when @var{response} is enabled.
  1122. @end table
  1123. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1124. order.
  1125. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1126. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1127. imaginary unit.
  1128. Different coefficients and gains can be provided for every channel, in such case
  1129. use '|' to separate coefficients or gains. Last provided coefficients will be
  1130. used for all remaining channels.
  1131. @subsection Examples
  1132. @itemize
  1133. @item
  1134. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1135. @example
  1136. 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
  1137. @end example
  1138. @item
  1139. Same as above but in @code{zp} format:
  1140. @example
  1141. 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
  1142. @end example
  1143. @end itemize
  1144. @section alimiter
  1145. The limiter prevents an input signal from rising over a desired threshold.
  1146. This limiter uses lookahead technology to prevent your signal from distorting.
  1147. It means that there is a small delay after the signal is processed. Keep in mind
  1148. that the delay it produces is the attack time you set.
  1149. The filter accepts the following options:
  1150. @table @option
  1151. @item level_in
  1152. Set input gain. Default is 1.
  1153. @item level_out
  1154. Set output gain. Default is 1.
  1155. @item limit
  1156. Don't let signals above this level pass the limiter. Default is 1.
  1157. @item attack
  1158. The limiter will reach its attenuation level in this amount of time in
  1159. milliseconds. Default is 5 milliseconds.
  1160. @item release
  1161. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1162. Default is 50 milliseconds.
  1163. @item asc
  1164. When gain reduction is always needed ASC takes care of releasing to an
  1165. average reduction level rather than reaching a reduction of 0 in the release
  1166. time.
  1167. @item asc_level
  1168. Select how much the release time is affected by ASC, 0 means nearly no changes
  1169. in release time while 1 produces higher release times.
  1170. @item level
  1171. Auto level output signal. Default is enabled.
  1172. This normalizes audio back to 0dB if enabled.
  1173. @end table
  1174. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1175. with @ref{aresample} before applying this filter.
  1176. @section allpass
  1177. Apply a two-pole all-pass filter with central frequency (in Hz)
  1178. @var{frequency}, and filter-width @var{width}.
  1179. An all-pass filter changes the audio's frequency to phase relationship
  1180. without changing its frequency to amplitude relationship.
  1181. The filter accepts the following options:
  1182. @table @option
  1183. @item frequency, f
  1184. Set frequency in Hz.
  1185. @item width_type, t
  1186. Set method to specify band-width of filter.
  1187. @table @option
  1188. @item h
  1189. Hz
  1190. @item q
  1191. Q-Factor
  1192. @item o
  1193. octave
  1194. @item s
  1195. slope
  1196. @item k
  1197. kHz
  1198. @end table
  1199. @item width, w
  1200. Specify the band-width of a filter in width_type units.
  1201. @item mix, m
  1202. How much to use filtered signal in output. Default is 1.
  1203. Range is between 0 and 1.
  1204. @item channels, c
  1205. Specify which channels to filter, by default all available are filtered.
  1206. @item normalize, n
  1207. Normalize biquad coefficients, by default is disabled.
  1208. Enabling it will normalize magnitude response at DC to 0dB.
  1209. @end table
  1210. @subsection Commands
  1211. This filter supports the following commands:
  1212. @table @option
  1213. @item frequency, f
  1214. Change allpass frequency.
  1215. Syntax for the command is : "@var{frequency}"
  1216. @item width_type, t
  1217. Change allpass width_type.
  1218. Syntax for the command is : "@var{width_type}"
  1219. @item width, w
  1220. Change allpass width.
  1221. Syntax for the command is : "@var{width}"
  1222. @item mix, m
  1223. Change allpass mix.
  1224. Syntax for the command is : "@var{mix}"
  1225. @end table
  1226. @section aloop
  1227. Loop audio samples.
  1228. The filter accepts the following options:
  1229. @table @option
  1230. @item loop
  1231. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1232. Default is 0.
  1233. @item size
  1234. Set maximal number of samples. Default is 0.
  1235. @item start
  1236. Set first sample of loop. Default is 0.
  1237. @end table
  1238. @anchor{amerge}
  1239. @section amerge
  1240. Merge two or more audio streams into a single multi-channel stream.
  1241. The filter accepts the following options:
  1242. @table @option
  1243. @item inputs
  1244. Set the number of inputs. Default is 2.
  1245. @end table
  1246. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1247. the channel layout of the output will be set accordingly and the channels
  1248. will be reordered as necessary. If the channel layouts of the inputs are not
  1249. disjoint, the output will have all the channels of the first input then all
  1250. the channels of the second input, in that order, and the channel layout of
  1251. the output will be the default value corresponding to the total number of
  1252. channels.
  1253. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1254. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1255. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1256. first input, b1 is the first channel of the second input).
  1257. On the other hand, if both input are in stereo, the output channels will be
  1258. in the default order: a1, a2, b1, b2, and the channel layout will be
  1259. arbitrarily set to 4.0, which may or may not be the expected value.
  1260. All inputs must have the same sample rate, and format.
  1261. If inputs do not have the same duration, the output will stop with the
  1262. shortest.
  1263. @subsection Examples
  1264. @itemize
  1265. @item
  1266. Merge two mono files into a stereo stream:
  1267. @example
  1268. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1269. @end example
  1270. @item
  1271. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1272. @example
  1273. 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
  1274. @end example
  1275. @end itemize
  1276. @section amix
  1277. Mixes multiple audio inputs into a single output.
  1278. Note that this filter only supports float samples (the @var{amerge}
  1279. and @var{pan} audio filters support many formats). If the @var{amix}
  1280. input has integer samples then @ref{aresample} will be automatically
  1281. inserted to perform the conversion to float samples.
  1282. For example
  1283. @example
  1284. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1285. @end example
  1286. will mix 3 input audio streams to a single output with the same duration as the
  1287. first input and a dropout transition time of 3 seconds.
  1288. It accepts the following parameters:
  1289. @table @option
  1290. @item inputs
  1291. The number of inputs. If unspecified, it defaults to 2.
  1292. @item duration
  1293. How to determine the end-of-stream.
  1294. @table @option
  1295. @item longest
  1296. The duration of the longest input. (default)
  1297. @item shortest
  1298. The duration of the shortest input.
  1299. @item first
  1300. The duration of the first input.
  1301. @end table
  1302. @item dropout_transition
  1303. The transition time, in seconds, for volume renormalization when an input
  1304. stream ends. The default value is 2 seconds.
  1305. @item weights
  1306. Specify weight of each input audio stream as sequence.
  1307. Each weight is separated by space. By default all inputs have same weight.
  1308. @end table
  1309. @section amultiply
  1310. Multiply first audio stream with second audio stream and store result
  1311. in output audio stream. Multiplication is done by multiplying each
  1312. sample from first stream with sample at same position from second stream.
  1313. With this element-wise multiplication one can create amplitude fades and
  1314. amplitude modulations.
  1315. @section anequalizer
  1316. High-order parametric multiband equalizer for each channel.
  1317. It accepts the following parameters:
  1318. @table @option
  1319. @item params
  1320. This option string is in format:
  1321. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1322. Each equalizer band is separated by '|'.
  1323. @table @option
  1324. @item chn
  1325. Set channel number to which equalization will be applied.
  1326. If input doesn't have that channel the entry is ignored.
  1327. @item f
  1328. Set central frequency for band.
  1329. If input doesn't have that frequency the entry is ignored.
  1330. @item w
  1331. Set band width in hertz.
  1332. @item g
  1333. Set band gain in dB.
  1334. @item t
  1335. Set filter type for band, optional, can be:
  1336. @table @samp
  1337. @item 0
  1338. Butterworth, this is default.
  1339. @item 1
  1340. Chebyshev type 1.
  1341. @item 2
  1342. Chebyshev type 2.
  1343. @end table
  1344. @end table
  1345. @item curves
  1346. With this option activated frequency response of anequalizer is displayed
  1347. in video stream.
  1348. @item size
  1349. Set video stream size. Only useful if curves option is activated.
  1350. @item mgain
  1351. Set max gain that will be displayed. Only useful if curves option is activated.
  1352. Setting this to a reasonable value makes it possible to display gain which is derived from
  1353. neighbour bands which are too close to each other and thus produce higher gain
  1354. when both are activated.
  1355. @item fscale
  1356. Set frequency scale used to draw frequency response in video output.
  1357. Can be linear or logarithmic. Default is logarithmic.
  1358. @item colors
  1359. Set color for each channel curve which is going to be displayed in video stream.
  1360. This is list of color names separated by space or by '|'.
  1361. Unrecognised or missing colors will be replaced by white color.
  1362. @end table
  1363. @subsection Examples
  1364. @itemize
  1365. @item
  1366. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1367. for first 2 channels using Chebyshev type 1 filter:
  1368. @example
  1369. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1370. @end example
  1371. @end itemize
  1372. @subsection Commands
  1373. This filter supports the following commands:
  1374. @table @option
  1375. @item change
  1376. Alter existing filter parameters.
  1377. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1378. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1379. error is returned.
  1380. @var{freq} set new frequency parameter.
  1381. @var{width} set new width parameter in herz.
  1382. @var{gain} set new gain parameter in dB.
  1383. Full filter invocation with asendcmd may look like this:
  1384. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1385. @end table
  1386. @section anlmdn
  1387. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1388. Each sample is adjusted by looking for other samples with similar contexts. This
  1389. context similarity is defined by comparing their surrounding patches of size
  1390. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1391. The filter accepts the following options:
  1392. @table @option
  1393. @item s
  1394. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1395. @item p
  1396. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1397. Default value is 2 milliseconds.
  1398. @item r
  1399. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1400. Default value is 6 milliseconds.
  1401. @item o
  1402. Set the output mode.
  1403. It accepts the following values:
  1404. @table @option
  1405. @item i
  1406. Pass input unchanged.
  1407. @item o
  1408. Pass noise filtered out.
  1409. @item n
  1410. Pass only noise.
  1411. Default value is @var{o}.
  1412. @end table
  1413. @item m
  1414. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1415. @end table
  1416. @subsection Commands
  1417. This filter supports the following commands:
  1418. @table @option
  1419. @item s
  1420. Change denoise strength. Argument is single float number.
  1421. Syntax for the command is : "@var{s}"
  1422. @item o
  1423. Change output mode.
  1424. Syntax for the command is : "i", "o" or "n" string.
  1425. @end table
  1426. @section anlms
  1427. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1428. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1429. relate to producing the least mean square of the error signal (difference between the desired,
  1430. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1431. A description of the accepted options follows.
  1432. @table @option
  1433. @item order
  1434. Set filter order.
  1435. @item mu
  1436. Set filter mu.
  1437. @item eps
  1438. Set the filter eps.
  1439. @item leakage
  1440. Set the filter leakage.
  1441. @item out_mode
  1442. It accepts the following values:
  1443. @table @option
  1444. @item i
  1445. Pass the 1st input.
  1446. @item d
  1447. Pass the 2nd input.
  1448. @item o
  1449. Pass filtered samples.
  1450. @item n
  1451. Pass difference between desired and filtered samples.
  1452. Default value is @var{o}.
  1453. @end table
  1454. @end table
  1455. @subsection Examples
  1456. @itemize
  1457. @item
  1458. One of many usages of this filter is noise reduction, input audio is filtered
  1459. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1460. @example
  1461. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1462. @end example
  1463. @end itemize
  1464. @subsection Commands
  1465. This filter supports the same commands as options, excluding option @code{order}.
  1466. @section anull
  1467. Pass the audio source unchanged to the output.
  1468. @section apad
  1469. Pad the end of an audio stream with silence.
  1470. This can be used together with @command{ffmpeg} @option{-shortest} to
  1471. extend audio streams to the same length as the video stream.
  1472. A description of the accepted options follows.
  1473. @table @option
  1474. @item packet_size
  1475. Set silence packet size. Default value is 4096.
  1476. @item pad_len
  1477. Set the number of samples of silence to add to the end. After the
  1478. value is reached, the stream is terminated. This option is mutually
  1479. exclusive with @option{whole_len}.
  1480. @item whole_len
  1481. Set the minimum total number of samples in the output audio stream. If
  1482. the value is longer than the input audio length, silence is added to
  1483. the end, until the value is reached. This option is mutually exclusive
  1484. with @option{pad_len}.
  1485. @item pad_dur
  1486. Specify the duration of samples of silence to add. See
  1487. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1488. for the accepted syntax. Used only if set to non-zero value.
  1489. @item whole_dur
  1490. Specify the minimum total duration in the output audio stream. See
  1491. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1492. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1493. the input audio length, silence is added to the end, until the value is reached.
  1494. This option is mutually exclusive with @option{pad_dur}
  1495. @end table
  1496. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1497. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1498. the input stream indefinitely.
  1499. @subsection Examples
  1500. @itemize
  1501. @item
  1502. Add 1024 samples of silence to the end of the input:
  1503. @example
  1504. apad=pad_len=1024
  1505. @end example
  1506. @item
  1507. Make sure the audio output will contain at least 10000 samples, pad
  1508. the input with silence if required:
  1509. @example
  1510. apad=whole_len=10000
  1511. @end example
  1512. @item
  1513. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1514. video stream will always result the shortest and will be converted
  1515. until the end in the output file when using the @option{shortest}
  1516. option:
  1517. @example
  1518. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1519. @end example
  1520. @end itemize
  1521. @section aphaser
  1522. Add a phasing effect to the input audio.
  1523. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1524. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1525. A description of the accepted parameters follows.
  1526. @table @option
  1527. @item in_gain
  1528. Set input gain. Default is 0.4.
  1529. @item out_gain
  1530. Set output gain. Default is 0.74
  1531. @item delay
  1532. Set delay in milliseconds. Default is 3.0.
  1533. @item decay
  1534. Set decay. Default is 0.4.
  1535. @item speed
  1536. Set modulation speed in Hz. Default is 0.5.
  1537. @item type
  1538. Set modulation type. Default is triangular.
  1539. It accepts the following values:
  1540. @table @samp
  1541. @item triangular, t
  1542. @item sinusoidal, s
  1543. @end table
  1544. @end table
  1545. @section apulsator
  1546. Audio pulsator is something between an autopanner and a tremolo.
  1547. But it can produce funny stereo effects as well. Pulsator changes the volume
  1548. of the left and right channel based on a LFO (low frequency oscillator) with
  1549. different waveforms and shifted phases.
  1550. This filter have the ability to define an offset between left and right
  1551. channel. An offset of 0 means that both LFO shapes match each other.
  1552. The left and right channel are altered equally - a conventional tremolo.
  1553. An offset of 50% means that the shape of the right channel is exactly shifted
  1554. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1555. an autopanner. At 1 both curves match again. Every setting in between moves the
  1556. phase shift gapless between all stages and produces some "bypassing" sounds with
  1557. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1558. the 0.5) the faster the signal passes from the left to the right speaker.
  1559. The filter accepts the following options:
  1560. @table @option
  1561. @item level_in
  1562. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1563. @item level_out
  1564. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1565. @item mode
  1566. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1567. sawup or sawdown. Default is sine.
  1568. @item amount
  1569. Set modulation. Define how much of original signal is affected by the LFO.
  1570. @item offset_l
  1571. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1572. @item offset_r
  1573. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1574. @item width
  1575. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1576. @item timing
  1577. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1578. @item bpm
  1579. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1580. is set to bpm.
  1581. @item ms
  1582. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1583. is set to ms.
  1584. @item hz
  1585. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1586. if timing is set to hz.
  1587. @end table
  1588. @anchor{aresample}
  1589. @section aresample
  1590. Resample the input audio to the specified parameters, using the
  1591. libswresample library. If none are specified then the filter will
  1592. automatically convert between its input and output.
  1593. This filter is also able to stretch/squeeze the audio data to make it match
  1594. the timestamps or to inject silence / cut out audio to make it match the
  1595. timestamps, do a combination of both or do neither.
  1596. The filter accepts the syntax
  1597. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1598. expresses a sample rate and @var{resampler_options} is a list of
  1599. @var{key}=@var{value} pairs, separated by ":". See the
  1600. @ref{Resampler Options,,"Resampler Options" section in the
  1601. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1602. for the complete list of supported options.
  1603. @subsection Examples
  1604. @itemize
  1605. @item
  1606. Resample the input audio to 44100Hz:
  1607. @example
  1608. aresample=44100
  1609. @end example
  1610. @item
  1611. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1612. samples per second compensation:
  1613. @example
  1614. aresample=async=1000
  1615. @end example
  1616. @end itemize
  1617. @section areverse
  1618. Reverse an audio clip.
  1619. Warning: This filter requires memory to buffer the entire clip, so trimming
  1620. is suggested.
  1621. @subsection Examples
  1622. @itemize
  1623. @item
  1624. Take the first 5 seconds of a clip, and reverse it.
  1625. @example
  1626. atrim=end=5,areverse
  1627. @end example
  1628. @end itemize
  1629. @section arnndn
  1630. Reduce noise from speech using Recurrent Neural Networks.
  1631. This filter accepts the following options:
  1632. @table @option
  1633. @item model, m
  1634. Set train model file to load. This option is always required.
  1635. @end table
  1636. @section asetnsamples
  1637. Set the number of samples per each output audio frame.
  1638. The last output packet may contain a different number of samples, as
  1639. the filter will flush all the remaining samples when the input audio
  1640. signals its end.
  1641. The filter accepts the following options:
  1642. @table @option
  1643. @item nb_out_samples, n
  1644. Set the number of frames per each output audio frame. The number is
  1645. intended as the number of samples @emph{per each channel}.
  1646. Default value is 1024.
  1647. @item pad, p
  1648. If set to 1, the filter will pad the last audio frame with zeroes, so
  1649. that the last frame will contain the same number of samples as the
  1650. previous ones. Default value is 1.
  1651. @end table
  1652. For example, to set the number of per-frame samples to 1234 and
  1653. disable padding for the last frame, use:
  1654. @example
  1655. asetnsamples=n=1234:p=0
  1656. @end example
  1657. @section asetrate
  1658. Set the sample rate without altering the PCM data.
  1659. This will result in a change of speed and pitch.
  1660. The filter accepts the following options:
  1661. @table @option
  1662. @item sample_rate, r
  1663. Set the output sample rate. Default is 44100 Hz.
  1664. @end table
  1665. @section ashowinfo
  1666. Show a line containing various information for each input audio frame.
  1667. The input audio is not modified.
  1668. The shown line contains a sequence of key/value pairs of the form
  1669. @var{key}:@var{value}.
  1670. The following values are shown in the output:
  1671. @table @option
  1672. @item n
  1673. The (sequential) number of the input frame, starting from 0.
  1674. @item pts
  1675. The presentation timestamp of the input frame, in time base units; the time base
  1676. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1677. @item pts_time
  1678. The presentation timestamp of the input frame in seconds.
  1679. @item pos
  1680. position of the frame in the input stream, -1 if this information in
  1681. unavailable and/or meaningless (for example in case of synthetic audio)
  1682. @item fmt
  1683. The sample format.
  1684. @item chlayout
  1685. The channel layout.
  1686. @item rate
  1687. The sample rate for the audio frame.
  1688. @item nb_samples
  1689. The number of samples (per channel) in the frame.
  1690. @item checksum
  1691. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1692. audio, the data is treated as if all the planes were concatenated.
  1693. @item plane_checksums
  1694. A list of Adler-32 checksums for each data plane.
  1695. @end table
  1696. @section asoftclip
  1697. Apply audio soft clipping.
  1698. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1699. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1700. This filter accepts the following options:
  1701. @table @option
  1702. @item type
  1703. Set type of soft-clipping.
  1704. It accepts the following values:
  1705. @table @option
  1706. @item tanh
  1707. @item atan
  1708. @item cubic
  1709. @item exp
  1710. @item alg
  1711. @item quintic
  1712. @item sin
  1713. @end table
  1714. @item param
  1715. Set additional parameter which controls sigmoid function.
  1716. @end table
  1717. @section asr
  1718. Automatic Speech Recognition
  1719. This filter uses PocketSphinx for speech recognition. To enable
  1720. compilation of this filter, you need to configure FFmpeg with
  1721. @code{--enable-pocketsphinx}.
  1722. It accepts the following options:
  1723. @table @option
  1724. @item rate
  1725. Set sampling rate of input audio. Defaults is @code{16000}.
  1726. This need to match speech models, otherwise one will get poor results.
  1727. @item hmm
  1728. Set dictionary containing acoustic model files.
  1729. @item dict
  1730. Set pronunciation dictionary.
  1731. @item lm
  1732. Set language model file.
  1733. @item lmctl
  1734. Set language model set.
  1735. @item lmname
  1736. Set which language model to use.
  1737. @item logfn
  1738. Set output for log messages.
  1739. @end table
  1740. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1741. @anchor{astats}
  1742. @section astats
  1743. Display time domain statistical information about the audio channels.
  1744. Statistics are calculated and displayed for each audio channel and,
  1745. where applicable, an overall figure is also given.
  1746. It accepts the following option:
  1747. @table @option
  1748. @item length
  1749. Short window length in seconds, used for peak and trough RMS measurement.
  1750. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1751. @item metadata
  1752. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1753. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1754. disabled.
  1755. Available keys for each channel are:
  1756. DC_offset
  1757. Min_level
  1758. Max_level
  1759. Min_difference
  1760. Max_difference
  1761. Mean_difference
  1762. RMS_difference
  1763. Peak_level
  1764. RMS_peak
  1765. RMS_trough
  1766. Crest_factor
  1767. Flat_factor
  1768. Peak_count
  1769. Bit_depth
  1770. Dynamic_range
  1771. Zero_crossings
  1772. Zero_crossings_rate
  1773. Number_of_NaNs
  1774. Number_of_Infs
  1775. Number_of_denormals
  1776. and for Overall:
  1777. DC_offset
  1778. Min_level
  1779. Max_level
  1780. Min_difference
  1781. Max_difference
  1782. Mean_difference
  1783. RMS_difference
  1784. Peak_level
  1785. RMS_level
  1786. RMS_peak
  1787. RMS_trough
  1788. Flat_factor
  1789. Peak_count
  1790. Bit_depth
  1791. Number_of_samples
  1792. Number_of_NaNs
  1793. Number_of_Infs
  1794. Number_of_denormals
  1795. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1796. this @code{lavfi.astats.Overall.Peak_count}.
  1797. For description what each key means read below.
  1798. @item reset
  1799. Set number of frame after which stats are going to be recalculated.
  1800. Default is disabled.
  1801. @item measure_perchannel
  1802. Select the entries which need to be measured per channel. The metadata keys can
  1803. be used as flags, default is @option{all} which measures everything.
  1804. @option{none} disables all per channel measurement.
  1805. @item measure_overall
  1806. Select the entries which need to be measured overall. The metadata keys can
  1807. be used as flags, default is @option{all} which measures everything.
  1808. @option{none} disables all overall measurement.
  1809. @end table
  1810. A description of each shown parameter follows:
  1811. @table @option
  1812. @item DC offset
  1813. Mean amplitude displacement from zero.
  1814. @item Min level
  1815. Minimal sample level.
  1816. @item Max level
  1817. Maximal sample level.
  1818. @item Min difference
  1819. Minimal difference between two consecutive samples.
  1820. @item Max difference
  1821. Maximal difference between two consecutive samples.
  1822. @item Mean difference
  1823. Mean difference between two consecutive samples.
  1824. The average of each difference between two consecutive samples.
  1825. @item RMS difference
  1826. Root Mean Square difference between two consecutive samples.
  1827. @item Peak level dB
  1828. @item RMS level dB
  1829. Standard peak and RMS level measured in dBFS.
  1830. @item RMS peak dB
  1831. @item RMS trough dB
  1832. Peak and trough values for RMS level measured over a short window.
  1833. @item Crest factor
  1834. Standard ratio of peak to RMS level (note: not in dB).
  1835. @item Flat factor
  1836. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1837. (i.e. either @var{Min level} or @var{Max level}).
  1838. @item Peak count
  1839. Number of occasions (not the number of samples) that the signal attained either
  1840. @var{Min level} or @var{Max level}.
  1841. @item Bit depth
  1842. Overall bit depth of audio. Number of bits used for each sample.
  1843. @item Dynamic range
  1844. Measured dynamic range of audio in dB.
  1845. @item Zero crossings
  1846. Number of points where the waveform crosses the zero level axis.
  1847. @item Zero crossings rate
  1848. Rate of Zero crossings and number of audio samples.
  1849. @end table
  1850. @section atempo
  1851. Adjust audio tempo.
  1852. The filter accepts exactly one parameter, the audio tempo. If not
  1853. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1854. be in the [0.5, 100.0] range.
  1855. Note that tempo greater than 2 will skip some samples rather than
  1856. blend them in. If for any reason this is a concern it is always
  1857. possible to daisy-chain several instances of atempo to achieve the
  1858. desired product tempo.
  1859. @subsection Examples
  1860. @itemize
  1861. @item
  1862. Slow down audio to 80% tempo:
  1863. @example
  1864. atempo=0.8
  1865. @end example
  1866. @item
  1867. To speed up audio to 300% tempo:
  1868. @example
  1869. atempo=3
  1870. @end example
  1871. @item
  1872. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1873. @example
  1874. atempo=sqrt(3),atempo=sqrt(3)
  1875. @end example
  1876. @end itemize
  1877. @subsection Commands
  1878. This filter supports the following commands:
  1879. @table @option
  1880. @item tempo
  1881. Change filter tempo scale factor.
  1882. Syntax for the command is : "@var{tempo}"
  1883. @end table
  1884. @section atrim
  1885. Trim the input so that the output contains one continuous subpart of the input.
  1886. It accepts the following parameters:
  1887. @table @option
  1888. @item start
  1889. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1890. sample with the timestamp @var{start} will be the first sample in the output.
  1891. @item end
  1892. Specify time of the first audio sample that will be dropped, i.e. the
  1893. audio sample immediately preceding the one with the timestamp @var{end} will be
  1894. the last sample in the output.
  1895. @item start_pts
  1896. Same as @var{start}, except this option sets the start timestamp in samples
  1897. instead of seconds.
  1898. @item end_pts
  1899. Same as @var{end}, except this option sets the end timestamp in samples instead
  1900. of seconds.
  1901. @item duration
  1902. The maximum duration of the output in seconds.
  1903. @item start_sample
  1904. The number of the first sample that should be output.
  1905. @item end_sample
  1906. The number of the first sample that should be dropped.
  1907. @end table
  1908. @option{start}, @option{end}, and @option{duration} are expressed as time
  1909. duration specifications; see
  1910. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1911. Note that the first two sets of the start/end options and the @option{duration}
  1912. option look at the frame timestamp, while the _sample options simply count the
  1913. samples that pass through the filter. So start/end_pts and start/end_sample will
  1914. give different results when the timestamps are wrong, inexact or do not start at
  1915. zero. Also note that this filter does not modify the timestamps. If you wish
  1916. to have the output timestamps start at zero, insert the asetpts filter after the
  1917. atrim filter.
  1918. If multiple start or end options are set, this filter tries to be greedy and
  1919. keep all samples that match at least one of the specified constraints. To keep
  1920. only the part that matches all the constraints at once, chain multiple atrim
  1921. filters.
  1922. The defaults are such that all the input is kept. So it is possible to set e.g.
  1923. just the end values to keep everything before the specified time.
  1924. Examples:
  1925. @itemize
  1926. @item
  1927. Drop everything except the second minute of input:
  1928. @example
  1929. ffmpeg -i INPUT -af atrim=60:120
  1930. @end example
  1931. @item
  1932. Keep only the first 1000 samples:
  1933. @example
  1934. ffmpeg -i INPUT -af atrim=end_sample=1000
  1935. @end example
  1936. @end itemize
  1937. @section axcorrelate
  1938. Calculate normalized cross-correlation between two input audio streams.
  1939. Resulted samples are always between -1 and 1 inclusive.
  1940. If result is 1 it means two input samples are highly correlated in that selected segment.
  1941. Result 0 means they are not correlated at all.
  1942. If result is -1 it means two input samples are out of phase, which means they cancel each
  1943. other.
  1944. The filter accepts the following options:
  1945. @table @option
  1946. @item size
  1947. Set size of segment over which cross-correlation is calculated.
  1948. Default is 256. Allowed range is from 2 to 131072.
  1949. @item algo
  1950. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  1951. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  1952. are always zero and thus need much less calculations to make.
  1953. This is generally not true, but is valid for typical audio streams.
  1954. @end table
  1955. @subsection Examples
  1956. @itemize
  1957. @item
  1958. Calculate correlation between channels in stereo audio stream:
  1959. @example
  1960. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  1961. @end example
  1962. @end itemize
  1963. @section bandpass
  1964. Apply a two-pole Butterworth band-pass filter with central
  1965. frequency @var{frequency}, and (3dB-point) band-width width.
  1966. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1967. instead of the default: constant 0dB peak gain.
  1968. The filter roll off at 6dB per octave (20dB per decade).
  1969. The filter accepts the following options:
  1970. @table @option
  1971. @item frequency, f
  1972. Set the filter's central frequency. Default is @code{3000}.
  1973. @item csg
  1974. Constant skirt gain if set to 1. Defaults to 0.
  1975. @item width_type, t
  1976. Set method to specify band-width of filter.
  1977. @table @option
  1978. @item h
  1979. Hz
  1980. @item q
  1981. Q-Factor
  1982. @item o
  1983. octave
  1984. @item s
  1985. slope
  1986. @item k
  1987. kHz
  1988. @end table
  1989. @item width, w
  1990. Specify the band-width of a filter in width_type units.
  1991. @item mix, m
  1992. How much to use filtered signal in output. Default is 1.
  1993. Range is between 0 and 1.
  1994. @item channels, c
  1995. Specify which channels to filter, by default all available are filtered.
  1996. @item normalize, n
  1997. Normalize biquad coefficients, by default is disabled.
  1998. Enabling it will normalize magnitude response at DC to 0dB.
  1999. @end table
  2000. @subsection Commands
  2001. This filter supports the following commands:
  2002. @table @option
  2003. @item frequency, f
  2004. Change bandpass frequency.
  2005. Syntax for the command is : "@var{frequency}"
  2006. @item width_type, t
  2007. Change bandpass width_type.
  2008. Syntax for the command is : "@var{width_type}"
  2009. @item width, w
  2010. Change bandpass width.
  2011. Syntax for the command is : "@var{width}"
  2012. @item mix, m
  2013. Change bandpass mix.
  2014. Syntax for the command is : "@var{mix}"
  2015. @end table
  2016. @section bandreject
  2017. Apply a two-pole Butterworth band-reject filter with central
  2018. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2019. The filter roll off at 6dB per octave (20dB per decade).
  2020. The filter accepts the following options:
  2021. @table @option
  2022. @item frequency, f
  2023. Set the filter's central frequency. Default is @code{3000}.
  2024. @item width_type, t
  2025. Set method to specify band-width of filter.
  2026. @table @option
  2027. @item h
  2028. Hz
  2029. @item q
  2030. Q-Factor
  2031. @item o
  2032. octave
  2033. @item s
  2034. slope
  2035. @item k
  2036. kHz
  2037. @end table
  2038. @item width, w
  2039. Specify the band-width of a filter in width_type units.
  2040. @item mix, m
  2041. How much to use filtered signal in output. Default is 1.
  2042. Range is between 0 and 1.
  2043. @item channels, c
  2044. Specify which channels to filter, by default all available are filtered.
  2045. @item normalize, n
  2046. Normalize biquad coefficients, by default is disabled.
  2047. Enabling it will normalize magnitude response at DC to 0dB.
  2048. @end table
  2049. @subsection Commands
  2050. This filter supports the following commands:
  2051. @table @option
  2052. @item frequency, f
  2053. Change bandreject frequency.
  2054. Syntax for the command is : "@var{frequency}"
  2055. @item width_type, t
  2056. Change bandreject width_type.
  2057. Syntax for the command is : "@var{width_type}"
  2058. @item width, w
  2059. Change bandreject width.
  2060. Syntax for the command is : "@var{width}"
  2061. @item mix, m
  2062. Change bandreject mix.
  2063. Syntax for the command is : "@var{mix}"
  2064. @end table
  2065. @section bass, lowshelf
  2066. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2067. shelving filter with a response similar to that of a standard
  2068. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2069. The filter accepts the following options:
  2070. @table @option
  2071. @item gain, g
  2072. Give the gain at 0 Hz. Its useful range is about -20
  2073. (for a large cut) to +20 (for a large boost).
  2074. Beware of clipping when using a positive gain.
  2075. @item frequency, f
  2076. Set the filter's central frequency and so can be used
  2077. to extend or reduce the frequency range to be boosted or cut.
  2078. The default value is @code{100} Hz.
  2079. @item width_type, t
  2080. Set method to specify band-width of filter.
  2081. @table @option
  2082. @item h
  2083. Hz
  2084. @item q
  2085. Q-Factor
  2086. @item o
  2087. octave
  2088. @item s
  2089. slope
  2090. @item k
  2091. kHz
  2092. @end table
  2093. @item width, w
  2094. Determine how steep is the filter's shelf transition.
  2095. @item mix, m
  2096. How much to use filtered signal in output. Default is 1.
  2097. Range is between 0 and 1.
  2098. @item channels, c
  2099. Specify which channels to filter, by default all available are filtered.
  2100. @item normalize, n
  2101. Normalize biquad coefficients, by default is disabled.
  2102. Enabling it will normalize magnitude response at DC to 0dB.
  2103. @end table
  2104. @subsection Commands
  2105. This filter supports the following commands:
  2106. @table @option
  2107. @item frequency, f
  2108. Change bass frequency.
  2109. Syntax for the command is : "@var{frequency}"
  2110. @item width_type, t
  2111. Change bass width_type.
  2112. Syntax for the command is : "@var{width_type}"
  2113. @item width, w
  2114. Change bass width.
  2115. Syntax for the command is : "@var{width}"
  2116. @item gain, g
  2117. Change bass gain.
  2118. Syntax for the command is : "@var{gain}"
  2119. @item mix, m
  2120. Change bass mix.
  2121. Syntax for the command is : "@var{mix}"
  2122. @end table
  2123. @section biquad
  2124. Apply a biquad IIR filter with the given coefficients.
  2125. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2126. are the numerator and denominator coefficients respectively.
  2127. and @var{channels}, @var{c} specify which channels to filter, by default all
  2128. available are filtered.
  2129. @subsection Commands
  2130. This filter supports the following commands:
  2131. @table @option
  2132. @item a0
  2133. @item a1
  2134. @item a2
  2135. @item b0
  2136. @item b1
  2137. @item b2
  2138. Change biquad parameter.
  2139. Syntax for the command is : "@var{value}"
  2140. @item mix, m
  2141. How much to use filtered signal in output. Default is 1.
  2142. Range is between 0 and 1.
  2143. @item channels, c
  2144. Specify which channels to filter, by default all available are filtered.
  2145. @item normalize, n
  2146. Normalize biquad coefficients, by default is disabled.
  2147. Enabling it will normalize magnitude response at DC to 0dB.
  2148. @end table
  2149. @section bs2b
  2150. Bauer stereo to binaural transformation, which improves headphone listening of
  2151. stereo audio records.
  2152. To enable compilation of this filter you need to configure FFmpeg with
  2153. @code{--enable-libbs2b}.
  2154. It accepts the following parameters:
  2155. @table @option
  2156. @item profile
  2157. Pre-defined crossfeed level.
  2158. @table @option
  2159. @item default
  2160. Default level (fcut=700, feed=50).
  2161. @item cmoy
  2162. Chu Moy circuit (fcut=700, feed=60).
  2163. @item jmeier
  2164. Jan Meier circuit (fcut=650, feed=95).
  2165. @end table
  2166. @item fcut
  2167. Cut frequency (in Hz).
  2168. @item feed
  2169. Feed level (in Hz).
  2170. @end table
  2171. @section channelmap
  2172. Remap input channels to new locations.
  2173. It accepts the following parameters:
  2174. @table @option
  2175. @item map
  2176. Map channels from input to output. The argument is a '|'-separated list of
  2177. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2178. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2179. channel (e.g. FL for front left) or its index in the input channel layout.
  2180. @var{out_channel} is the name of the output channel or its index in the output
  2181. channel layout. If @var{out_channel} is not given then it is implicitly an
  2182. index, starting with zero and increasing by one for each mapping.
  2183. @item channel_layout
  2184. The channel layout of the output stream.
  2185. @end table
  2186. If no mapping is present, the filter will implicitly map input channels to
  2187. output channels, preserving indices.
  2188. @subsection Examples
  2189. @itemize
  2190. @item
  2191. For example, assuming a 5.1+downmix input MOV file,
  2192. @example
  2193. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2194. @end example
  2195. will create an output WAV file tagged as stereo from the downmix channels of
  2196. the input.
  2197. @item
  2198. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2199. @example
  2200. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2201. @end example
  2202. @end itemize
  2203. @section channelsplit
  2204. Split each channel from an input audio stream into a separate output stream.
  2205. It accepts the following parameters:
  2206. @table @option
  2207. @item channel_layout
  2208. The channel layout of the input stream. The default is "stereo".
  2209. @item channels
  2210. A channel layout describing the channels to be extracted as separate output streams
  2211. or "all" to extract each input channel as a separate stream. The default is "all".
  2212. Choosing channels not present in channel layout in the input will result in an error.
  2213. @end table
  2214. @subsection Examples
  2215. @itemize
  2216. @item
  2217. For example, assuming a stereo input MP3 file,
  2218. @example
  2219. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2220. @end example
  2221. will create an output Matroska file with two audio streams, one containing only
  2222. the left channel and the other the right channel.
  2223. @item
  2224. Split a 5.1 WAV file into per-channel files:
  2225. @example
  2226. ffmpeg -i in.wav -filter_complex
  2227. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2228. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2229. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2230. side_right.wav
  2231. @end example
  2232. @item
  2233. Extract only LFE from a 5.1 WAV file:
  2234. @example
  2235. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2236. -map '[LFE]' lfe.wav
  2237. @end example
  2238. @end itemize
  2239. @section chorus
  2240. Add a chorus effect to the audio.
  2241. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2242. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2243. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2244. The modulation depth defines the range the modulated delay is played before or after
  2245. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2246. sound tuned around the original one, like in a chorus where some vocals are slightly
  2247. off key.
  2248. It accepts the following parameters:
  2249. @table @option
  2250. @item in_gain
  2251. Set input gain. Default is 0.4.
  2252. @item out_gain
  2253. Set output gain. Default is 0.4.
  2254. @item delays
  2255. Set delays. A typical delay is around 40ms to 60ms.
  2256. @item decays
  2257. Set decays.
  2258. @item speeds
  2259. Set speeds.
  2260. @item depths
  2261. Set depths.
  2262. @end table
  2263. @subsection Examples
  2264. @itemize
  2265. @item
  2266. A single delay:
  2267. @example
  2268. chorus=0.7:0.9:55:0.4:0.25:2
  2269. @end example
  2270. @item
  2271. Two delays:
  2272. @example
  2273. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2274. @end example
  2275. @item
  2276. Fuller sounding chorus with three delays:
  2277. @example
  2278. 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
  2279. @end example
  2280. @end itemize
  2281. @section compand
  2282. Compress or expand the audio's dynamic range.
  2283. It accepts the following parameters:
  2284. @table @option
  2285. @item attacks
  2286. @item decays
  2287. A list of times in seconds for each channel over which the instantaneous level
  2288. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2289. increase of volume and @var{decays} refers to decrease of volume. For most
  2290. situations, the attack time (response to the audio getting louder) should be
  2291. shorter than the decay time, because the human ear is more sensitive to sudden
  2292. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2293. a typical value for decay is 0.8 seconds.
  2294. If specified number of attacks & decays is lower than number of channels, the last
  2295. set attack/decay will be used for all remaining channels.
  2296. @item points
  2297. A list of points for the transfer function, specified in dB relative to the
  2298. maximum possible signal amplitude. Each key points list must be defined using
  2299. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2300. @code{x0/y0 x1/y1 x2/y2 ....}
  2301. The input values must be in strictly increasing order but the transfer function
  2302. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2303. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2304. function are @code{-70/-70|-60/-20|1/0}.
  2305. @item soft-knee
  2306. Set the curve radius in dB for all joints. It defaults to 0.01.
  2307. @item gain
  2308. Set the additional gain in dB to be applied at all points on the transfer
  2309. function. This allows for easy adjustment of the overall gain.
  2310. It defaults to 0.
  2311. @item volume
  2312. Set an initial volume, in dB, to be assumed for each channel when filtering
  2313. starts. This permits the user to supply a nominal level initially, so that, for
  2314. example, a very large gain is not applied to initial signal levels before the
  2315. companding has begun to operate. A typical value for audio which is initially
  2316. quiet is -90 dB. It defaults to 0.
  2317. @item delay
  2318. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2319. delayed before being fed to the volume adjuster. Specifying a delay
  2320. approximately equal to the attack/decay times allows the filter to effectively
  2321. operate in predictive rather than reactive mode. It defaults to 0.
  2322. @end table
  2323. @subsection Examples
  2324. @itemize
  2325. @item
  2326. Make music with both quiet and loud passages suitable for listening to in a
  2327. noisy environment:
  2328. @example
  2329. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2330. @end example
  2331. Another example for audio with whisper and explosion parts:
  2332. @example
  2333. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2334. @end example
  2335. @item
  2336. A noise gate for when the noise is at a lower level than the signal:
  2337. @example
  2338. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2339. @end example
  2340. @item
  2341. Here is another noise gate, this time for when the noise is at a higher level
  2342. than the signal (making it, in some ways, similar to squelch):
  2343. @example
  2344. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2345. @end example
  2346. @item
  2347. 2:1 compression starting at -6dB:
  2348. @example
  2349. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2350. @end example
  2351. @item
  2352. 2:1 compression starting at -9dB:
  2353. @example
  2354. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2355. @end example
  2356. @item
  2357. 2:1 compression starting at -12dB:
  2358. @example
  2359. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2360. @end example
  2361. @item
  2362. 2:1 compression starting at -18dB:
  2363. @example
  2364. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2365. @end example
  2366. @item
  2367. 3:1 compression starting at -15dB:
  2368. @example
  2369. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2370. @end example
  2371. @item
  2372. Compressor/Gate:
  2373. @example
  2374. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2375. @end example
  2376. @item
  2377. Expander:
  2378. @example
  2379. 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
  2380. @end example
  2381. @item
  2382. Hard limiter at -6dB:
  2383. @example
  2384. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2385. @end example
  2386. @item
  2387. Hard limiter at -12dB:
  2388. @example
  2389. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2390. @end example
  2391. @item
  2392. Hard noise gate at -35 dB:
  2393. @example
  2394. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2395. @end example
  2396. @item
  2397. Soft limiter:
  2398. @example
  2399. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2400. @end example
  2401. @end itemize
  2402. @section compensationdelay
  2403. Compensation Delay Line is a metric based delay to compensate differing
  2404. positions of microphones or speakers.
  2405. For example, you have recorded guitar with two microphones placed in
  2406. different locations. Because the front of sound wave has fixed speed in
  2407. normal conditions, the phasing of microphones can vary and depends on
  2408. their location and interposition. The best sound mix can be achieved when
  2409. these microphones are in phase (synchronized). Note that a distance of
  2410. ~30 cm between microphones makes one microphone capture the signal in
  2411. antiphase to the other microphone. That makes the final mix sound moody.
  2412. This filter helps to solve phasing problems by adding different delays
  2413. to each microphone track and make them synchronized.
  2414. The best result can be reached when you take one track as base and
  2415. synchronize other tracks one by one with it.
  2416. Remember that synchronization/delay tolerance depends on sample rate, too.
  2417. Higher sample rates will give more tolerance.
  2418. The filter accepts the following parameters:
  2419. @table @option
  2420. @item mm
  2421. Set millimeters distance. This is compensation distance for fine tuning.
  2422. Default is 0.
  2423. @item cm
  2424. Set cm distance. This is compensation distance for tightening distance setup.
  2425. Default is 0.
  2426. @item m
  2427. Set meters distance. This is compensation distance for hard distance setup.
  2428. Default is 0.
  2429. @item dry
  2430. Set dry amount. Amount of unprocessed (dry) signal.
  2431. Default is 0.
  2432. @item wet
  2433. Set wet amount. Amount of processed (wet) signal.
  2434. Default is 1.
  2435. @item temp
  2436. Set temperature in degrees Celsius. This is the temperature of the environment.
  2437. Default is 20.
  2438. @end table
  2439. @section crossfeed
  2440. Apply headphone crossfeed filter.
  2441. Crossfeed is the process of blending the left and right channels of stereo
  2442. audio recording.
  2443. It is mainly used to reduce extreme stereo separation of low frequencies.
  2444. The intent is to produce more speaker like sound to the listener.
  2445. The filter accepts the following options:
  2446. @table @option
  2447. @item strength
  2448. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2449. This sets gain of low shelf filter for side part of stereo image.
  2450. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2451. @item range
  2452. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2453. This sets cut off frequency of low shelf filter. Default is cut off near
  2454. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2455. @item level_in
  2456. Set input gain. Default is 0.9.
  2457. @item level_out
  2458. Set output gain. Default is 1.
  2459. @end table
  2460. @section crystalizer
  2461. Simple algorithm to expand audio dynamic range.
  2462. The filter accepts the following options:
  2463. @table @option
  2464. @item i
  2465. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2466. (unchanged sound) to 10.0 (maximum effect).
  2467. @item c
  2468. Enable clipping. By default is enabled.
  2469. @end table
  2470. @subsection Commands
  2471. This filter supports the all above options as @ref{commands}.
  2472. @section dcshift
  2473. Apply a DC shift to the audio.
  2474. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2475. in the recording chain) from the audio. The effect of a DC offset is reduced
  2476. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2477. a signal has a DC offset.
  2478. @table @option
  2479. @item shift
  2480. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2481. the audio.
  2482. @item limitergain
  2483. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2484. used to prevent clipping.
  2485. @end table
  2486. @section deesser
  2487. Apply de-essing to the audio samples.
  2488. @table @option
  2489. @item i
  2490. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2491. Default is 0.
  2492. @item m
  2493. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2494. Default is 0.5.
  2495. @item f
  2496. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2497. Default is 0.5.
  2498. @item s
  2499. Set the output mode.
  2500. It accepts the following values:
  2501. @table @option
  2502. @item i
  2503. Pass input unchanged.
  2504. @item o
  2505. Pass ess filtered out.
  2506. @item e
  2507. Pass only ess.
  2508. Default value is @var{o}.
  2509. @end table
  2510. @end table
  2511. @section drmeter
  2512. Measure audio dynamic range.
  2513. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2514. is found in transition material. And anything less that 8 have very poor dynamics
  2515. and is very compressed.
  2516. The filter accepts the following options:
  2517. @table @option
  2518. @item length
  2519. Set window length in seconds used to split audio into segments of equal length.
  2520. Default is 3 seconds.
  2521. @end table
  2522. @section dynaudnorm
  2523. Dynamic Audio Normalizer.
  2524. This filter applies a certain amount of gain to the input audio in order
  2525. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2526. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2527. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2528. This allows for applying extra gain to the "quiet" sections of the audio
  2529. while avoiding distortions or clipping the "loud" sections. In other words:
  2530. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2531. sections, in the sense that the volume of each section is brought to the
  2532. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2533. this goal *without* applying "dynamic range compressing". It will retain 100%
  2534. of the dynamic range *within* each section of the audio file.
  2535. @table @option
  2536. @item framelen, f
  2537. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2538. Default is 500 milliseconds.
  2539. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2540. referred to as frames. This is required, because a peak magnitude has no
  2541. meaning for just a single sample value. Instead, we need to determine the
  2542. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2543. normalizer would simply use the peak magnitude of the complete file, the
  2544. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2545. frame. The length of a frame is specified in milliseconds. By default, the
  2546. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2547. been found to give good results with most files.
  2548. Note that the exact frame length, in number of samples, will be determined
  2549. automatically, based on the sampling rate of the individual input audio file.
  2550. @item gausssize, g
  2551. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2552. number. Default is 31.
  2553. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2554. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2555. is specified in frames, centered around the current frame. For the sake of
  2556. simplicity, this must be an odd number. Consequently, the default value of 31
  2557. takes into account the current frame, as well as the 15 preceding frames and
  2558. the 15 subsequent frames. Using a larger window results in a stronger
  2559. smoothing effect and thus in less gain variation, i.e. slower gain
  2560. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2561. effect and thus in more gain variation, i.e. faster gain adaptation.
  2562. In other words, the more you increase this value, the more the Dynamic Audio
  2563. Normalizer will behave like a "traditional" normalization filter. On the
  2564. contrary, the more you decrease this value, the more the Dynamic Audio
  2565. Normalizer will behave like a dynamic range compressor.
  2566. @item peak, p
  2567. Set the target peak value. This specifies the highest permissible magnitude
  2568. level for the normalized audio input. This filter will try to approach the
  2569. target peak magnitude as closely as possible, but at the same time it also
  2570. makes sure that the normalized signal will never exceed the peak magnitude.
  2571. A frame's maximum local gain factor is imposed directly by the target peak
  2572. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2573. It is not recommended to go above this value.
  2574. @item maxgain, m
  2575. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2576. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2577. factor for each input frame, i.e. the maximum gain factor that does not
  2578. result in clipping or distortion. The maximum gain factor is determined by
  2579. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2580. additionally bounds the frame's maximum gain factor by a predetermined
  2581. (global) maximum gain factor. This is done in order to avoid excessive gain
  2582. factors in "silent" or almost silent frames. By default, the maximum gain
  2583. factor is 10.0, For most inputs the default value should be sufficient and
  2584. it usually is not recommended to increase this value. Though, for input
  2585. with an extremely low overall volume level, it may be necessary to allow even
  2586. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2587. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2588. Instead, a "sigmoid" threshold function will be applied. This way, the
  2589. gain factors will smoothly approach the threshold value, but never exceed that
  2590. value.
  2591. @item targetrms, r
  2592. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2593. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2594. This means that the maximum local gain factor for each frame is defined
  2595. (only) by the frame's highest magnitude sample. This way, the samples can
  2596. be amplified as much as possible without exceeding the maximum signal
  2597. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2598. Normalizer can also take into account the frame's root mean square,
  2599. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2600. determine the power of a time-varying signal. It is therefore considered
  2601. that the RMS is a better approximation of the "perceived loudness" than
  2602. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2603. frames to a constant RMS value, a uniform "perceived loudness" can be
  2604. established. If a target RMS value has been specified, a frame's local gain
  2605. factor is defined as the factor that would result in exactly that RMS value.
  2606. Note, however, that the maximum local gain factor is still restricted by the
  2607. frame's highest magnitude sample, in order to prevent clipping.
  2608. @item coupling, n
  2609. Enable channels coupling. By default is enabled.
  2610. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2611. amount. This means the same gain factor will be applied to all channels, i.e.
  2612. the maximum possible gain factor is determined by the "loudest" channel.
  2613. However, in some recordings, it may happen that the volume of the different
  2614. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2615. In this case, this option can be used to disable the channel coupling. This way,
  2616. the gain factor will be determined independently for each channel, depending
  2617. only on the individual channel's highest magnitude sample. This allows for
  2618. harmonizing the volume of the different channels.
  2619. @item correctdc, c
  2620. Enable DC bias correction. By default is disabled.
  2621. An audio signal (in the time domain) is a sequence of sample values.
  2622. In the Dynamic Audio Normalizer these sample values are represented in the
  2623. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2624. audio signal, or "waveform", should be centered around the zero point.
  2625. That means if we calculate the mean value of all samples in a file, or in a
  2626. single frame, then the result should be 0.0 or at least very close to that
  2627. value. If, however, there is a significant deviation of the mean value from
  2628. 0.0, in either positive or negative direction, this is referred to as a
  2629. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2630. Audio Normalizer provides optional DC bias correction.
  2631. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2632. the mean value, or "DC correction" offset, of each input frame and subtract
  2633. that value from all of the frame's sample values which ensures those samples
  2634. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2635. boundaries, the DC correction offset values will be interpolated smoothly
  2636. between neighbouring frames.
  2637. @item altboundary, b
  2638. Enable alternative boundary mode. By default is disabled.
  2639. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2640. around each frame. This includes the preceding frames as well as the
  2641. subsequent frames. However, for the "boundary" frames, located at the very
  2642. beginning and at the very end of the audio file, not all neighbouring
  2643. frames are available. In particular, for the first few frames in the audio
  2644. file, the preceding frames are not known. And, similarly, for the last few
  2645. frames in the audio file, the subsequent frames are not known. Thus, the
  2646. question arises which gain factors should be assumed for the missing frames
  2647. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2648. to deal with this situation. The default boundary mode assumes a gain factor
  2649. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2650. "fade out" at the beginning and at the end of the input, respectively.
  2651. @item compress, s
  2652. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2653. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2654. compression. This means that signal peaks will not be pruned and thus the
  2655. full dynamic range will be retained within each local neighbourhood. However,
  2656. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2657. normalization algorithm with a more "traditional" compression.
  2658. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2659. (thresholding) function. If (and only if) the compression feature is enabled,
  2660. all input frames will be processed by a soft knee thresholding function prior
  2661. to the actual normalization process. Put simply, the thresholding function is
  2662. going to prune all samples whose magnitude exceeds a certain threshold value.
  2663. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2664. value. Instead, the threshold value will be adjusted for each individual
  2665. frame.
  2666. In general, smaller parameters result in stronger compression, and vice versa.
  2667. Values below 3.0 are not recommended, because audible distortion may appear.
  2668. @item threshold, t
  2669. Set the target threshold value. This specifies the lowest permissible
  2670. magnitude level for the audio input which will be normalized.
  2671. If input frame volume is above this value frame will be normalized.
  2672. Otherwise frame may not be normalized at all. The default value is set
  2673. to 0, which means all input frames will be normalized.
  2674. This option is mostly useful if digital noise is not wanted to be amplified.
  2675. @end table
  2676. @subsection Commands
  2677. This filter supports the all above options as @ref{commands}.
  2678. @section earwax
  2679. Make audio easier to listen to on headphones.
  2680. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2681. so that when listened to on headphones the stereo image is moved from
  2682. inside your head (standard for headphones) to outside and in front of
  2683. the listener (standard for speakers).
  2684. Ported from SoX.
  2685. @section equalizer
  2686. Apply a two-pole peaking equalisation (EQ) filter. With this
  2687. filter, the signal-level at and around a selected frequency can
  2688. be increased or decreased, whilst (unlike bandpass and bandreject
  2689. filters) that at all other frequencies is unchanged.
  2690. In order to produce complex equalisation curves, this filter can
  2691. be given several times, each with a different central frequency.
  2692. The filter accepts the following options:
  2693. @table @option
  2694. @item frequency, f
  2695. Set the filter's central frequency in Hz.
  2696. @item width_type, t
  2697. Set method to specify band-width of filter.
  2698. @table @option
  2699. @item h
  2700. Hz
  2701. @item q
  2702. Q-Factor
  2703. @item o
  2704. octave
  2705. @item s
  2706. slope
  2707. @item k
  2708. kHz
  2709. @end table
  2710. @item width, w
  2711. Specify the band-width of a filter in width_type units.
  2712. @item gain, g
  2713. Set the required gain or attenuation in dB.
  2714. Beware of clipping when using a positive gain.
  2715. @item mix, m
  2716. How much to use filtered signal in output. Default is 1.
  2717. Range is between 0 and 1.
  2718. @item channels, c
  2719. Specify which channels to filter, by default all available are filtered.
  2720. @item normalize, n
  2721. Normalize biquad coefficients, by default is disabled.
  2722. Enabling it will normalize magnitude response at DC to 0dB.
  2723. @end table
  2724. @subsection Examples
  2725. @itemize
  2726. @item
  2727. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2728. @example
  2729. equalizer=f=1000:t=h:width=200:g=-10
  2730. @end example
  2731. @item
  2732. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2733. @example
  2734. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2735. @end example
  2736. @end itemize
  2737. @subsection Commands
  2738. This filter supports the following commands:
  2739. @table @option
  2740. @item frequency, f
  2741. Change equalizer frequency.
  2742. Syntax for the command is : "@var{frequency}"
  2743. @item width_type, t
  2744. Change equalizer width_type.
  2745. Syntax for the command is : "@var{width_type}"
  2746. @item width, w
  2747. Change equalizer width.
  2748. Syntax for the command is : "@var{width}"
  2749. @item gain, g
  2750. Change equalizer gain.
  2751. Syntax for the command is : "@var{gain}"
  2752. @item mix, m
  2753. Change equalizer mix.
  2754. Syntax for the command is : "@var{mix}"
  2755. @end table
  2756. @section extrastereo
  2757. Linearly increases the difference between left and right channels which
  2758. adds some sort of "live" effect to playback.
  2759. The filter accepts the following options:
  2760. @table @option
  2761. @item m
  2762. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2763. (average of both channels), with 1.0 sound will be unchanged, with
  2764. -1.0 left and right channels will be swapped.
  2765. @item c
  2766. Enable clipping. By default is enabled.
  2767. @end table
  2768. @subsection Commands
  2769. This filter supports the all above options as @ref{commands}.
  2770. @section firequalizer
  2771. Apply FIR Equalization using arbitrary frequency response.
  2772. The filter accepts the following option:
  2773. @table @option
  2774. @item gain
  2775. Set gain curve equation (in dB). The expression can contain variables:
  2776. @table @option
  2777. @item f
  2778. the evaluated frequency
  2779. @item sr
  2780. sample rate
  2781. @item ch
  2782. channel number, set to 0 when multichannels evaluation is disabled
  2783. @item chid
  2784. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2785. multichannels evaluation is disabled
  2786. @item chs
  2787. number of channels
  2788. @item chlayout
  2789. channel_layout, see libavutil/channel_layout.h
  2790. @end table
  2791. and functions:
  2792. @table @option
  2793. @item gain_interpolate(f)
  2794. interpolate gain on frequency f based on gain_entry
  2795. @item cubic_interpolate(f)
  2796. same as gain_interpolate, but smoother
  2797. @end table
  2798. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2799. @item gain_entry
  2800. Set gain entry for gain_interpolate function. The expression can
  2801. contain functions:
  2802. @table @option
  2803. @item entry(f, g)
  2804. store gain entry at frequency f with value g
  2805. @end table
  2806. This option is also available as command.
  2807. @item delay
  2808. Set filter delay in seconds. Higher value means more accurate.
  2809. Default is @code{0.01}.
  2810. @item accuracy
  2811. Set filter accuracy in Hz. Lower value means more accurate.
  2812. Default is @code{5}.
  2813. @item wfunc
  2814. Set window function. Acceptable values are:
  2815. @table @option
  2816. @item rectangular
  2817. rectangular window, useful when gain curve is already smooth
  2818. @item hann
  2819. hann window (default)
  2820. @item hamming
  2821. hamming window
  2822. @item blackman
  2823. blackman window
  2824. @item nuttall3
  2825. 3-terms continuous 1st derivative nuttall window
  2826. @item mnuttall3
  2827. minimum 3-terms discontinuous nuttall window
  2828. @item nuttall
  2829. 4-terms continuous 1st derivative nuttall window
  2830. @item bnuttall
  2831. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2832. @item bharris
  2833. blackman-harris window
  2834. @item tukey
  2835. tukey window
  2836. @end table
  2837. @item fixed
  2838. If enabled, use fixed number of audio samples. This improves speed when
  2839. filtering with large delay. Default is disabled.
  2840. @item multi
  2841. Enable multichannels evaluation on gain. Default is disabled.
  2842. @item zero_phase
  2843. Enable zero phase mode by subtracting timestamp to compensate delay.
  2844. Default is disabled.
  2845. @item scale
  2846. Set scale used by gain. Acceptable values are:
  2847. @table @option
  2848. @item linlin
  2849. linear frequency, linear gain
  2850. @item linlog
  2851. linear frequency, logarithmic (in dB) gain (default)
  2852. @item loglin
  2853. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2854. @item loglog
  2855. logarithmic frequency, logarithmic gain
  2856. @end table
  2857. @item dumpfile
  2858. Set file for dumping, suitable for gnuplot.
  2859. @item dumpscale
  2860. Set scale for dumpfile. Acceptable values are same with scale option.
  2861. Default is linlog.
  2862. @item fft2
  2863. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2864. Default is disabled.
  2865. @item min_phase
  2866. Enable minimum phase impulse response. Default is disabled.
  2867. @end table
  2868. @subsection Examples
  2869. @itemize
  2870. @item
  2871. lowpass at 1000 Hz:
  2872. @example
  2873. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2874. @end example
  2875. @item
  2876. lowpass at 1000 Hz with gain_entry:
  2877. @example
  2878. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2879. @end example
  2880. @item
  2881. custom equalization:
  2882. @example
  2883. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2884. @end example
  2885. @item
  2886. higher delay with zero phase to compensate delay:
  2887. @example
  2888. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2889. @end example
  2890. @item
  2891. lowpass on left channel, highpass on right channel:
  2892. @example
  2893. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2894. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2895. @end example
  2896. @end itemize
  2897. @section flanger
  2898. Apply a flanging effect to the audio.
  2899. The filter accepts the following options:
  2900. @table @option
  2901. @item delay
  2902. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2903. @item depth
  2904. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2905. @item regen
  2906. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2907. Default value is 0.
  2908. @item width
  2909. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2910. Default value is 71.
  2911. @item speed
  2912. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2913. @item shape
  2914. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2915. Default value is @var{sinusoidal}.
  2916. @item phase
  2917. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2918. Default value is 25.
  2919. @item interp
  2920. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2921. Default is @var{linear}.
  2922. @end table
  2923. @section haas
  2924. Apply Haas effect to audio.
  2925. Note that this makes most sense to apply on mono signals.
  2926. With this filter applied to mono signals it give some directionality and
  2927. stretches its stereo image.
  2928. The filter accepts the following options:
  2929. @table @option
  2930. @item level_in
  2931. Set input level. By default is @var{1}, or 0dB
  2932. @item level_out
  2933. Set output level. By default is @var{1}, or 0dB.
  2934. @item side_gain
  2935. Set gain applied to side part of signal. By default is @var{1}.
  2936. @item middle_source
  2937. Set kind of middle source. Can be one of the following:
  2938. @table @samp
  2939. @item left
  2940. Pick left channel.
  2941. @item right
  2942. Pick right channel.
  2943. @item mid
  2944. Pick middle part signal of stereo image.
  2945. @item side
  2946. Pick side part signal of stereo image.
  2947. @end table
  2948. @item middle_phase
  2949. Change middle phase. By default is disabled.
  2950. @item left_delay
  2951. Set left channel delay. By default is @var{2.05} milliseconds.
  2952. @item left_balance
  2953. Set left channel balance. By default is @var{-1}.
  2954. @item left_gain
  2955. Set left channel gain. By default is @var{1}.
  2956. @item left_phase
  2957. Change left phase. By default is disabled.
  2958. @item right_delay
  2959. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2960. @item right_balance
  2961. Set right channel balance. By default is @var{1}.
  2962. @item right_gain
  2963. Set right channel gain. By default is @var{1}.
  2964. @item right_phase
  2965. Change right phase. By default is enabled.
  2966. @end table
  2967. @section hdcd
  2968. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2969. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2970. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2971. of HDCD, and detects the Transient Filter flag.
  2972. @example
  2973. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2974. @end example
  2975. When using the filter with wav, note the default encoding for wav is 16-bit,
  2976. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2977. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2978. @example
  2979. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2980. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2981. @end example
  2982. The filter accepts the following options:
  2983. @table @option
  2984. @item disable_autoconvert
  2985. Disable any automatic format conversion or resampling in the filter graph.
  2986. @item process_stereo
  2987. Process the stereo channels together. If target_gain does not match between
  2988. channels, consider it invalid and use the last valid target_gain.
  2989. @item cdt_ms
  2990. Set the code detect timer period in ms.
  2991. @item force_pe
  2992. Always extend peaks above -3dBFS even if PE isn't signaled.
  2993. @item analyze_mode
  2994. Replace audio with a solid tone and adjust the amplitude to signal some
  2995. specific aspect of the decoding process. The output file can be loaded in
  2996. an audio editor alongside the original to aid analysis.
  2997. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2998. Modes are:
  2999. @table @samp
  3000. @item 0, off
  3001. Disabled
  3002. @item 1, lle
  3003. Gain adjustment level at each sample
  3004. @item 2, pe
  3005. Samples where peak extend occurs
  3006. @item 3, cdt
  3007. Samples where the code detect timer is active
  3008. @item 4, tgm
  3009. Samples where the target gain does not match between channels
  3010. @end table
  3011. @end table
  3012. @section headphone
  3013. Apply head-related transfer functions (HRTFs) to create virtual
  3014. loudspeakers around the user for binaural listening via headphones.
  3015. The HRIRs are provided via additional streams, for each channel
  3016. one stereo input stream is needed.
  3017. The filter accepts the following options:
  3018. @table @option
  3019. @item map
  3020. Set mapping of input streams for convolution.
  3021. The argument is a '|'-separated list of channel names in order as they
  3022. are given as additional stream inputs for filter.
  3023. This also specify number of input streams. Number of input streams
  3024. must be not less than number of channels in first stream plus one.
  3025. @item gain
  3026. Set gain applied to audio. Value is in dB. Default is 0.
  3027. @item type
  3028. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3029. processing audio in time domain which is slow.
  3030. @var{freq} is processing audio in frequency domain which is fast.
  3031. Default is @var{freq}.
  3032. @item lfe
  3033. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3034. @item size
  3035. Set size of frame in number of samples which will be processed at once.
  3036. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3037. @item hrir
  3038. Set format of hrir stream.
  3039. Default value is @var{stereo}. Alternative value is @var{multich}.
  3040. If value is set to @var{stereo}, number of additional streams should
  3041. be greater or equal to number of input channels in first input stream.
  3042. Also each additional stream should have stereo number of channels.
  3043. If value is set to @var{multich}, number of additional streams should
  3044. be exactly one. Also number of input channels of additional stream
  3045. should be equal or greater than twice number of channels of first input
  3046. stream.
  3047. @end table
  3048. @subsection Examples
  3049. @itemize
  3050. @item
  3051. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3052. each amovie filter use stereo file with IR coefficients as input.
  3053. The files give coefficients for each position of virtual loudspeaker:
  3054. @example
  3055. ffmpeg -i input.wav
  3056. -filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  3057. output.wav
  3058. @end example
  3059. @item
  3060. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3061. but now in @var{multich} @var{hrir} format.
  3062. @example
  3063. ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  3064. output.wav
  3065. @end example
  3066. @end itemize
  3067. @section highpass
  3068. Apply a high-pass filter with 3dB point frequency.
  3069. The filter can be either single-pole, or double-pole (the default).
  3070. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3071. The filter accepts the following options:
  3072. @table @option
  3073. @item frequency, f
  3074. Set frequency in Hz. Default is 3000.
  3075. @item poles, p
  3076. Set number of poles. Default is 2.
  3077. @item width_type, t
  3078. Set method to specify band-width of filter.
  3079. @table @option
  3080. @item h
  3081. Hz
  3082. @item q
  3083. Q-Factor
  3084. @item o
  3085. octave
  3086. @item s
  3087. slope
  3088. @item k
  3089. kHz
  3090. @end table
  3091. @item width, w
  3092. Specify the band-width of a filter in width_type units.
  3093. Applies only to double-pole filter.
  3094. The default is 0.707q and gives a Butterworth response.
  3095. @item mix, m
  3096. How much to use filtered signal in output. Default is 1.
  3097. Range is between 0 and 1.
  3098. @item channels, c
  3099. Specify which channels to filter, by default all available are filtered.
  3100. @item normalize, n
  3101. Normalize biquad coefficients, by default is disabled.
  3102. Enabling it will normalize magnitude response at DC to 0dB.
  3103. @end table
  3104. @subsection Commands
  3105. This filter supports the following commands:
  3106. @table @option
  3107. @item frequency, f
  3108. Change highpass frequency.
  3109. Syntax for the command is : "@var{frequency}"
  3110. @item width_type, t
  3111. Change highpass width_type.
  3112. Syntax for the command is : "@var{width_type}"
  3113. @item width, w
  3114. Change highpass width.
  3115. Syntax for the command is : "@var{width}"
  3116. @item mix, m
  3117. Change highpass mix.
  3118. Syntax for the command is : "@var{mix}"
  3119. @end table
  3120. @section join
  3121. Join multiple input streams into one multi-channel stream.
  3122. It accepts the following parameters:
  3123. @table @option
  3124. @item inputs
  3125. The number of input streams. It defaults to 2.
  3126. @item channel_layout
  3127. The desired output channel layout. It defaults to stereo.
  3128. @item map
  3129. Map channels from inputs to output. The argument is a '|'-separated list of
  3130. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3131. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3132. can be either the name of the input channel (e.g. FL for front left) or its
  3133. index in the specified input stream. @var{out_channel} is the name of the output
  3134. channel.
  3135. @end table
  3136. The filter will attempt to guess the mappings when they are not specified
  3137. explicitly. It does so by first trying to find an unused matching input channel
  3138. and if that fails it picks the first unused input channel.
  3139. Join 3 inputs (with properly set channel layouts):
  3140. @example
  3141. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3142. @end example
  3143. Build a 5.1 output from 6 single-channel streams:
  3144. @example
  3145. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3146. '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'
  3147. out
  3148. @end example
  3149. @section ladspa
  3150. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3151. To enable compilation of this filter you need to configure FFmpeg with
  3152. @code{--enable-ladspa}.
  3153. @table @option
  3154. @item file, f
  3155. Specifies the name of LADSPA plugin library to load. If the environment
  3156. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3157. each one of the directories specified by the colon separated list in
  3158. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3159. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3160. @file{/usr/lib/ladspa/}.
  3161. @item plugin, p
  3162. Specifies the plugin within the library. Some libraries contain only
  3163. one plugin, but others contain many of them. If this is not set filter
  3164. will list all available plugins within the specified library.
  3165. @item controls, c
  3166. Set the '|' separated list of controls which are zero or more floating point
  3167. values that determine the behavior of the loaded plugin (for example delay,
  3168. threshold or gain).
  3169. Controls need to be defined using the following syntax:
  3170. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3171. @var{valuei} is the value set on the @var{i}-th control.
  3172. Alternatively they can be also defined using the following syntax:
  3173. @var{value0}|@var{value1}|@var{value2}|..., where
  3174. @var{valuei} is the value set on the @var{i}-th control.
  3175. If @option{controls} is set to @code{help}, all available controls and
  3176. their valid ranges are printed.
  3177. @item sample_rate, s
  3178. Specify the sample rate, default to 44100. Only used if plugin have
  3179. zero inputs.
  3180. @item nb_samples, n
  3181. Set the number of samples per channel per each output frame, default
  3182. is 1024. Only used if plugin have zero inputs.
  3183. @item duration, d
  3184. Set the minimum duration of the sourced audio. See
  3185. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3186. for the accepted syntax.
  3187. Note that the resulting duration may be greater than the specified duration,
  3188. as the generated audio is always cut at the end of a complete frame.
  3189. If not specified, or the expressed duration is negative, the audio is
  3190. supposed to be generated forever.
  3191. Only used if plugin have zero inputs.
  3192. @end table
  3193. @subsection Examples
  3194. @itemize
  3195. @item
  3196. List all available plugins within amp (LADSPA example plugin) library:
  3197. @example
  3198. ladspa=file=amp
  3199. @end example
  3200. @item
  3201. List all available controls and their valid ranges for @code{vcf_notch}
  3202. plugin from @code{VCF} library:
  3203. @example
  3204. ladspa=f=vcf:p=vcf_notch:c=help
  3205. @end example
  3206. @item
  3207. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3208. plugin library:
  3209. @example
  3210. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3211. @end example
  3212. @item
  3213. Add reverberation to the audio using TAP-plugins
  3214. (Tom's Audio Processing plugins):
  3215. @example
  3216. ladspa=file=tap_reverb:tap_reverb
  3217. @end example
  3218. @item
  3219. Generate white noise, with 0.2 amplitude:
  3220. @example
  3221. ladspa=file=cmt:noise_source_white:c=c0=.2
  3222. @end example
  3223. @item
  3224. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3225. @code{C* Audio Plugin Suite} (CAPS) library:
  3226. @example
  3227. ladspa=file=caps:Click:c=c1=20'
  3228. @end example
  3229. @item
  3230. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3231. @example
  3232. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3233. @end example
  3234. @item
  3235. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3236. @code{SWH Plugins} collection:
  3237. @example
  3238. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3239. @end example
  3240. @item
  3241. Attenuate low frequencies using Multiband EQ from Steve Harris
  3242. @code{SWH Plugins} collection:
  3243. @example
  3244. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3245. @end example
  3246. @item
  3247. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3248. (CAPS) library:
  3249. @example
  3250. ladspa=caps:Narrower
  3251. @end example
  3252. @item
  3253. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3254. @example
  3255. ladspa=caps:White:.2
  3256. @end example
  3257. @item
  3258. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3259. @example
  3260. ladspa=caps:Fractal:c=c1=1
  3261. @end example
  3262. @item
  3263. Dynamic volume normalization using @code{VLevel} plugin:
  3264. @example
  3265. ladspa=vlevel-ladspa:vlevel_mono
  3266. @end example
  3267. @end itemize
  3268. @subsection Commands
  3269. This filter supports the following commands:
  3270. @table @option
  3271. @item cN
  3272. Modify the @var{N}-th control value.
  3273. If the specified value is not valid, it is ignored and prior one is kept.
  3274. @end table
  3275. @section loudnorm
  3276. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3277. Support for both single pass (livestreams, files) and double pass (files) modes.
  3278. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3279. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3280. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3281. The filter accepts the following options:
  3282. @table @option
  3283. @item I, i
  3284. Set integrated loudness target.
  3285. Range is -70.0 - -5.0. Default value is -24.0.
  3286. @item LRA, lra
  3287. Set loudness range target.
  3288. Range is 1.0 - 20.0. Default value is 7.0.
  3289. @item TP, tp
  3290. Set maximum true peak.
  3291. Range is -9.0 - +0.0. Default value is -2.0.
  3292. @item measured_I, measured_i
  3293. Measured IL of input file.
  3294. Range is -99.0 - +0.0.
  3295. @item measured_LRA, measured_lra
  3296. Measured LRA of input file.
  3297. Range is 0.0 - 99.0.
  3298. @item measured_TP, measured_tp
  3299. Measured true peak of input file.
  3300. Range is -99.0 - +99.0.
  3301. @item measured_thresh
  3302. Measured threshold of input file.
  3303. Range is -99.0 - +0.0.
  3304. @item offset
  3305. Set offset gain. Gain is applied before the true-peak limiter.
  3306. Range is -99.0 - +99.0. Default is +0.0.
  3307. @item linear
  3308. Normalize linearly if possible.
  3309. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3310. to be specified in order to use this mode.
  3311. Options are true or false. Default is true.
  3312. @item dual_mono
  3313. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3314. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3315. If set to @code{true}, this option will compensate for this effect.
  3316. Multi-channel input files are not affected by this option.
  3317. Options are true or false. Default is false.
  3318. @item print_format
  3319. Set print format for stats. Options are summary, json, or none.
  3320. Default value is none.
  3321. @end table
  3322. @section lowpass
  3323. Apply a low-pass filter with 3dB point frequency.
  3324. The filter can be either single-pole or double-pole (the default).
  3325. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3326. The filter accepts the following options:
  3327. @table @option
  3328. @item frequency, f
  3329. Set frequency in Hz. Default is 500.
  3330. @item poles, p
  3331. Set number of poles. Default is 2.
  3332. @item width_type, t
  3333. Set method to specify band-width of filter.
  3334. @table @option
  3335. @item h
  3336. Hz
  3337. @item q
  3338. Q-Factor
  3339. @item o
  3340. octave
  3341. @item s
  3342. slope
  3343. @item k
  3344. kHz
  3345. @end table
  3346. @item width, w
  3347. Specify the band-width of a filter in width_type units.
  3348. Applies only to double-pole filter.
  3349. The default is 0.707q and gives a Butterworth response.
  3350. @item mix, m
  3351. How much to use filtered signal in output. Default is 1.
  3352. Range is between 0 and 1.
  3353. @item channels, c
  3354. Specify which channels to filter, by default all available are filtered.
  3355. @item normalize, n
  3356. Normalize biquad coefficients, by default is disabled.
  3357. Enabling it will normalize magnitude response at DC to 0dB.
  3358. @end table
  3359. @subsection Examples
  3360. @itemize
  3361. @item
  3362. Lowpass only LFE channel, it LFE is not present it does nothing:
  3363. @example
  3364. lowpass=c=LFE
  3365. @end example
  3366. @end itemize
  3367. @subsection Commands
  3368. This filter supports the following commands:
  3369. @table @option
  3370. @item frequency, f
  3371. Change lowpass frequency.
  3372. Syntax for the command is : "@var{frequency}"
  3373. @item width_type, t
  3374. Change lowpass width_type.
  3375. Syntax for the command is : "@var{width_type}"
  3376. @item width, w
  3377. Change lowpass width.
  3378. Syntax for the command is : "@var{width}"
  3379. @item mix, m
  3380. Change lowpass mix.
  3381. Syntax for the command is : "@var{mix}"
  3382. @end table
  3383. @section lv2
  3384. Load a LV2 (LADSPA Version 2) plugin.
  3385. To enable compilation of this filter you need to configure FFmpeg with
  3386. @code{--enable-lv2}.
  3387. @table @option
  3388. @item plugin, p
  3389. Specifies the plugin URI. You may need to escape ':'.
  3390. @item controls, c
  3391. Set the '|' separated list of controls which are zero or more floating point
  3392. values that determine the behavior of the loaded plugin (for example delay,
  3393. threshold or gain).
  3394. If @option{controls} is set to @code{help}, all available controls and
  3395. their valid ranges are printed.
  3396. @item sample_rate, s
  3397. Specify the sample rate, default to 44100. Only used if plugin have
  3398. zero inputs.
  3399. @item nb_samples, n
  3400. Set the number of samples per channel per each output frame, default
  3401. is 1024. Only used if plugin have zero inputs.
  3402. @item duration, d
  3403. Set the minimum duration of the sourced audio. See
  3404. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3405. for the accepted syntax.
  3406. Note that the resulting duration may be greater than the specified duration,
  3407. as the generated audio is always cut at the end of a complete frame.
  3408. If not specified, or the expressed duration is negative, the audio is
  3409. supposed to be generated forever.
  3410. Only used if plugin have zero inputs.
  3411. @end table
  3412. @subsection Examples
  3413. @itemize
  3414. @item
  3415. Apply bass enhancer plugin from Calf:
  3416. @example
  3417. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3418. @end example
  3419. @item
  3420. Apply vinyl plugin from Calf:
  3421. @example
  3422. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3423. @end example
  3424. @item
  3425. Apply bit crusher plugin from ArtyFX:
  3426. @example
  3427. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3428. @end example
  3429. @end itemize
  3430. @section mcompand
  3431. Multiband Compress or expand the audio's dynamic range.
  3432. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3433. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3434. response when absent compander action.
  3435. It accepts the following parameters:
  3436. @table @option
  3437. @item args
  3438. This option syntax is:
  3439. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3440. For explanation of each item refer to compand filter documentation.
  3441. @end table
  3442. @anchor{pan}
  3443. @section pan
  3444. Mix channels with specific gain levels. The filter accepts the output
  3445. channel layout followed by a set of channels definitions.
  3446. This filter is also designed to efficiently remap the channels of an audio
  3447. stream.
  3448. The filter accepts parameters of the form:
  3449. "@var{l}|@var{outdef}|@var{outdef}|..."
  3450. @table @option
  3451. @item l
  3452. output channel layout or number of channels
  3453. @item outdef
  3454. output channel specification, of the form:
  3455. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3456. @item out_name
  3457. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3458. number (c0, c1, etc.)
  3459. @item gain
  3460. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3461. @item in_name
  3462. input channel to use, see out_name for details; it is not possible to mix
  3463. named and numbered input channels
  3464. @end table
  3465. If the `=' in a channel specification is replaced by `<', then the gains for
  3466. that specification will be renormalized so that the total is 1, thus
  3467. avoiding clipping noise.
  3468. @subsection Mixing examples
  3469. For example, if you want to down-mix from stereo to mono, but with a bigger
  3470. factor for the left channel:
  3471. @example
  3472. pan=1c|c0=0.9*c0+0.1*c1
  3473. @end example
  3474. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3475. 7-channels surround:
  3476. @example
  3477. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3478. @end example
  3479. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3480. that should be preferred (see "-ac" option) unless you have very specific
  3481. needs.
  3482. @subsection Remapping examples
  3483. The channel remapping will be effective if, and only if:
  3484. @itemize
  3485. @item gain coefficients are zeroes or ones,
  3486. @item only one input per channel output,
  3487. @end itemize
  3488. If all these conditions are satisfied, the filter will notify the user ("Pure
  3489. channel mapping detected"), and use an optimized and lossless method to do the
  3490. remapping.
  3491. For example, if you have a 5.1 source and want a stereo audio stream by
  3492. dropping the extra channels:
  3493. @example
  3494. pan="stereo| c0=FL | c1=FR"
  3495. @end example
  3496. Given the same source, you can also switch front left and front right channels
  3497. and keep the input channel layout:
  3498. @example
  3499. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3500. @end example
  3501. If the input is a stereo audio stream, you can mute the front left channel (and
  3502. still keep the stereo channel layout) with:
  3503. @example
  3504. pan="stereo|c1=c1"
  3505. @end example
  3506. Still with a stereo audio stream input, you can copy the right channel in both
  3507. front left and right:
  3508. @example
  3509. pan="stereo| c0=FR | c1=FR"
  3510. @end example
  3511. @section replaygain
  3512. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3513. outputs it unchanged.
  3514. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3515. @section resample
  3516. Convert the audio sample format, sample rate and channel layout. It is
  3517. not meant to be used directly.
  3518. @section rubberband
  3519. Apply time-stretching and pitch-shifting with librubberband.
  3520. To enable compilation of this filter, you need to configure FFmpeg with
  3521. @code{--enable-librubberband}.
  3522. The filter accepts the following options:
  3523. @table @option
  3524. @item tempo
  3525. Set tempo scale factor.
  3526. @item pitch
  3527. Set pitch scale factor.
  3528. @item transients
  3529. Set transients detector.
  3530. Possible values are:
  3531. @table @var
  3532. @item crisp
  3533. @item mixed
  3534. @item smooth
  3535. @end table
  3536. @item detector
  3537. Set detector.
  3538. Possible values are:
  3539. @table @var
  3540. @item compound
  3541. @item percussive
  3542. @item soft
  3543. @end table
  3544. @item phase
  3545. Set phase.
  3546. Possible values are:
  3547. @table @var
  3548. @item laminar
  3549. @item independent
  3550. @end table
  3551. @item window
  3552. Set processing window size.
  3553. Possible values are:
  3554. @table @var
  3555. @item standard
  3556. @item short
  3557. @item long
  3558. @end table
  3559. @item smoothing
  3560. Set smoothing.
  3561. Possible values are:
  3562. @table @var
  3563. @item off
  3564. @item on
  3565. @end table
  3566. @item formant
  3567. Enable formant preservation when shift pitching.
  3568. Possible values are:
  3569. @table @var
  3570. @item shifted
  3571. @item preserved
  3572. @end table
  3573. @item pitchq
  3574. Set pitch quality.
  3575. Possible values are:
  3576. @table @var
  3577. @item quality
  3578. @item speed
  3579. @item consistency
  3580. @end table
  3581. @item channels
  3582. Set channels.
  3583. Possible values are:
  3584. @table @var
  3585. @item apart
  3586. @item together
  3587. @end table
  3588. @end table
  3589. @subsection Commands
  3590. This filter supports the following commands:
  3591. @table @option
  3592. @item tempo
  3593. Change filter tempo scale factor.
  3594. Syntax for the command is : "@var{tempo}"
  3595. @item pitch
  3596. Change filter pitch scale factor.
  3597. Syntax for the command is : "@var{pitch}"
  3598. @end table
  3599. @section sidechaincompress
  3600. This filter acts like normal compressor but has the ability to compress
  3601. detected signal using second input signal.
  3602. It needs two input streams and returns one output stream.
  3603. First input stream will be processed depending on second stream signal.
  3604. The filtered signal then can be filtered with other filters in later stages of
  3605. processing. See @ref{pan} and @ref{amerge} filter.
  3606. The filter accepts the following options:
  3607. @table @option
  3608. @item level_in
  3609. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3610. @item mode
  3611. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3612. Default is @code{downward}.
  3613. @item threshold
  3614. If a signal of second stream raises above this level it will affect the gain
  3615. reduction of first stream.
  3616. By default is 0.125. Range is between 0.00097563 and 1.
  3617. @item ratio
  3618. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3619. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3620. Default is 2. Range is between 1 and 20.
  3621. @item attack
  3622. Amount of milliseconds the signal has to rise above the threshold before gain
  3623. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3624. @item release
  3625. Amount of milliseconds the signal has to fall below the threshold before
  3626. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3627. @item makeup
  3628. Set the amount by how much signal will be amplified after processing.
  3629. Default is 1. Range is from 1 to 64.
  3630. @item knee
  3631. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3632. Default is 2.82843. Range is between 1 and 8.
  3633. @item link
  3634. Choose if the @code{average} level between all channels of side-chain stream
  3635. or the louder(@code{maximum}) channel of side-chain stream affects the
  3636. reduction. Default is @code{average}.
  3637. @item detection
  3638. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3639. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3640. @item level_sc
  3641. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3642. @item mix
  3643. How much to use compressed signal in output. Default is 1.
  3644. Range is between 0 and 1.
  3645. @end table
  3646. @subsection Commands
  3647. This filter supports the all above options as @ref{commands}.
  3648. @subsection Examples
  3649. @itemize
  3650. @item
  3651. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3652. depending on the signal of 2nd input and later compressed signal to be
  3653. merged with 2nd input:
  3654. @example
  3655. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3656. @end example
  3657. @end itemize
  3658. @section sidechaingate
  3659. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3660. filter the detected signal before sending it to the gain reduction stage.
  3661. Normally a gate uses the full range signal to detect a level above the
  3662. threshold.
  3663. For example: If you cut all lower frequencies from your sidechain signal
  3664. the gate will decrease the volume of your track only if not enough highs
  3665. appear. With this technique you are able to reduce the resonation of a
  3666. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3667. guitar.
  3668. It needs two input streams and returns one output stream.
  3669. First input stream will be processed depending on second stream signal.
  3670. The filter accepts the following options:
  3671. @table @option
  3672. @item level_in
  3673. Set input level before filtering.
  3674. Default is 1. Allowed range is from 0.015625 to 64.
  3675. @item mode
  3676. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3677. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3678. will be amplified, expanding dynamic range in upward direction.
  3679. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3680. @item range
  3681. Set the level of gain reduction when the signal is below the threshold.
  3682. Default is 0.06125. Allowed range is from 0 to 1.
  3683. Setting this to 0 disables reduction and then filter behaves like expander.
  3684. @item threshold
  3685. If a signal rises above this level the gain reduction is released.
  3686. Default is 0.125. Allowed range is from 0 to 1.
  3687. @item ratio
  3688. Set a ratio about which the signal is reduced.
  3689. Default is 2. Allowed range is from 1 to 9000.
  3690. @item attack
  3691. Amount of milliseconds the signal has to rise above the threshold before gain
  3692. reduction stops.
  3693. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3694. @item release
  3695. Amount of milliseconds the signal has to fall below the threshold before the
  3696. reduction is increased again. Default is 250 milliseconds.
  3697. Allowed range is from 0.01 to 9000.
  3698. @item makeup
  3699. Set amount of amplification of signal after processing.
  3700. Default is 1. Allowed range is from 1 to 64.
  3701. @item knee
  3702. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3703. Default is 2.828427125. Allowed range is from 1 to 8.
  3704. @item detection
  3705. Choose if exact signal should be taken for detection or an RMS like one.
  3706. Default is rms. Can be peak or rms.
  3707. @item link
  3708. Choose if the average level between all channels or the louder channel affects
  3709. the reduction.
  3710. Default is average. Can be average or maximum.
  3711. @item level_sc
  3712. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3713. @end table
  3714. @section silencedetect
  3715. Detect silence in an audio stream.
  3716. This filter logs a message when it detects that the input audio volume is less
  3717. or equal to a noise tolerance value for a duration greater or equal to the
  3718. minimum detected noise duration.
  3719. The printed times and duration are expressed in seconds. The
  3720. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3721. is set on the first frame whose timestamp equals or exceeds the detection
  3722. duration and it contains the timestamp of the first frame of the silence.
  3723. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3724. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3725. keys are set on the first frame after the silence. If @option{mono} is
  3726. enabled, and each channel is evaluated separately, the @code{.X}
  3727. suffixed keys are used, and @code{X} corresponds to the channel number.
  3728. The filter accepts the following options:
  3729. @table @option
  3730. @item noise, n
  3731. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3732. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3733. @item duration, d
  3734. Set silence duration until notification (default is 2 seconds). See
  3735. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3736. for the accepted syntax.
  3737. @item mono, m
  3738. Process each channel separately, instead of combined. By default is disabled.
  3739. @end table
  3740. @subsection Examples
  3741. @itemize
  3742. @item
  3743. Detect 5 seconds of silence with -50dB noise tolerance:
  3744. @example
  3745. silencedetect=n=-50dB:d=5
  3746. @end example
  3747. @item
  3748. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3749. tolerance in @file{silence.mp3}:
  3750. @example
  3751. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3752. @end example
  3753. @end itemize
  3754. @section silenceremove
  3755. Remove silence from the beginning, middle or end of the audio.
  3756. The filter accepts the following options:
  3757. @table @option
  3758. @item start_periods
  3759. This value is used to indicate if audio should be trimmed at beginning of
  3760. the audio. A value of zero indicates no silence should be trimmed from the
  3761. beginning. When specifying a non-zero value, it trims audio up until it
  3762. finds non-silence. Normally, when trimming silence from beginning of audio
  3763. the @var{start_periods} will be @code{1} but it can be increased to higher
  3764. values to trim all audio up to specific count of non-silence periods.
  3765. Default value is @code{0}.
  3766. @item start_duration
  3767. Specify the amount of time that non-silence must be detected before it stops
  3768. trimming audio. By increasing the duration, bursts of noises can be treated
  3769. as silence and trimmed off. Default value is @code{0}.
  3770. @item start_threshold
  3771. This indicates what sample value should be treated as silence. For digital
  3772. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3773. you may wish to increase the value to account for background noise.
  3774. Can be specified in dB (in case "dB" is appended to the specified value)
  3775. or amplitude ratio. Default value is @code{0}.
  3776. @item start_silence
  3777. Specify max duration of silence at beginning that will be kept after
  3778. trimming. Default is 0, which is equal to trimming all samples detected
  3779. as silence.
  3780. @item start_mode
  3781. Specify mode of detection of silence end in start of multi-channel audio.
  3782. Can be @var{any} or @var{all}. Default is @var{any}.
  3783. With @var{any}, any sample that is detected as non-silence will cause
  3784. stopped trimming of silence.
  3785. With @var{all}, only if all channels are detected as non-silence will cause
  3786. stopped trimming of silence.
  3787. @item stop_periods
  3788. Set the count for trimming silence from the end of audio.
  3789. To remove silence from the middle of a file, specify a @var{stop_periods}
  3790. that is negative. This value is then treated as a positive value and is
  3791. used to indicate the effect should restart processing as specified by
  3792. @var{start_periods}, making it suitable for removing periods of silence
  3793. in the middle of the audio.
  3794. Default value is @code{0}.
  3795. @item stop_duration
  3796. Specify a duration of silence that must exist before audio is not copied any
  3797. more. By specifying a higher duration, silence that is wanted can be left in
  3798. the audio.
  3799. Default value is @code{0}.
  3800. @item stop_threshold
  3801. This is the same as @option{start_threshold} but for trimming silence from
  3802. the end of audio.
  3803. Can be specified in dB (in case "dB" is appended to the specified value)
  3804. or amplitude ratio. Default value is @code{0}.
  3805. @item stop_silence
  3806. Specify max duration of silence at end that will be kept after
  3807. trimming. Default is 0, which is equal to trimming all samples detected
  3808. as silence.
  3809. @item stop_mode
  3810. Specify mode of detection of silence start in end of multi-channel audio.
  3811. Can be @var{any} or @var{all}. Default is @var{any}.
  3812. With @var{any}, any sample that is detected as non-silence will cause
  3813. stopped trimming of silence.
  3814. With @var{all}, only if all channels are detected as non-silence will cause
  3815. stopped trimming of silence.
  3816. @item detection
  3817. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3818. and works better with digital silence which is exactly 0.
  3819. Default value is @code{rms}.
  3820. @item window
  3821. Set duration in number of seconds used to calculate size of window in number
  3822. of samples for detecting silence.
  3823. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3824. @end table
  3825. @subsection Examples
  3826. @itemize
  3827. @item
  3828. The following example shows how this filter can be used to start a recording
  3829. that does not contain the delay at the start which usually occurs between
  3830. pressing the record button and the start of the performance:
  3831. @example
  3832. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3833. @end example
  3834. @item
  3835. Trim all silence encountered from beginning to end where there is more than 1
  3836. second of silence in audio:
  3837. @example
  3838. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3839. @end example
  3840. @item
  3841. Trim all digital silence samples, using peak detection, from beginning to end
  3842. where there is more than 0 samples of digital silence in audio and digital
  3843. silence is detected in all channels at same positions in stream:
  3844. @example
  3845. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3846. @end example
  3847. @end itemize
  3848. @section sofalizer
  3849. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3850. loudspeakers around the user for binaural listening via headphones (audio
  3851. formats up to 9 channels supported).
  3852. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3853. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3854. Austrian Academy of Sciences.
  3855. To enable compilation of this filter you need to configure FFmpeg with
  3856. @code{--enable-libmysofa}.
  3857. The filter accepts the following options:
  3858. @table @option
  3859. @item sofa
  3860. Set the SOFA file used for rendering.
  3861. @item gain
  3862. Set gain applied to audio. Value is in dB. Default is 0.
  3863. @item rotation
  3864. Set rotation of virtual loudspeakers in deg. Default is 0.
  3865. @item elevation
  3866. Set elevation of virtual speakers in deg. Default is 0.
  3867. @item radius
  3868. Set distance in meters between loudspeakers and the listener with near-field
  3869. HRTFs. Default is 1.
  3870. @item type
  3871. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3872. processing audio in time domain which is slow.
  3873. @var{freq} is processing audio in frequency domain which is fast.
  3874. Default is @var{freq}.
  3875. @item speakers
  3876. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3877. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3878. Each virtual loudspeaker is described with short channel name following with
  3879. azimuth and elevation in degrees.
  3880. Each virtual loudspeaker description is separated by '|'.
  3881. For example to override front left and front right channel positions use:
  3882. 'speakers=FL 45 15|FR 345 15'.
  3883. Descriptions with unrecognised channel names are ignored.
  3884. @item lfegain
  3885. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3886. @item framesize
  3887. Set custom frame size in number of samples. Default is 1024.
  3888. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3889. is set to @var{freq}.
  3890. @item normalize
  3891. Should all IRs be normalized upon importing SOFA file.
  3892. By default is enabled.
  3893. @item interpolate
  3894. Should nearest IRs be interpolated with neighbor IRs if exact position
  3895. does not match. By default is disabled.
  3896. @item minphase
  3897. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3898. @item anglestep
  3899. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3900. @item radstep
  3901. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3902. @end table
  3903. @subsection Examples
  3904. @itemize
  3905. @item
  3906. Using ClubFritz6 sofa file:
  3907. @example
  3908. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3909. @end example
  3910. @item
  3911. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3912. @example
  3913. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3914. @end example
  3915. @item
  3916. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3917. and also with custom gain:
  3918. @example
  3919. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3920. @end example
  3921. @end itemize
  3922. @section stereotools
  3923. This filter has some handy utilities to manage stereo signals, for converting
  3924. M/S stereo recordings to L/R signal while having control over the parameters
  3925. or spreading the stereo image of master track.
  3926. The filter accepts the following options:
  3927. @table @option
  3928. @item level_in
  3929. Set input level before filtering for both channels. Defaults is 1.
  3930. Allowed range is from 0.015625 to 64.
  3931. @item level_out
  3932. Set output level after filtering for both channels. Defaults is 1.
  3933. Allowed range is from 0.015625 to 64.
  3934. @item balance_in
  3935. Set input balance between both channels. Default is 0.
  3936. Allowed range is from -1 to 1.
  3937. @item balance_out
  3938. Set output balance between both channels. Default is 0.
  3939. Allowed range is from -1 to 1.
  3940. @item softclip
  3941. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3942. clipping. Disabled by default.
  3943. @item mutel
  3944. Mute the left channel. Disabled by default.
  3945. @item muter
  3946. Mute the right channel. Disabled by default.
  3947. @item phasel
  3948. Change the phase of the left channel. Disabled by default.
  3949. @item phaser
  3950. Change the phase of the right channel. Disabled by default.
  3951. @item mode
  3952. Set stereo mode. Available values are:
  3953. @table @samp
  3954. @item lr>lr
  3955. Left/Right to Left/Right, this is default.
  3956. @item lr>ms
  3957. Left/Right to Mid/Side.
  3958. @item ms>lr
  3959. Mid/Side to Left/Right.
  3960. @item lr>ll
  3961. Left/Right to Left/Left.
  3962. @item lr>rr
  3963. Left/Right to Right/Right.
  3964. @item lr>l+r
  3965. Left/Right to Left + Right.
  3966. @item lr>rl
  3967. Left/Right to Right/Left.
  3968. @item ms>ll
  3969. Mid/Side to Left/Left.
  3970. @item ms>rr
  3971. Mid/Side to Right/Right.
  3972. @end table
  3973. @item slev
  3974. Set level of side signal. Default is 1.
  3975. Allowed range is from 0.015625 to 64.
  3976. @item sbal
  3977. Set balance of side signal. Default is 0.
  3978. Allowed range is from -1 to 1.
  3979. @item mlev
  3980. Set level of the middle signal. Default is 1.
  3981. Allowed range is from 0.015625 to 64.
  3982. @item mpan
  3983. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3984. @item base
  3985. Set stereo base between mono and inversed channels. Default is 0.
  3986. Allowed range is from -1 to 1.
  3987. @item delay
  3988. Set delay in milliseconds how much to delay left from right channel and
  3989. vice versa. Default is 0. Allowed range is from -20 to 20.
  3990. @item sclevel
  3991. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3992. @item phase
  3993. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3994. @item bmode_in, bmode_out
  3995. Set balance mode for balance_in/balance_out option.
  3996. Can be one of the following:
  3997. @table @samp
  3998. @item balance
  3999. Classic balance mode. Attenuate one channel at time.
  4000. Gain is raised up to 1.
  4001. @item amplitude
  4002. Similar as classic mode above but gain is raised up to 2.
  4003. @item power
  4004. Equal power distribution, from -6dB to +6dB range.
  4005. @end table
  4006. @end table
  4007. @subsection Examples
  4008. @itemize
  4009. @item
  4010. Apply karaoke like effect:
  4011. @example
  4012. stereotools=mlev=0.015625
  4013. @end example
  4014. @item
  4015. Convert M/S signal to L/R:
  4016. @example
  4017. "stereotools=mode=ms>lr"
  4018. @end example
  4019. @end itemize
  4020. @section stereowiden
  4021. This filter enhance the stereo effect by suppressing signal common to both
  4022. channels and by delaying the signal of left into right and vice versa,
  4023. thereby widening the stereo effect.
  4024. The filter accepts the following options:
  4025. @table @option
  4026. @item delay
  4027. Time in milliseconds of the delay of left signal into right and vice versa.
  4028. Default is 20 milliseconds.
  4029. @item feedback
  4030. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4031. effect of left signal in right output and vice versa which gives widening
  4032. effect. Default is 0.3.
  4033. @item crossfeed
  4034. Cross feed of left into right with inverted phase. This helps in suppressing
  4035. the mono. If the value is 1 it will cancel all the signal common to both
  4036. channels. Default is 0.3.
  4037. @item drymix
  4038. Set level of input signal of original channel. Default is 0.8.
  4039. @end table
  4040. @subsection Commands
  4041. This filter supports the all above options except @code{delay} as @ref{commands}.
  4042. @section superequalizer
  4043. Apply 18 band equalizer.
  4044. The filter accepts the following options:
  4045. @table @option
  4046. @item 1b
  4047. Set 65Hz band gain.
  4048. @item 2b
  4049. Set 92Hz band gain.
  4050. @item 3b
  4051. Set 131Hz band gain.
  4052. @item 4b
  4053. Set 185Hz band gain.
  4054. @item 5b
  4055. Set 262Hz band gain.
  4056. @item 6b
  4057. Set 370Hz band gain.
  4058. @item 7b
  4059. Set 523Hz band gain.
  4060. @item 8b
  4061. Set 740Hz band gain.
  4062. @item 9b
  4063. Set 1047Hz band gain.
  4064. @item 10b
  4065. Set 1480Hz band gain.
  4066. @item 11b
  4067. Set 2093Hz band gain.
  4068. @item 12b
  4069. Set 2960Hz band gain.
  4070. @item 13b
  4071. Set 4186Hz band gain.
  4072. @item 14b
  4073. Set 5920Hz band gain.
  4074. @item 15b
  4075. Set 8372Hz band gain.
  4076. @item 16b
  4077. Set 11840Hz band gain.
  4078. @item 17b
  4079. Set 16744Hz band gain.
  4080. @item 18b
  4081. Set 20000Hz band gain.
  4082. @end table
  4083. @section surround
  4084. Apply audio surround upmix filter.
  4085. This filter allows to produce multichannel output from audio stream.
  4086. The filter accepts the following options:
  4087. @table @option
  4088. @item chl_out
  4089. Set output channel layout. By default, this is @var{5.1}.
  4090. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4091. for the required syntax.
  4092. @item chl_in
  4093. Set input channel layout. By default, this is @var{stereo}.
  4094. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4095. for the required syntax.
  4096. @item level_in
  4097. Set input volume level. By default, this is @var{1}.
  4098. @item level_out
  4099. Set output volume level. By default, this is @var{1}.
  4100. @item lfe
  4101. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4102. @item lfe_low
  4103. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4104. @item lfe_high
  4105. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4106. @item lfe_mode
  4107. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4108. In @var{add} mode, LFE channel is created from input audio and added to output.
  4109. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4110. also all non-LFE output channels are subtracted with output LFE channel.
  4111. @item angle
  4112. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4113. Default is @var{90}.
  4114. @item fc_in
  4115. Set front center input volume. By default, this is @var{1}.
  4116. @item fc_out
  4117. Set front center output volume. By default, this is @var{1}.
  4118. @item fl_in
  4119. Set front left input volume. By default, this is @var{1}.
  4120. @item fl_out
  4121. Set front left output volume. By default, this is @var{1}.
  4122. @item fr_in
  4123. Set front right input volume. By default, this is @var{1}.
  4124. @item fr_out
  4125. Set front right output volume. By default, this is @var{1}.
  4126. @item sl_in
  4127. Set side left input volume. By default, this is @var{1}.
  4128. @item sl_out
  4129. Set side left output volume. By default, this is @var{1}.
  4130. @item sr_in
  4131. Set side right input volume. By default, this is @var{1}.
  4132. @item sr_out
  4133. Set side right output volume. By default, this is @var{1}.
  4134. @item bl_in
  4135. Set back left input volume. By default, this is @var{1}.
  4136. @item bl_out
  4137. Set back left output volume. By default, this is @var{1}.
  4138. @item br_in
  4139. Set back right input volume. By default, this is @var{1}.
  4140. @item br_out
  4141. Set back right output volume. By default, this is @var{1}.
  4142. @item bc_in
  4143. Set back center input volume. By default, this is @var{1}.
  4144. @item bc_out
  4145. Set back center output volume. By default, this is @var{1}.
  4146. @item lfe_in
  4147. Set LFE input volume. By default, this is @var{1}.
  4148. @item lfe_out
  4149. Set LFE output volume. By default, this is @var{1}.
  4150. @item allx
  4151. Set spread usage of stereo image across X axis for all channels.
  4152. @item ally
  4153. Set spread usage of stereo image across Y axis for all channels.
  4154. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4155. Set spread usage of stereo image across X axis for each channel.
  4156. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4157. Set spread usage of stereo image across Y axis for each channel.
  4158. @item win_size
  4159. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4160. @item win_func
  4161. Set window function.
  4162. It accepts the following values:
  4163. @table @samp
  4164. @item rect
  4165. @item bartlett
  4166. @item hann, hanning
  4167. @item hamming
  4168. @item blackman
  4169. @item welch
  4170. @item flattop
  4171. @item bharris
  4172. @item bnuttall
  4173. @item bhann
  4174. @item sine
  4175. @item nuttall
  4176. @item lanczos
  4177. @item gauss
  4178. @item tukey
  4179. @item dolph
  4180. @item cauchy
  4181. @item parzen
  4182. @item poisson
  4183. @item bohman
  4184. @end table
  4185. Default is @code{hann}.
  4186. @item overlap
  4187. Set window overlap. If set to 1, the recommended overlap for selected
  4188. window function will be picked. Default is @code{0.5}.
  4189. @end table
  4190. @section treble, highshelf
  4191. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4192. shelving filter with a response similar to that of a standard
  4193. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4194. The filter accepts the following options:
  4195. @table @option
  4196. @item gain, g
  4197. Give the gain at whichever is the lower of ~22 kHz and the
  4198. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4199. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4200. @item frequency, f
  4201. Set the filter's central frequency and so can be used
  4202. to extend or reduce the frequency range to be boosted or cut.
  4203. The default value is @code{3000} Hz.
  4204. @item width_type, t
  4205. Set method to specify band-width of filter.
  4206. @table @option
  4207. @item h
  4208. Hz
  4209. @item q
  4210. Q-Factor
  4211. @item o
  4212. octave
  4213. @item s
  4214. slope
  4215. @item k
  4216. kHz
  4217. @end table
  4218. @item width, w
  4219. Determine how steep is the filter's shelf transition.
  4220. @item mix, m
  4221. How much to use filtered signal in output. Default is 1.
  4222. Range is between 0 and 1.
  4223. @item channels, c
  4224. Specify which channels to filter, by default all available are filtered.
  4225. @item normalize, n
  4226. Normalize biquad coefficients, by default is disabled.
  4227. Enabling it will normalize magnitude response at DC to 0dB.
  4228. @end table
  4229. @subsection Commands
  4230. This filter supports the following commands:
  4231. @table @option
  4232. @item frequency, f
  4233. Change treble frequency.
  4234. Syntax for the command is : "@var{frequency}"
  4235. @item width_type, t
  4236. Change treble width_type.
  4237. Syntax for the command is : "@var{width_type}"
  4238. @item width, w
  4239. Change treble width.
  4240. Syntax for the command is : "@var{width}"
  4241. @item gain, g
  4242. Change treble gain.
  4243. Syntax for the command is : "@var{gain}"
  4244. @item mix, m
  4245. Change treble mix.
  4246. Syntax for the command is : "@var{mix}"
  4247. @end table
  4248. @section tremolo
  4249. Sinusoidal amplitude modulation.
  4250. The filter accepts the following options:
  4251. @table @option
  4252. @item f
  4253. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4254. (20 Hz or lower) will result in a tremolo effect.
  4255. This filter may also be used as a ring modulator by specifying
  4256. a modulation frequency higher than 20 Hz.
  4257. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4258. @item d
  4259. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4260. Default value is 0.5.
  4261. @end table
  4262. @section vibrato
  4263. Sinusoidal phase modulation.
  4264. The filter accepts the following options:
  4265. @table @option
  4266. @item f
  4267. Modulation frequency in Hertz.
  4268. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4269. @item d
  4270. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4271. Default value is 0.5.
  4272. @end table
  4273. @section volume
  4274. Adjust the input audio volume.
  4275. It accepts the following parameters:
  4276. @table @option
  4277. @item volume
  4278. Set audio volume expression.
  4279. Output values are clipped to the maximum value.
  4280. The output audio volume is given by the relation:
  4281. @example
  4282. @var{output_volume} = @var{volume} * @var{input_volume}
  4283. @end example
  4284. The default value for @var{volume} is "1.0".
  4285. @item precision
  4286. This parameter represents the mathematical precision.
  4287. It determines which input sample formats will be allowed, which affects the
  4288. precision of the volume scaling.
  4289. @table @option
  4290. @item fixed
  4291. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4292. @item float
  4293. 32-bit floating-point; this limits input sample format to FLT. (default)
  4294. @item double
  4295. 64-bit floating-point; this limits input sample format to DBL.
  4296. @end table
  4297. @item replaygain
  4298. Choose the behaviour on encountering ReplayGain side data in input frames.
  4299. @table @option
  4300. @item drop
  4301. Remove ReplayGain side data, ignoring its contents (the default).
  4302. @item ignore
  4303. Ignore ReplayGain side data, but leave it in the frame.
  4304. @item track
  4305. Prefer the track gain, if present.
  4306. @item album
  4307. Prefer the album gain, if present.
  4308. @end table
  4309. @item replaygain_preamp
  4310. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4311. Default value for @var{replaygain_preamp} is 0.0.
  4312. @item replaygain_noclip
  4313. Prevent clipping by limiting the gain applied.
  4314. Default value for @var{replaygain_noclip} is 1.
  4315. @item eval
  4316. Set when the volume expression is evaluated.
  4317. It accepts the following values:
  4318. @table @samp
  4319. @item once
  4320. only evaluate expression once during the filter initialization, or
  4321. when the @samp{volume} command is sent
  4322. @item frame
  4323. evaluate expression for each incoming frame
  4324. @end table
  4325. Default value is @samp{once}.
  4326. @end table
  4327. The volume expression can contain the following parameters.
  4328. @table @option
  4329. @item n
  4330. frame number (starting at zero)
  4331. @item nb_channels
  4332. number of channels
  4333. @item nb_consumed_samples
  4334. number of samples consumed by the filter
  4335. @item nb_samples
  4336. number of samples in the current frame
  4337. @item pos
  4338. original frame position in the file
  4339. @item pts
  4340. frame PTS
  4341. @item sample_rate
  4342. sample rate
  4343. @item startpts
  4344. PTS at start of stream
  4345. @item startt
  4346. time at start of stream
  4347. @item t
  4348. frame time
  4349. @item tb
  4350. timestamp timebase
  4351. @item volume
  4352. last set volume value
  4353. @end table
  4354. Note that when @option{eval} is set to @samp{once} only the
  4355. @var{sample_rate} and @var{tb} variables are available, all other
  4356. variables will evaluate to NAN.
  4357. @subsection Commands
  4358. This filter supports the following commands:
  4359. @table @option
  4360. @item volume
  4361. Modify the volume expression.
  4362. The command accepts the same syntax of the corresponding option.
  4363. If the specified expression is not valid, it is kept at its current
  4364. value.
  4365. @end table
  4366. @subsection Examples
  4367. @itemize
  4368. @item
  4369. Halve the input audio volume:
  4370. @example
  4371. volume=volume=0.5
  4372. volume=volume=1/2
  4373. volume=volume=-6.0206dB
  4374. @end example
  4375. In all the above example the named key for @option{volume} can be
  4376. omitted, for example like in:
  4377. @example
  4378. volume=0.5
  4379. @end example
  4380. @item
  4381. Increase input audio power by 6 decibels using fixed-point precision:
  4382. @example
  4383. volume=volume=6dB:precision=fixed
  4384. @end example
  4385. @item
  4386. Fade volume after time 10 with an annihilation period of 5 seconds:
  4387. @example
  4388. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4389. @end example
  4390. @end itemize
  4391. @section volumedetect
  4392. Detect the volume of the input video.
  4393. The filter has no parameters. The input is not modified. Statistics about
  4394. the volume will be printed in the log when the input stream end is reached.
  4395. In particular it will show the mean volume (root mean square), maximum
  4396. volume (on a per-sample basis), and the beginning of a histogram of the
  4397. registered volume values (from the maximum value to a cumulated 1/1000 of
  4398. the samples).
  4399. All volumes are in decibels relative to the maximum PCM value.
  4400. @subsection Examples
  4401. Here is an excerpt of the output:
  4402. @example
  4403. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4404. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4405. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4406. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4407. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4408. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4409. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4410. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4411. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4412. @end example
  4413. It means that:
  4414. @itemize
  4415. @item
  4416. The mean square energy is approximately -27 dB, or 10^-2.7.
  4417. @item
  4418. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4419. @item
  4420. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4421. @end itemize
  4422. In other words, raising the volume by +4 dB does not cause any clipping,
  4423. raising it by +5 dB causes clipping for 6 samples, etc.
  4424. @c man end AUDIO FILTERS
  4425. @chapter Audio Sources
  4426. @c man begin AUDIO SOURCES
  4427. Below is a description of the currently available audio sources.
  4428. @section abuffer
  4429. Buffer audio frames, and make them available to the filter chain.
  4430. This source is mainly intended for a programmatic use, in particular
  4431. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4432. It accepts the following parameters:
  4433. @table @option
  4434. @item time_base
  4435. The timebase which will be used for timestamps of submitted frames. It must be
  4436. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4437. @item sample_rate
  4438. The sample rate of the incoming audio buffers.
  4439. @item sample_fmt
  4440. The sample format of the incoming audio buffers.
  4441. Either a sample format name or its corresponding integer representation from
  4442. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4443. @item channel_layout
  4444. The channel layout of the incoming audio buffers.
  4445. Either a channel layout name from channel_layout_map in
  4446. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4447. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4448. @item channels
  4449. The number of channels of the incoming audio buffers.
  4450. If both @var{channels} and @var{channel_layout} are specified, then they
  4451. must be consistent.
  4452. @end table
  4453. @subsection Examples
  4454. @example
  4455. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4456. @end example
  4457. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4458. Since the sample format with name "s16p" corresponds to the number
  4459. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4460. equivalent to:
  4461. @example
  4462. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4463. @end example
  4464. @section aevalsrc
  4465. Generate an audio signal specified by an expression.
  4466. This source accepts in input one or more expressions (one for each
  4467. channel), which are evaluated and used to generate a corresponding
  4468. audio signal.
  4469. This source accepts the following options:
  4470. @table @option
  4471. @item exprs
  4472. Set the '|'-separated expressions list for each separate channel. In case the
  4473. @option{channel_layout} option is not specified, the selected channel layout
  4474. depends on the number of provided expressions. Otherwise the last
  4475. specified expression is applied to the remaining output channels.
  4476. @item channel_layout, c
  4477. Set the channel layout. The number of channels in the specified layout
  4478. must be equal to the number of specified expressions.
  4479. @item duration, d
  4480. Set the minimum duration of the sourced audio. See
  4481. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4482. for the accepted syntax.
  4483. Note that the resulting duration may be greater than the specified
  4484. duration, as the generated audio is always cut at the end of a
  4485. complete frame.
  4486. If not specified, or the expressed duration is negative, the audio is
  4487. supposed to be generated forever.
  4488. @item nb_samples, n
  4489. Set the number of samples per channel per each output frame,
  4490. default to 1024.
  4491. @item sample_rate, s
  4492. Specify the sample rate, default to 44100.
  4493. @end table
  4494. Each expression in @var{exprs} can contain the following constants:
  4495. @table @option
  4496. @item n
  4497. number of the evaluated sample, starting from 0
  4498. @item t
  4499. time of the evaluated sample expressed in seconds, starting from 0
  4500. @item s
  4501. sample rate
  4502. @end table
  4503. @subsection Examples
  4504. @itemize
  4505. @item
  4506. Generate silence:
  4507. @example
  4508. aevalsrc=0
  4509. @end example
  4510. @item
  4511. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4512. 8000 Hz:
  4513. @example
  4514. aevalsrc="sin(440*2*PI*t):s=8000"
  4515. @end example
  4516. @item
  4517. Generate a two channels signal, specify the channel layout (Front
  4518. Center + Back Center) explicitly:
  4519. @example
  4520. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4521. @end example
  4522. @item
  4523. Generate white noise:
  4524. @example
  4525. aevalsrc="-2+random(0)"
  4526. @end example
  4527. @item
  4528. Generate an amplitude modulated signal:
  4529. @example
  4530. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4531. @end example
  4532. @item
  4533. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4534. @example
  4535. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4536. @end example
  4537. @end itemize
  4538. @section anullsrc
  4539. The null audio source, return unprocessed audio frames. It is mainly useful
  4540. as a template and to be employed in analysis / debugging tools, or as
  4541. the source for filters which ignore the input data (for example the sox
  4542. synth filter).
  4543. This source accepts the following options:
  4544. @table @option
  4545. @item channel_layout, cl
  4546. Specifies the channel layout, and can be either an integer or a string
  4547. representing a channel layout. The default value of @var{channel_layout}
  4548. is "stereo".
  4549. Check the channel_layout_map definition in
  4550. @file{libavutil/channel_layout.c} for the mapping between strings and
  4551. channel layout values.
  4552. @item sample_rate, r
  4553. Specifies the sample rate, and defaults to 44100.
  4554. @item nb_samples, n
  4555. Set the number of samples per requested frames.
  4556. @end table
  4557. @subsection Examples
  4558. @itemize
  4559. @item
  4560. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4561. @example
  4562. anullsrc=r=48000:cl=4
  4563. @end example
  4564. @item
  4565. Do the same operation with a more obvious syntax:
  4566. @example
  4567. anullsrc=r=48000:cl=mono
  4568. @end example
  4569. @end itemize
  4570. All the parameters need to be explicitly defined.
  4571. @section flite
  4572. Synthesize a voice utterance using the libflite library.
  4573. To enable compilation of this filter you need to configure FFmpeg with
  4574. @code{--enable-libflite}.
  4575. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4576. The filter accepts the following options:
  4577. @table @option
  4578. @item list_voices
  4579. If set to 1, list the names of the available voices and exit
  4580. immediately. Default value is 0.
  4581. @item nb_samples, n
  4582. Set the maximum number of samples per frame. Default value is 512.
  4583. @item textfile
  4584. Set the filename containing the text to speak.
  4585. @item text
  4586. Set the text to speak.
  4587. @item voice, v
  4588. Set the voice to use for the speech synthesis. Default value is
  4589. @code{kal}. See also the @var{list_voices} option.
  4590. @end table
  4591. @subsection Examples
  4592. @itemize
  4593. @item
  4594. Read from file @file{speech.txt}, and synthesize the text using the
  4595. standard flite voice:
  4596. @example
  4597. flite=textfile=speech.txt
  4598. @end example
  4599. @item
  4600. Read the specified text selecting the @code{slt} voice:
  4601. @example
  4602. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4603. @end example
  4604. @item
  4605. Input text to ffmpeg:
  4606. @example
  4607. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4608. @end example
  4609. @item
  4610. Make @file{ffplay} speak the specified text, using @code{flite} and
  4611. the @code{lavfi} device:
  4612. @example
  4613. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4614. @end example
  4615. @end itemize
  4616. For more information about libflite, check:
  4617. @url{http://www.festvox.org/flite/}
  4618. @section anoisesrc
  4619. Generate a noise audio signal.
  4620. The filter accepts the following options:
  4621. @table @option
  4622. @item sample_rate, r
  4623. Specify the sample rate. Default value is 48000 Hz.
  4624. @item amplitude, a
  4625. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4626. is 1.0.
  4627. @item duration, d
  4628. Specify the duration of the generated audio stream. Not specifying this option
  4629. results in noise with an infinite length.
  4630. @item color, colour, c
  4631. Specify the color of noise. Available noise colors are white, pink, brown,
  4632. blue and violet. Default color is white.
  4633. @item seed, s
  4634. Specify a value used to seed the PRNG.
  4635. @item nb_samples, n
  4636. Set the number of samples per each output frame, default is 1024.
  4637. @end table
  4638. @subsection Examples
  4639. @itemize
  4640. @item
  4641. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4642. @example
  4643. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4644. @end example
  4645. @end itemize
  4646. @section hilbert
  4647. Generate odd-tap Hilbert transform FIR coefficients.
  4648. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4649. the signal by 90 degrees.
  4650. This is used in many matrix coding schemes and for analytic signal generation.
  4651. The process is often written as a multiplication by i (or j), the imaginary unit.
  4652. The filter accepts the following options:
  4653. @table @option
  4654. @item sample_rate, s
  4655. Set sample rate, default is 44100.
  4656. @item taps, t
  4657. Set length of FIR filter, default is 22051.
  4658. @item nb_samples, n
  4659. Set number of samples per each frame.
  4660. @item win_func, w
  4661. Set window function to be used when generating FIR coefficients.
  4662. @end table
  4663. @section sinc
  4664. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4665. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4666. The filter accepts the following options:
  4667. @table @option
  4668. @item sample_rate, r
  4669. Set sample rate, default is 44100.
  4670. @item nb_samples, n
  4671. Set number of samples per each frame. Default is 1024.
  4672. @item hp
  4673. Set high-pass frequency. Default is 0.
  4674. @item lp
  4675. Set low-pass frequency. Default is 0.
  4676. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4677. is higher than 0 then filter will create band-pass filter coefficients,
  4678. otherwise band-reject filter coefficients.
  4679. @item phase
  4680. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4681. @item beta
  4682. Set Kaiser window beta.
  4683. @item att
  4684. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4685. @item round
  4686. Enable rounding, by default is disabled.
  4687. @item hptaps
  4688. Set number of taps for high-pass filter.
  4689. @item lptaps
  4690. Set number of taps for low-pass filter.
  4691. @end table
  4692. @section sine
  4693. Generate an audio signal made of a sine wave with amplitude 1/8.
  4694. The audio signal is bit-exact.
  4695. The filter accepts the following options:
  4696. @table @option
  4697. @item frequency, f
  4698. Set the carrier frequency. Default is 440 Hz.
  4699. @item beep_factor, b
  4700. Enable a periodic beep every second with frequency @var{beep_factor} times
  4701. the carrier frequency. Default is 0, meaning the beep is disabled.
  4702. @item sample_rate, r
  4703. Specify the sample rate, default is 44100.
  4704. @item duration, d
  4705. Specify the duration of the generated audio stream.
  4706. @item samples_per_frame
  4707. Set the number of samples per output frame.
  4708. The expression can contain the following constants:
  4709. @table @option
  4710. @item n
  4711. The (sequential) number of the output audio frame, starting from 0.
  4712. @item pts
  4713. The PTS (Presentation TimeStamp) of the output audio frame,
  4714. expressed in @var{TB} units.
  4715. @item t
  4716. The PTS of the output audio frame, expressed in seconds.
  4717. @item TB
  4718. The timebase of the output audio frames.
  4719. @end table
  4720. Default is @code{1024}.
  4721. @end table
  4722. @subsection Examples
  4723. @itemize
  4724. @item
  4725. Generate a simple 440 Hz sine wave:
  4726. @example
  4727. sine
  4728. @end example
  4729. @item
  4730. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4731. @example
  4732. sine=220:4:d=5
  4733. sine=f=220:b=4:d=5
  4734. sine=frequency=220:beep_factor=4:duration=5
  4735. @end example
  4736. @item
  4737. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4738. pattern:
  4739. @example
  4740. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4741. @end example
  4742. @end itemize
  4743. @c man end AUDIO SOURCES
  4744. @chapter Audio Sinks
  4745. @c man begin AUDIO SINKS
  4746. Below is a description of the currently available audio sinks.
  4747. @section abuffersink
  4748. Buffer audio frames, and make them available to the end of filter chain.
  4749. This sink is mainly intended for programmatic use, in particular
  4750. through the interface defined in @file{libavfilter/buffersink.h}
  4751. or the options system.
  4752. It accepts a pointer to an AVABufferSinkContext structure, which
  4753. defines the incoming buffers' formats, to be passed as the opaque
  4754. parameter to @code{avfilter_init_filter} for initialization.
  4755. @section anullsink
  4756. Null audio sink; do absolutely nothing with the input audio. It is
  4757. mainly useful as a template and for use in analysis / debugging
  4758. tools.
  4759. @c man end AUDIO SINKS
  4760. @chapter Video Filters
  4761. @c man begin VIDEO FILTERS
  4762. When you configure your FFmpeg build, you can disable any of the
  4763. existing filters using @code{--disable-filters}.
  4764. The configure output will show the video filters included in your
  4765. build.
  4766. Below is a description of the currently available video filters.
  4767. @section addroi
  4768. Mark a region of interest in a video frame.
  4769. The frame data is passed through unchanged, but metadata is attached
  4770. to the frame indicating regions of interest which can affect the
  4771. behaviour of later encoding. Multiple regions can be marked by
  4772. applying the filter multiple times.
  4773. @table @option
  4774. @item x
  4775. Region distance in pixels from the left edge of the frame.
  4776. @item y
  4777. Region distance in pixels from the top edge of the frame.
  4778. @item w
  4779. Region width in pixels.
  4780. @item h
  4781. Region height in pixels.
  4782. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4783. and may contain the following variables:
  4784. @table @option
  4785. @item iw
  4786. Width of the input frame.
  4787. @item ih
  4788. Height of the input frame.
  4789. @end table
  4790. @item qoffset
  4791. Quantisation offset to apply within the region.
  4792. This must be a real value in the range -1 to +1. A value of zero
  4793. indicates no quality change. A negative value asks for better quality
  4794. (less quantisation), while a positive value asks for worse quality
  4795. (greater quantisation).
  4796. The range is calibrated so that the extreme values indicate the
  4797. largest possible offset - if the rest of the frame is encoded with the
  4798. worst possible quality, an offset of -1 indicates that this region
  4799. should be encoded with the best possible quality anyway. Intermediate
  4800. values are then interpolated in some codec-dependent way.
  4801. For example, in 10-bit H.264 the quantisation parameter varies between
  4802. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4803. this region should be encoded with a QP around one-tenth of the full
  4804. range better than the rest of the frame. So, if most of the frame
  4805. were to be encoded with a QP of around 30, this region would get a QP
  4806. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4807. An extreme value of -1 would indicate that this region should be
  4808. encoded with the best possible quality regardless of the treatment of
  4809. the rest of the frame - that is, should be encoded at a QP of -12.
  4810. @item clear
  4811. If set to true, remove any existing regions of interest marked on the
  4812. frame before adding the new one.
  4813. @end table
  4814. @subsection Examples
  4815. @itemize
  4816. @item
  4817. Mark the centre quarter of the frame as interesting.
  4818. @example
  4819. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4820. @end example
  4821. @item
  4822. Mark the 100-pixel-wide region on the left edge of the frame as very
  4823. uninteresting (to be encoded at much lower quality than the rest of
  4824. the frame).
  4825. @example
  4826. addroi=0:0:100:ih:+1/5
  4827. @end example
  4828. @end itemize
  4829. @section alphaextract
  4830. Extract the alpha component from the input as a grayscale video. This
  4831. is especially useful with the @var{alphamerge} filter.
  4832. @section alphamerge
  4833. Add or replace the alpha component of the primary input with the
  4834. grayscale value of a second input. This is intended for use with
  4835. @var{alphaextract} to allow the transmission or storage of frame
  4836. sequences that have alpha in a format that doesn't support an alpha
  4837. channel.
  4838. For example, to reconstruct full frames from a normal YUV-encoded video
  4839. and a separate video created with @var{alphaextract}, you might use:
  4840. @example
  4841. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4842. @end example
  4843. Since this filter is designed for reconstruction, it operates on frame
  4844. sequences without considering timestamps, and terminates when either
  4845. input reaches end of stream. This will cause problems if your encoding
  4846. pipeline drops frames. If you're trying to apply an image as an
  4847. overlay to a video stream, consider the @var{overlay} filter instead.
  4848. @section amplify
  4849. Amplify differences between current pixel and pixels of adjacent frames in
  4850. same pixel location.
  4851. This filter accepts the following options:
  4852. @table @option
  4853. @item radius
  4854. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4855. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4856. @item factor
  4857. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4858. @item threshold
  4859. Set threshold for difference amplification. Any difference greater or equal to
  4860. this value will not alter source pixel. Default is 10.
  4861. Allowed range is from 0 to 65535.
  4862. @item tolerance
  4863. Set tolerance for difference amplification. Any difference lower to
  4864. this value will not alter source pixel. Default is 0.
  4865. Allowed range is from 0 to 65535.
  4866. @item low
  4867. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4868. This option controls maximum possible value that will decrease source pixel value.
  4869. @item high
  4870. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4871. This option controls maximum possible value that will increase source pixel value.
  4872. @item planes
  4873. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4874. @end table
  4875. @subsection Commands
  4876. This filter supports the following @ref{commands} that corresponds to option of same name:
  4877. @table @option
  4878. @item factor
  4879. @item threshold
  4880. @item tolerance
  4881. @item low
  4882. @item high
  4883. @item planes
  4884. @end table
  4885. @section ass
  4886. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4887. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4888. Substation Alpha) subtitles files.
  4889. This filter accepts the following option in addition to the common options from
  4890. the @ref{subtitles} filter:
  4891. @table @option
  4892. @item shaping
  4893. Set the shaping engine
  4894. Available values are:
  4895. @table @samp
  4896. @item auto
  4897. The default libass shaping engine, which is the best available.
  4898. @item simple
  4899. Fast, font-agnostic shaper that can do only substitutions
  4900. @item complex
  4901. Slower shaper using OpenType for substitutions and positioning
  4902. @end table
  4903. The default is @code{auto}.
  4904. @end table
  4905. @section atadenoise
  4906. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4907. The filter accepts the following options:
  4908. @table @option
  4909. @item 0a
  4910. Set threshold A for 1st plane. Default is 0.02.
  4911. Valid range is 0 to 0.3.
  4912. @item 0b
  4913. Set threshold B for 1st plane. Default is 0.04.
  4914. Valid range is 0 to 5.
  4915. @item 1a
  4916. Set threshold A for 2nd plane. Default is 0.02.
  4917. Valid range is 0 to 0.3.
  4918. @item 1b
  4919. Set threshold B for 2nd plane. Default is 0.04.
  4920. Valid range is 0 to 5.
  4921. @item 2a
  4922. Set threshold A for 3rd plane. Default is 0.02.
  4923. Valid range is 0 to 0.3.
  4924. @item 2b
  4925. Set threshold B for 3rd plane. Default is 0.04.
  4926. Valid range is 0 to 5.
  4927. Threshold A is designed to react on abrupt changes in the input signal and
  4928. threshold B is designed to react on continuous changes in the input signal.
  4929. @item s
  4930. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4931. number in range [5, 129].
  4932. @item p
  4933. Set what planes of frame filter will use for averaging. Default is all.
  4934. @item a
  4935. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  4936. Alternatively can be set to @code{s} serial.
  4937. Parallel can be faster then serial, while other way around is never true.
  4938. Parallel will abort early on first change being greater then thresholds, while serial
  4939. will continue processing other side of frames if they are equal or bellow thresholds.
  4940. @end table
  4941. @subsection Commands
  4942. This filter supports same @ref{commands} as options except option @code{s}.
  4943. The command accepts the same syntax of the corresponding option.
  4944. @section avgblur
  4945. Apply average blur filter.
  4946. The filter accepts the following options:
  4947. @table @option
  4948. @item sizeX
  4949. Set horizontal radius size.
  4950. @item planes
  4951. Set which planes to filter. By default all planes are filtered.
  4952. @item sizeY
  4953. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4954. Default is @code{0}.
  4955. @end table
  4956. @subsection Commands
  4957. This filter supports same commands as options.
  4958. The command accepts the same syntax of the corresponding option.
  4959. If the specified expression is not valid, it is kept at its current
  4960. value.
  4961. @section bbox
  4962. Compute the bounding box for the non-black pixels in the input frame
  4963. luminance plane.
  4964. This filter computes the bounding box containing all the pixels with a
  4965. luminance value greater than the minimum allowed value.
  4966. The parameters describing the bounding box are printed on the filter
  4967. log.
  4968. The filter accepts the following option:
  4969. @table @option
  4970. @item min_val
  4971. Set the minimal luminance value. Default is @code{16}.
  4972. @end table
  4973. @section bilateral
  4974. Apply bilateral filter, spatial smoothing while preserving edges.
  4975. The filter accepts the following options:
  4976. @table @option
  4977. @item sigmaS
  4978. Set sigma of gaussian function to calculate spatial weight.
  4979. Allowed range is 0 to 10. Default is 0.1.
  4980. @item sigmaR
  4981. Set sigma of gaussian function to calculate range weight.
  4982. Allowed range is 0 to 1. Default is 0.1.
  4983. @item planes
  4984. Set planes to filter. Default is first only.
  4985. @end table
  4986. @section bitplanenoise
  4987. Show and measure bit plane noise.
  4988. The filter accepts the following options:
  4989. @table @option
  4990. @item bitplane
  4991. Set which plane to analyze. Default is @code{1}.
  4992. @item filter
  4993. Filter out noisy pixels from @code{bitplane} set above.
  4994. Default is disabled.
  4995. @end table
  4996. @section blackdetect
  4997. Detect video intervals that are (almost) completely black. Can be
  4998. useful to detect chapter transitions, commercials, or invalid
  4999. recordings. Output lines contains the time for the start, end and
  5000. duration of the detected black interval expressed in seconds.
  5001. In order to display the output lines, you need to set the loglevel at
  5002. least to the AV_LOG_INFO value.
  5003. The filter accepts the following options:
  5004. @table @option
  5005. @item black_min_duration, d
  5006. Set the minimum detected black duration expressed in seconds. It must
  5007. be a non-negative floating point number.
  5008. Default value is 2.0.
  5009. @item picture_black_ratio_th, pic_th
  5010. Set the threshold for considering a picture "black".
  5011. Express the minimum value for the ratio:
  5012. @example
  5013. @var{nb_black_pixels} / @var{nb_pixels}
  5014. @end example
  5015. for which a picture is considered black.
  5016. Default value is 0.98.
  5017. @item pixel_black_th, pix_th
  5018. Set the threshold for considering a pixel "black".
  5019. The threshold expresses the maximum pixel luminance value for which a
  5020. pixel is considered "black". The provided value is scaled according to
  5021. the following equation:
  5022. @example
  5023. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5024. @end example
  5025. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5026. the input video format, the range is [0-255] for YUV full-range
  5027. formats and [16-235] for YUV non full-range formats.
  5028. Default value is 0.10.
  5029. @end table
  5030. The following example sets the maximum pixel threshold to the minimum
  5031. value, and detects only black intervals of 2 or more seconds:
  5032. @example
  5033. blackdetect=d=2:pix_th=0.00
  5034. @end example
  5035. @section blackframe
  5036. Detect frames that are (almost) completely black. Can be useful to
  5037. detect chapter transitions or commercials. Output lines consist of
  5038. the frame number of the detected frame, the percentage of blackness,
  5039. the position in the file if known or -1 and the timestamp in seconds.
  5040. In order to display the output lines, you need to set the loglevel at
  5041. least to the AV_LOG_INFO value.
  5042. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5043. The value represents the percentage of pixels in the picture that
  5044. are below the threshold value.
  5045. It accepts the following parameters:
  5046. @table @option
  5047. @item amount
  5048. The percentage of the pixels that have to be below the threshold; it defaults to
  5049. @code{98}.
  5050. @item threshold, thresh
  5051. The threshold below which a pixel value is considered black; it defaults to
  5052. @code{32}.
  5053. @end table
  5054. @section blend, tblend
  5055. Blend two video frames into each other.
  5056. The @code{blend} filter takes two input streams and outputs one
  5057. stream, the first input is the "top" layer and second input is
  5058. "bottom" layer. By default, the output terminates when the longest input terminates.
  5059. The @code{tblend} (time blend) filter takes two consecutive frames
  5060. from one single stream, and outputs the result obtained by blending
  5061. the new frame on top of the old frame.
  5062. A description of the accepted options follows.
  5063. @table @option
  5064. @item c0_mode
  5065. @item c1_mode
  5066. @item c2_mode
  5067. @item c3_mode
  5068. @item all_mode
  5069. Set blend mode for specific pixel component or all pixel components in case
  5070. of @var{all_mode}. Default value is @code{normal}.
  5071. Available values for component modes are:
  5072. @table @samp
  5073. @item addition
  5074. @item grainmerge
  5075. @item and
  5076. @item average
  5077. @item burn
  5078. @item darken
  5079. @item difference
  5080. @item grainextract
  5081. @item divide
  5082. @item dodge
  5083. @item freeze
  5084. @item exclusion
  5085. @item extremity
  5086. @item glow
  5087. @item hardlight
  5088. @item hardmix
  5089. @item heat
  5090. @item lighten
  5091. @item linearlight
  5092. @item multiply
  5093. @item multiply128
  5094. @item negation
  5095. @item normal
  5096. @item or
  5097. @item overlay
  5098. @item phoenix
  5099. @item pinlight
  5100. @item reflect
  5101. @item screen
  5102. @item softlight
  5103. @item subtract
  5104. @item vividlight
  5105. @item xor
  5106. @end table
  5107. @item c0_opacity
  5108. @item c1_opacity
  5109. @item c2_opacity
  5110. @item c3_opacity
  5111. @item all_opacity
  5112. Set blend opacity for specific pixel component or all pixel components in case
  5113. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5114. @item c0_expr
  5115. @item c1_expr
  5116. @item c2_expr
  5117. @item c3_expr
  5118. @item all_expr
  5119. Set blend expression for specific pixel component or all pixel components in case
  5120. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5121. The expressions can use the following variables:
  5122. @table @option
  5123. @item N
  5124. The sequential number of the filtered frame, starting from @code{0}.
  5125. @item X
  5126. @item Y
  5127. the coordinates of the current sample
  5128. @item W
  5129. @item H
  5130. the width and height of currently filtered plane
  5131. @item SW
  5132. @item SH
  5133. Width and height scale for the plane being filtered. It is the
  5134. ratio between the dimensions of the current plane to the luma plane,
  5135. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5136. the luma plane and @code{0.5,0.5} for the chroma planes.
  5137. @item T
  5138. Time of the current frame, expressed in seconds.
  5139. @item TOP, A
  5140. Value of pixel component at current location for first video frame (top layer).
  5141. @item BOTTOM, B
  5142. Value of pixel component at current location for second video frame (bottom layer).
  5143. @end table
  5144. @end table
  5145. The @code{blend} filter also supports the @ref{framesync} options.
  5146. @subsection Examples
  5147. @itemize
  5148. @item
  5149. Apply transition from bottom layer to top layer in first 10 seconds:
  5150. @example
  5151. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5152. @end example
  5153. @item
  5154. Apply linear horizontal transition from top layer to bottom layer:
  5155. @example
  5156. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5157. @end example
  5158. @item
  5159. Apply 1x1 checkerboard effect:
  5160. @example
  5161. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5162. @end example
  5163. @item
  5164. Apply uncover left effect:
  5165. @example
  5166. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5167. @end example
  5168. @item
  5169. Apply uncover down effect:
  5170. @example
  5171. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5172. @end example
  5173. @item
  5174. Apply uncover up-left effect:
  5175. @example
  5176. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5177. @end example
  5178. @item
  5179. Split diagonally video and shows top and bottom layer on each side:
  5180. @example
  5181. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5182. @end example
  5183. @item
  5184. Display differences between the current and the previous frame:
  5185. @example
  5186. tblend=all_mode=grainextract
  5187. @end example
  5188. @end itemize
  5189. @section bm3d
  5190. Denoise frames using Block-Matching 3D algorithm.
  5191. The filter accepts the following options.
  5192. @table @option
  5193. @item sigma
  5194. Set denoising strength. Default value is 1.
  5195. Allowed range is from 0 to 999.9.
  5196. The denoising algorithm is very sensitive to sigma, so adjust it
  5197. according to the source.
  5198. @item block
  5199. Set local patch size. This sets dimensions in 2D.
  5200. @item bstep
  5201. Set sliding step for processing blocks. Default value is 4.
  5202. Allowed range is from 1 to 64.
  5203. Smaller values allows processing more reference blocks and is slower.
  5204. @item group
  5205. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5206. When set to 1, no block matching is done. Larger values allows more blocks
  5207. in single group.
  5208. Allowed range is from 1 to 256.
  5209. @item range
  5210. Set radius for search block matching. Default is 9.
  5211. Allowed range is from 1 to INT32_MAX.
  5212. @item mstep
  5213. Set step between two search locations for block matching. Default is 1.
  5214. Allowed range is from 1 to 64. Smaller is slower.
  5215. @item thmse
  5216. Set threshold of mean square error for block matching. Valid range is 0 to
  5217. INT32_MAX.
  5218. @item hdthr
  5219. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5220. Larger values results in stronger hard-thresholding filtering in frequency
  5221. domain.
  5222. @item estim
  5223. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5224. Default is @code{basic}.
  5225. @item ref
  5226. If enabled, filter will use 2nd stream for block matching.
  5227. Default is disabled for @code{basic} value of @var{estim} option,
  5228. and always enabled if value of @var{estim} is @code{final}.
  5229. @item planes
  5230. Set planes to filter. Default is all available except alpha.
  5231. @end table
  5232. @subsection Examples
  5233. @itemize
  5234. @item
  5235. Basic filtering with bm3d:
  5236. @example
  5237. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5238. @end example
  5239. @item
  5240. Same as above, but filtering only luma:
  5241. @example
  5242. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5243. @end example
  5244. @item
  5245. Same as above, but with both estimation modes:
  5246. @example
  5247. 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
  5248. @end example
  5249. @item
  5250. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5251. @example
  5252. 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
  5253. @end example
  5254. @end itemize
  5255. @section boxblur
  5256. Apply a boxblur algorithm to the input video.
  5257. It accepts the following parameters:
  5258. @table @option
  5259. @item luma_radius, lr
  5260. @item luma_power, lp
  5261. @item chroma_radius, cr
  5262. @item chroma_power, cp
  5263. @item alpha_radius, ar
  5264. @item alpha_power, ap
  5265. @end table
  5266. A description of the accepted options follows.
  5267. @table @option
  5268. @item luma_radius, lr
  5269. @item chroma_radius, cr
  5270. @item alpha_radius, ar
  5271. Set an expression for the box radius in pixels used for blurring the
  5272. corresponding input plane.
  5273. The radius value must be a non-negative number, and must not be
  5274. greater than the value of the expression @code{min(w,h)/2} for the
  5275. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5276. planes.
  5277. Default value for @option{luma_radius} is "2". If not specified,
  5278. @option{chroma_radius} and @option{alpha_radius} default to the
  5279. corresponding value set for @option{luma_radius}.
  5280. The expressions can contain the following constants:
  5281. @table @option
  5282. @item w
  5283. @item h
  5284. The input width and height in pixels.
  5285. @item cw
  5286. @item ch
  5287. The input chroma image width and height in pixels.
  5288. @item hsub
  5289. @item vsub
  5290. The horizontal and vertical chroma subsample values. For example, for the
  5291. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5292. @end table
  5293. @item luma_power, lp
  5294. @item chroma_power, cp
  5295. @item alpha_power, ap
  5296. Specify how many times the boxblur filter is applied to the
  5297. corresponding plane.
  5298. Default value for @option{luma_power} is 2. If not specified,
  5299. @option{chroma_power} and @option{alpha_power} default to the
  5300. corresponding value set for @option{luma_power}.
  5301. A value of 0 will disable the effect.
  5302. @end table
  5303. @subsection Examples
  5304. @itemize
  5305. @item
  5306. Apply a boxblur filter with the luma, chroma, and alpha radii
  5307. set to 2:
  5308. @example
  5309. boxblur=luma_radius=2:luma_power=1
  5310. boxblur=2:1
  5311. @end example
  5312. @item
  5313. Set the luma radius to 2, and alpha and chroma radius to 0:
  5314. @example
  5315. boxblur=2:1:cr=0:ar=0
  5316. @end example
  5317. @item
  5318. Set the luma and chroma radii to a fraction of the video dimension:
  5319. @example
  5320. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5321. @end example
  5322. @end itemize
  5323. @section bwdif
  5324. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5325. Deinterlacing Filter").
  5326. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5327. interpolation algorithms.
  5328. It accepts the following parameters:
  5329. @table @option
  5330. @item mode
  5331. The interlacing mode to adopt. It accepts one of the following values:
  5332. @table @option
  5333. @item 0, send_frame
  5334. Output one frame for each frame.
  5335. @item 1, send_field
  5336. Output one frame for each field.
  5337. @end table
  5338. The default value is @code{send_field}.
  5339. @item parity
  5340. The picture field parity assumed for the input interlaced video. It accepts one
  5341. of the following values:
  5342. @table @option
  5343. @item 0, tff
  5344. Assume the top field is first.
  5345. @item 1, bff
  5346. Assume the bottom field is first.
  5347. @item -1, auto
  5348. Enable automatic detection of field parity.
  5349. @end table
  5350. The default value is @code{auto}.
  5351. If the interlacing is unknown or the decoder does not export this information,
  5352. top field first will be assumed.
  5353. @item deint
  5354. Specify which frames to deinterlace. Accepts one of the following
  5355. values:
  5356. @table @option
  5357. @item 0, all
  5358. Deinterlace all frames.
  5359. @item 1, interlaced
  5360. Only deinterlace frames marked as interlaced.
  5361. @end table
  5362. The default value is @code{all}.
  5363. @end table
  5364. @section chromahold
  5365. Remove all color information for all colors except for certain one.
  5366. The filter accepts the following options:
  5367. @table @option
  5368. @item color
  5369. The color which will not be replaced with neutral chroma.
  5370. @item similarity
  5371. Similarity percentage with the above color.
  5372. 0.01 matches only the exact key color, while 1.0 matches everything.
  5373. @item blend
  5374. Blend percentage.
  5375. 0.0 makes pixels either fully gray, or not gray at all.
  5376. Higher values result in more preserved color.
  5377. @item yuv
  5378. Signals that the color passed is already in YUV instead of RGB.
  5379. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5380. This can be used to pass exact YUV values as hexadecimal numbers.
  5381. @end table
  5382. @subsection Commands
  5383. This filter supports same @ref{commands} as options.
  5384. The command accepts the same syntax of the corresponding option.
  5385. If the specified expression is not valid, it is kept at its current
  5386. value.
  5387. @section chromakey
  5388. YUV colorspace color/chroma keying.
  5389. The filter accepts the following options:
  5390. @table @option
  5391. @item color
  5392. The color which will be replaced with transparency.
  5393. @item similarity
  5394. Similarity percentage with the key color.
  5395. 0.01 matches only the exact key color, while 1.0 matches everything.
  5396. @item blend
  5397. Blend percentage.
  5398. 0.0 makes pixels either fully transparent, or not transparent at all.
  5399. Higher values result in semi-transparent pixels, with a higher transparency
  5400. the more similar the pixels color is to the key color.
  5401. @item yuv
  5402. Signals that the color passed is already in YUV instead of RGB.
  5403. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5404. This can be used to pass exact YUV values as hexadecimal numbers.
  5405. @end table
  5406. @subsection Commands
  5407. This filter supports same @ref{commands} as options.
  5408. The command accepts the same syntax of the corresponding option.
  5409. If the specified expression is not valid, it is kept at its current
  5410. value.
  5411. @subsection Examples
  5412. @itemize
  5413. @item
  5414. Make every green pixel in the input image transparent:
  5415. @example
  5416. ffmpeg -i input.png -vf chromakey=green out.png
  5417. @end example
  5418. @item
  5419. Overlay a greenscreen-video on top of a static black background.
  5420. @example
  5421. 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
  5422. @end example
  5423. @end itemize
  5424. @section chromashift
  5425. Shift chroma pixels horizontally and/or vertically.
  5426. The filter accepts the following options:
  5427. @table @option
  5428. @item cbh
  5429. Set amount to shift chroma-blue horizontally.
  5430. @item cbv
  5431. Set amount to shift chroma-blue vertically.
  5432. @item crh
  5433. Set amount to shift chroma-red horizontally.
  5434. @item crv
  5435. Set amount to shift chroma-red vertically.
  5436. @item edge
  5437. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5438. @end table
  5439. @subsection Commands
  5440. This filter supports the all above options as @ref{commands}.
  5441. @section ciescope
  5442. Display CIE color diagram with pixels overlaid onto it.
  5443. The filter accepts the following options:
  5444. @table @option
  5445. @item system
  5446. Set color system.
  5447. @table @samp
  5448. @item ntsc, 470m
  5449. @item ebu, 470bg
  5450. @item smpte
  5451. @item 240m
  5452. @item apple
  5453. @item widergb
  5454. @item cie1931
  5455. @item rec709, hdtv
  5456. @item uhdtv, rec2020
  5457. @item dcip3
  5458. @end table
  5459. @item cie
  5460. Set CIE system.
  5461. @table @samp
  5462. @item xyy
  5463. @item ucs
  5464. @item luv
  5465. @end table
  5466. @item gamuts
  5467. Set what gamuts to draw.
  5468. See @code{system} option for available values.
  5469. @item size, s
  5470. Set ciescope size, by default set to 512.
  5471. @item intensity, i
  5472. Set intensity used to map input pixel values to CIE diagram.
  5473. @item contrast
  5474. Set contrast used to draw tongue colors that are out of active color system gamut.
  5475. @item corrgamma
  5476. Correct gamma displayed on scope, by default enabled.
  5477. @item showwhite
  5478. Show white point on CIE diagram, by default disabled.
  5479. @item gamma
  5480. Set input gamma. Used only with XYZ input color space.
  5481. @end table
  5482. @section codecview
  5483. Visualize information exported by some codecs.
  5484. Some codecs can export information through frames using side-data or other
  5485. means. For example, some MPEG based codecs export motion vectors through the
  5486. @var{export_mvs} flag in the codec @option{flags2} option.
  5487. The filter accepts the following option:
  5488. @table @option
  5489. @item mv
  5490. Set motion vectors to visualize.
  5491. Available flags for @var{mv} are:
  5492. @table @samp
  5493. @item pf
  5494. forward predicted MVs of P-frames
  5495. @item bf
  5496. forward predicted MVs of B-frames
  5497. @item bb
  5498. backward predicted MVs of B-frames
  5499. @end table
  5500. @item qp
  5501. Display quantization parameters using the chroma planes.
  5502. @item mv_type, mvt
  5503. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5504. Available flags for @var{mv_type} are:
  5505. @table @samp
  5506. @item fp
  5507. forward predicted MVs
  5508. @item bp
  5509. backward predicted MVs
  5510. @end table
  5511. @item frame_type, ft
  5512. Set frame type to visualize motion vectors of.
  5513. Available flags for @var{frame_type} are:
  5514. @table @samp
  5515. @item if
  5516. intra-coded frames (I-frames)
  5517. @item pf
  5518. predicted frames (P-frames)
  5519. @item bf
  5520. bi-directionally predicted frames (B-frames)
  5521. @end table
  5522. @end table
  5523. @subsection Examples
  5524. @itemize
  5525. @item
  5526. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5527. @example
  5528. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5529. @end example
  5530. @item
  5531. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5532. @example
  5533. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5534. @end example
  5535. @end itemize
  5536. @section colorbalance
  5537. Modify intensity of primary colors (red, green and blue) of input frames.
  5538. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5539. regions for the red-cyan, green-magenta or blue-yellow balance.
  5540. A positive adjustment value shifts the balance towards the primary color, a negative
  5541. value towards the complementary color.
  5542. The filter accepts the following options:
  5543. @table @option
  5544. @item rs
  5545. @item gs
  5546. @item bs
  5547. Adjust red, green and blue shadows (darkest pixels).
  5548. @item rm
  5549. @item gm
  5550. @item bm
  5551. Adjust red, green and blue midtones (medium pixels).
  5552. @item rh
  5553. @item gh
  5554. @item bh
  5555. Adjust red, green and blue highlights (brightest pixels).
  5556. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5557. @item pl
  5558. Preserve lightness when changing color balance. Default is disabled.
  5559. @end table
  5560. @subsection Examples
  5561. @itemize
  5562. @item
  5563. Add red color cast to shadows:
  5564. @example
  5565. colorbalance=rs=.3
  5566. @end example
  5567. @end itemize
  5568. @subsection Commands
  5569. This filter supports the all above options as @ref{commands}.
  5570. @section colorchannelmixer
  5571. Adjust video input frames by re-mixing color channels.
  5572. This filter modifies a color channel by adding the values associated to
  5573. the other channels of the same pixels. For example if the value to
  5574. modify is red, the output value will be:
  5575. @example
  5576. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5577. @end example
  5578. The filter accepts the following options:
  5579. @table @option
  5580. @item rr
  5581. @item rg
  5582. @item rb
  5583. @item ra
  5584. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5585. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5586. @item gr
  5587. @item gg
  5588. @item gb
  5589. @item ga
  5590. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5591. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5592. @item br
  5593. @item bg
  5594. @item bb
  5595. @item ba
  5596. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5597. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5598. @item ar
  5599. @item ag
  5600. @item ab
  5601. @item aa
  5602. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5603. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5604. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5605. @end table
  5606. @subsection Examples
  5607. @itemize
  5608. @item
  5609. Convert source to grayscale:
  5610. @example
  5611. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5612. @end example
  5613. @item
  5614. Simulate sepia tones:
  5615. @example
  5616. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5617. @end example
  5618. @end itemize
  5619. @subsection Commands
  5620. This filter supports the all above options as @ref{commands}.
  5621. @section colorkey
  5622. RGB colorspace color keying.
  5623. The filter accepts the following options:
  5624. @table @option
  5625. @item color
  5626. The color which will be replaced with transparency.
  5627. @item similarity
  5628. Similarity percentage with the key color.
  5629. 0.01 matches only the exact key color, while 1.0 matches everything.
  5630. @item blend
  5631. Blend percentage.
  5632. 0.0 makes pixels either fully transparent, or not transparent at all.
  5633. Higher values result in semi-transparent pixels, with a higher transparency
  5634. the more similar the pixels color is to the key color.
  5635. @end table
  5636. @subsection Examples
  5637. @itemize
  5638. @item
  5639. Make every green pixel in the input image transparent:
  5640. @example
  5641. ffmpeg -i input.png -vf colorkey=green out.png
  5642. @end example
  5643. @item
  5644. Overlay a greenscreen-video on top of a static background image.
  5645. @example
  5646. 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
  5647. @end example
  5648. @end itemize
  5649. @section colorhold
  5650. Remove all color information for all RGB colors except for certain one.
  5651. The filter accepts the following options:
  5652. @table @option
  5653. @item color
  5654. The color which will not be replaced with neutral gray.
  5655. @item similarity
  5656. Similarity percentage with the above color.
  5657. 0.01 matches only the exact key color, while 1.0 matches everything.
  5658. @item blend
  5659. Blend percentage. 0.0 makes pixels fully gray.
  5660. Higher values result in more preserved color.
  5661. @end table
  5662. @section colorlevels
  5663. Adjust video input frames using levels.
  5664. The filter accepts the following options:
  5665. @table @option
  5666. @item rimin
  5667. @item gimin
  5668. @item bimin
  5669. @item aimin
  5670. Adjust red, green, blue and alpha input black point.
  5671. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5672. @item rimax
  5673. @item gimax
  5674. @item bimax
  5675. @item aimax
  5676. Adjust red, green, blue and alpha input white point.
  5677. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5678. Input levels are used to lighten highlights (bright tones), darken shadows
  5679. (dark tones), change the balance of bright and dark tones.
  5680. @item romin
  5681. @item gomin
  5682. @item bomin
  5683. @item aomin
  5684. Adjust red, green, blue and alpha output black point.
  5685. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5686. @item romax
  5687. @item gomax
  5688. @item bomax
  5689. @item aomax
  5690. Adjust red, green, blue and alpha output white point.
  5691. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5692. Output levels allows manual selection of a constrained output level range.
  5693. @end table
  5694. @subsection Examples
  5695. @itemize
  5696. @item
  5697. Make video output darker:
  5698. @example
  5699. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5700. @end example
  5701. @item
  5702. Increase contrast:
  5703. @example
  5704. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5705. @end example
  5706. @item
  5707. Make video output lighter:
  5708. @example
  5709. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5710. @end example
  5711. @item
  5712. Increase brightness:
  5713. @example
  5714. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5715. @end example
  5716. @end itemize
  5717. @section colormatrix
  5718. Convert color matrix.
  5719. The filter accepts the following options:
  5720. @table @option
  5721. @item src
  5722. @item dst
  5723. Specify the source and destination color matrix. Both values must be
  5724. specified.
  5725. The accepted values are:
  5726. @table @samp
  5727. @item bt709
  5728. BT.709
  5729. @item fcc
  5730. FCC
  5731. @item bt601
  5732. BT.601
  5733. @item bt470
  5734. BT.470
  5735. @item bt470bg
  5736. BT.470BG
  5737. @item smpte170m
  5738. SMPTE-170M
  5739. @item smpte240m
  5740. SMPTE-240M
  5741. @item bt2020
  5742. BT.2020
  5743. @end table
  5744. @end table
  5745. For example to convert from BT.601 to SMPTE-240M, use the command:
  5746. @example
  5747. colormatrix=bt601:smpte240m
  5748. @end example
  5749. @section colorspace
  5750. Convert colorspace, transfer characteristics or color primaries.
  5751. Input video needs to have an even size.
  5752. The filter accepts the following options:
  5753. @table @option
  5754. @anchor{all}
  5755. @item all
  5756. Specify all color properties at once.
  5757. The accepted values are:
  5758. @table @samp
  5759. @item bt470m
  5760. BT.470M
  5761. @item bt470bg
  5762. BT.470BG
  5763. @item bt601-6-525
  5764. BT.601-6 525
  5765. @item bt601-6-625
  5766. BT.601-6 625
  5767. @item bt709
  5768. BT.709
  5769. @item smpte170m
  5770. SMPTE-170M
  5771. @item smpte240m
  5772. SMPTE-240M
  5773. @item bt2020
  5774. BT.2020
  5775. @end table
  5776. @anchor{space}
  5777. @item space
  5778. Specify output colorspace.
  5779. The accepted values are:
  5780. @table @samp
  5781. @item bt709
  5782. BT.709
  5783. @item fcc
  5784. FCC
  5785. @item bt470bg
  5786. BT.470BG or BT.601-6 625
  5787. @item smpte170m
  5788. SMPTE-170M or BT.601-6 525
  5789. @item smpte240m
  5790. SMPTE-240M
  5791. @item ycgco
  5792. YCgCo
  5793. @item bt2020ncl
  5794. BT.2020 with non-constant luminance
  5795. @end table
  5796. @anchor{trc}
  5797. @item trc
  5798. Specify output transfer characteristics.
  5799. The accepted values are:
  5800. @table @samp
  5801. @item bt709
  5802. BT.709
  5803. @item bt470m
  5804. BT.470M
  5805. @item bt470bg
  5806. BT.470BG
  5807. @item gamma22
  5808. Constant gamma of 2.2
  5809. @item gamma28
  5810. Constant gamma of 2.8
  5811. @item smpte170m
  5812. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5813. @item smpte240m
  5814. SMPTE-240M
  5815. @item srgb
  5816. SRGB
  5817. @item iec61966-2-1
  5818. iec61966-2-1
  5819. @item iec61966-2-4
  5820. iec61966-2-4
  5821. @item xvycc
  5822. xvycc
  5823. @item bt2020-10
  5824. BT.2020 for 10-bits content
  5825. @item bt2020-12
  5826. BT.2020 for 12-bits content
  5827. @end table
  5828. @anchor{primaries}
  5829. @item primaries
  5830. Specify output color primaries.
  5831. The accepted values are:
  5832. @table @samp
  5833. @item bt709
  5834. BT.709
  5835. @item bt470m
  5836. BT.470M
  5837. @item bt470bg
  5838. BT.470BG or BT.601-6 625
  5839. @item smpte170m
  5840. SMPTE-170M or BT.601-6 525
  5841. @item smpte240m
  5842. SMPTE-240M
  5843. @item film
  5844. film
  5845. @item smpte431
  5846. SMPTE-431
  5847. @item smpte432
  5848. SMPTE-432
  5849. @item bt2020
  5850. BT.2020
  5851. @item jedec-p22
  5852. JEDEC P22 phosphors
  5853. @end table
  5854. @anchor{range}
  5855. @item range
  5856. Specify output color range.
  5857. The accepted values are:
  5858. @table @samp
  5859. @item tv
  5860. TV (restricted) range
  5861. @item mpeg
  5862. MPEG (restricted) range
  5863. @item pc
  5864. PC (full) range
  5865. @item jpeg
  5866. JPEG (full) range
  5867. @end table
  5868. @item format
  5869. Specify output color format.
  5870. The accepted values are:
  5871. @table @samp
  5872. @item yuv420p
  5873. YUV 4:2:0 planar 8-bits
  5874. @item yuv420p10
  5875. YUV 4:2:0 planar 10-bits
  5876. @item yuv420p12
  5877. YUV 4:2:0 planar 12-bits
  5878. @item yuv422p
  5879. YUV 4:2:2 planar 8-bits
  5880. @item yuv422p10
  5881. YUV 4:2:2 planar 10-bits
  5882. @item yuv422p12
  5883. YUV 4:2:2 planar 12-bits
  5884. @item yuv444p
  5885. YUV 4:4:4 planar 8-bits
  5886. @item yuv444p10
  5887. YUV 4:4:4 planar 10-bits
  5888. @item yuv444p12
  5889. YUV 4:4:4 planar 12-bits
  5890. @end table
  5891. @item fast
  5892. Do a fast conversion, which skips gamma/primary correction. This will take
  5893. significantly less CPU, but will be mathematically incorrect. To get output
  5894. compatible with that produced by the colormatrix filter, use fast=1.
  5895. @item dither
  5896. Specify dithering mode.
  5897. The accepted values are:
  5898. @table @samp
  5899. @item none
  5900. No dithering
  5901. @item fsb
  5902. Floyd-Steinberg dithering
  5903. @end table
  5904. @item wpadapt
  5905. Whitepoint adaptation mode.
  5906. The accepted values are:
  5907. @table @samp
  5908. @item bradford
  5909. Bradford whitepoint adaptation
  5910. @item vonkries
  5911. von Kries whitepoint adaptation
  5912. @item identity
  5913. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5914. @end table
  5915. @item iall
  5916. Override all input properties at once. Same accepted values as @ref{all}.
  5917. @item ispace
  5918. Override input colorspace. Same accepted values as @ref{space}.
  5919. @item iprimaries
  5920. Override input color primaries. Same accepted values as @ref{primaries}.
  5921. @item itrc
  5922. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5923. @item irange
  5924. Override input color range. Same accepted values as @ref{range}.
  5925. @end table
  5926. The filter converts the transfer characteristics, color space and color
  5927. primaries to the specified user values. The output value, if not specified,
  5928. is set to a default value based on the "all" property. If that property is
  5929. also not specified, the filter will log an error. The output color range and
  5930. format default to the same value as the input color range and format. The
  5931. input transfer characteristics, color space, color primaries and color range
  5932. should be set on the input data. If any of these are missing, the filter will
  5933. log an error and no conversion will take place.
  5934. For example to convert the input to SMPTE-240M, use the command:
  5935. @example
  5936. colorspace=smpte240m
  5937. @end example
  5938. @section convolution
  5939. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5940. The filter accepts the following options:
  5941. @table @option
  5942. @item 0m
  5943. @item 1m
  5944. @item 2m
  5945. @item 3m
  5946. Set matrix for each plane.
  5947. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5948. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5949. @item 0rdiv
  5950. @item 1rdiv
  5951. @item 2rdiv
  5952. @item 3rdiv
  5953. Set multiplier for calculated value for each plane.
  5954. If unset or 0, it will be sum of all matrix elements.
  5955. @item 0bias
  5956. @item 1bias
  5957. @item 2bias
  5958. @item 3bias
  5959. Set bias for each plane. This value is added to the result of the multiplication.
  5960. Useful for making the overall image brighter or darker. Default is 0.0.
  5961. @item 0mode
  5962. @item 1mode
  5963. @item 2mode
  5964. @item 3mode
  5965. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5966. Default is @var{square}.
  5967. @end table
  5968. @subsection Examples
  5969. @itemize
  5970. @item
  5971. Apply sharpen:
  5972. @example
  5973. 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"
  5974. @end example
  5975. @item
  5976. Apply blur:
  5977. @example
  5978. 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"
  5979. @end example
  5980. @item
  5981. Apply edge enhance:
  5982. @example
  5983. 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"
  5984. @end example
  5985. @item
  5986. Apply edge detect:
  5987. @example
  5988. 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"
  5989. @end example
  5990. @item
  5991. Apply laplacian edge detector which includes diagonals:
  5992. @example
  5993. 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"
  5994. @end example
  5995. @item
  5996. Apply emboss:
  5997. @example
  5998. 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"
  5999. @end example
  6000. @end itemize
  6001. @section convolve
  6002. Apply 2D convolution of video stream in frequency domain using second stream
  6003. as impulse.
  6004. The filter accepts the following options:
  6005. @table @option
  6006. @item planes
  6007. Set which planes to process.
  6008. @item impulse
  6009. Set which impulse video frames will be processed, can be @var{first}
  6010. or @var{all}. Default is @var{all}.
  6011. @end table
  6012. The @code{convolve} filter also supports the @ref{framesync} options.
  6013. @section copy
  6014. Copy the input video source unchanged to the output. This is mainly useful for
  6015. testing purposes.
  6016. @anchor{coreimage}
  6017. @section coreimage
  6018. Video filtering on GPU using Apple's CoreImage API on OSX.
  6019. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6020. processed by video hardware. However, software-based OpenGL implementations
  6021. exist which means there is no guarantee for hardware processing. It depends on
  6022. the respective OSX.
  6023. There are many filters and image generators provided by Apple that come with a
  6024. large variety of options. The filter has to be referenced by its name along
  6025. with its options.
  6026. The coreimage filter accepts the following options:
  6027. @table @option
  6028. @item list_filters
  6029. List all available filters and generators along with all their respective
  6030. options as well as possible minimum and maximum values along with the default
  6031. values.
  6032. @example
  6033. list_filters=true
  6034. @end example
  6035. @item filter
  6036. Specify all filters by their respective name and options.
  6037. Use @var{list_filters} to determine all valid filter names and options.
  6038. Numerical options are specified by a float value and are automatically clamped
  6039. to their respective value range. Vector and color options have to be specified
  6040. by a list of space separated float values. Character escaping has to be done.
  6041. A special option name @code{default} is available to use default options for a
  6042. filter.
  6043. It is required to specify either @code{default} or at least one of the filter options.
  6044. All omitted options are used with their default values.
  6045. The syntax of the filter string is as follows:
  6046. @example
  6047. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6048. @end example
  6049. @item output_rect
  6050. Specify a rectangle where the output of the filter chain is copied into the
  6051. input image. It is given by a list of space separated float values:
  6052. @example
  6053. output_rect=x\ y\ width\ height
  6054. @end example
  6055. If not given, the output rectangle equals the dimensions of the input image.
  6056. The output rectangle is automatically cropped at the borders of the input
  6057. image. Negative values are valid for each component.
  6058. @example
  6059. output_rect=25\ 25\ 100\ 100
  6060. @end example
  6061. @end table
  6062. Several filters can be chained for successive processing without GPU-HOST
  6063. transfers allowing for fast processing of complex filter chains.
  6064. Currently, only filters with zero (generators) or exactly one (filters) input
  6065. image and one output image are supported. Also, transition filters are not yet
  6066. usable as intended.
  6067. Some filters generate output images with additional padding depending on the
  6068. respective filter kernel. The padding is automatically removed to ensure the
  6069. filter output has the same size as the input image.
  6070. For image generators, the size of the output image is determined by the
  6071. previous output image of the filter chain or the input image of the whole
  6072. filterchain, respectively. The generators do not use the pixel information of
  6073. this image to generate their output. However, the generated output is
  6074. blended onto this image, resulting in partial or complete coverage of the
  6075. output image.
  6076. The @ref{coreimagesrc} video source can be used for generating input images
  6077. which are directly fed into the filter chain. By using it, providing input
  6078. images by another video source or an input video is not required.
  6079. @subsection Examples
  6080. @itemize
  6081. @item
  6082. List all filters available:
  6083. @example
  6084. coreimage=list_filters=true
  6085. @end example
  6086. @item
  6087. Use the CIBoxBlur filter with default options to blur an image:
  6088. @example
  6089. coreimage=filter=CIBoxBlur@@default
  6090. @end example
  6091. @item
  6092. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6093. its center at 100x100 and a radius of 50 pixels:
  6094. @example
  6095. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6096. @end example
  6097. @item
  6098. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6099. given as complete and escaped command-line for Apple's standard bash shell:
  6100. @example
  6101. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6102. @end example
  6103. @end itemize
  6104. @section cover_rect
  6105. Cover a rectangular object
  6106. It accepts the following options:
  6107. @table @option
  6108. @item cover
  6109. Filepath of the optional cover image, needs to be in yuv420.
  6110. @item mode
  6111. Set covering mode.
  6112. It accepts the following values:
  6113. @table @samp
  6114. @item cover
  6115. cover it by the supplied image
  6116. @item blur
  6117. cover it by interpolating the surrounding pixels
  6118. @end table
  6119. Default value is @var{blur}.
  6120. @end table
  6121. @subsection Examples
  6122. @itemize
  6123. @item
  6124. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6125. @example
  6126. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6127. @end example
  6128. @end itemize
  6129. @section crop
  6130. Crop the input video to given dimensions.
  6131. It accepts the following parameters:
  6132. @table @option
  6133. @item w, out_w
  6134. The width of the output video. It defaults to @code{iw}.
  6135. This expression is evaluated only once during the filter
  6136. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6137. @item h, out_h
  6138. The height of the output video. It defaults to @code{ih}.
  6139. This expression is evaluated only once during the filter
  6140. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6141. @item x
  6142. The horizontal position, in the input video, of the left edge of the output
  6143. video. It defaults to @code{(in_w-out_w)/2}.
  6144. This expression is evaluated per-frame.
  6145. @item y
  6146. The vertical position, in the input video, of the top edge of the output video.
  6147. It defaults to @code{(in_h-out_h)/2}.
  6148. This expression is evaluated per-frame.
  6149. @item keep_aspect
  6150. If set to 1 will force the output display aspect ratio
  6151. to be the same of the input, by changing the output sample aspect
  6152. ratio. It defaults to 0.
  6153. @item exact
  6154. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6155. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6156. It defaults to 0.
  6157. @end table
  6158. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6159. expressions containing the following constants:
  6160. @table @option
  6161. @item x
  6162. @item y
  6163. The computed values for @var{x} and @var{y}. They are evaluated for
  6164. each new frame.
  6165. @item in_w
  6166. @item in_h
  6167. The input width and height.
  6168. @item iw
  6169. @item ih
  6170. These are the same as @var{in_w} and @var{in_h}.
  6171. @item out_w
  6172. @item out_h
  6173. The output (cropped) width and height.
  6174. @item ow
  6175. @item oh
  6176. These are the same as @var{out_w} and @var{out_h}.
  6177. @item a
  6178. same as @var{iw} / @var{ih}
  6179. @item sar
  6180. input sample aspect ratio
  6181. @item dar
  6182. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6183. @item hsub
  6184. @item vsub
  6185. horizontal and vertical chroma subsample values. For example for the
  6186. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6187. @item n
  6188. The number of the input frame, starting from 0.
  6189. @item pos
  6190. the position in the file of the input frame, NAN if unknown
  6191. @item t
  6192. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6193. @end table
  6194. The expression for @var{out_w} may depend on the value of @var{out_h},
  6195. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6196. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6197. evaluated after @var{out_w} and @var{out_h}.
  6198. The @var{x} and @var{y} parameters specify the expressions for the
  6199. position of the top-left corner of the output (non-cropped) area. They
  6200. are evaluated for each frame. If the evaluated value is not valid, it
  6201. is approximated to the nearest valid value.
  6202. The expression for @var{x} may depend on @var{y}, and the expression
  6203. for @var{y} may depend on @var{x}.
  6204. @subsection Examples
  6205. @itemize
  6206. @item
  6207. Crop area with size 100x100 at position (12,34).
  6208. @example
  6209. crop=100:100:12:34
  6210. @end example
  6211. Using named options, the example above becomes:
  6212. @example
  6213. crop=w=100:h=100:x=12:y=34
  6214. @end example
  6215. @item
  6216. Crop the central input area with size 100x100:
  6217. @example
  6218. crop=100:100
  6219. @end example
  6220. @item
  6221. Crop the central input area with size 2/3 of the input video:
  6222. @example
  6223. crop=2/3*in_w:2/3*in_h
  6224. @end example
  6225. @item
  6226. Crop the input video central square:
  6227. @example
  6228. crop=out_w=in_h
  6229. crop=in_h
  6230. @end example
  6231. @item
  6232. Delimit the rectangle with the top-left corner placed at position
  6233. 100:100 and the right-bottom corner corresponding to the right-bottom
  6234. corner of the input image.
  6235. @example
  6236. crop=in_w-100:in_h-100:100:100
  6237. @end example
  6238. @item
  6239. Crop 10 pixels from the left and right borders, and 20 pixels from
  6240. the top and bottom borders
  6241. @example
  6242. crop=in_w-2*10:in_h-2*20
  6243. @end example
  6244. @item
  6245. Keep only the bottom right quarter of the input image:
  6246. @example
  6247. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6248. @end example
  6249. @item
  6250. Crop height for getting Greek harmony:
  6251. @example
  6252. crop=in_w:1/PHI*in_w
  6253. @end example
  6254. @item
  6255. Apply trembling effect:
  6256. @example
  6257. 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)
  6258. @end example
  6259. @item
  6260. Apply erratic camera effect depending on timestamp:
  6261. @example
  6262. 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)"
  6263. @end example
  6264. @item
  6265. Set x depending on the value of y:
  6266. @example
  6267. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6268. @end example
  6269. @end itemize
  6270. @subsection Commands
  6271. This filter supports the following commands:
  6272. @table @option
  6273. @item w, out_w
  6274. @item h, out_h
  6275. @item x
  6276. @item y
  6277. Set width/height of the output video and the horizontal/vertical position
  6278. in the input video.
  6279. The command accepts the same syntax of the corresponding option.
  6280. If the specified expression is not valid, it is kept at its current
  6281. value.
  6282. @end table
  6283. @section cropdetect
  6284. Auto-detect the crop size.
  6285. It calculates the necessary cropping parameters and prints the
  6286. recommended parameters via the logging system. The detected dimensions
  6287. correspond to the non-black area of the input video.
  6288. It accepts the following parameters:
  6289. @table @option
  6290. @item limit
  6291. Set higher black value threshold, which can be optionally specified
  6292. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6293. value greater to the set value is considered non-black. It defaults to 24.
  6294. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6295. on the bitdepth of the pixel format.
  6296. @item round
  6297. The value which the width/height should be divisible by. It defaults to
  6298. 16. The offset is automatically adjusted to center the video. Use 2 to
  6299. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6300. encoding to most video codecs.
  6301. @item reset_count, reset
  6302. Set the counter that determines after how many frames cropdetect will
  6303. reset the previously detected largest video area and start over to
  6304. detect the current optimal crop area. Default value is 0.
  6305. This can be useful when channel logos distort the video area. 0
  6306. indicates 'never reset', and returns the largest area encountered during
  6307. playback.
  6308. @end table
  6309. @anchor{cue}
  6310. @section cue
  6311. Delay video filtering until a given wallclock timestamp. The filter first
  6312. passes on @option{preroll} amount of frames, then it buffers at most
  6313. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6314. it forwards the buffered frames and also any subsequent frames coming in its
  6315. input.
  6316. The filter can be used synchronize the output of multiple ffmpeg processes for
  6317. realtime output devices like decklink. By putting the delay in the filtering
  6318. chain and pre-buffering frames the process can pass on data to output almost
  6319. immediately after the target wallclock timestamp is reached.
  6320. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6321. some use cases.
  6322. @table @option
  6323. @item cue
  6324. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6325. @item preroll
  6326. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6327. @item buffer
  6328. The maximum duration of content to buffer before waiting for the cue expressed
  6329. in seconds. Default is 0.
  6330. @end table
  6331. @anchor{curves}
  6332. @section curves
  6333. Apply color adjustments using curves.
  6334. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6335. component (red, green and blue) has its values defined by @var{N} key points
  6336. tied from each other using a smooth curve. The x-axis represents the pixel
  6337. values from the input frame, and the y-axis the new pixel values to be set for
  6338. the output frame.
  6339. By default, a component curve is defined by the two points @var{(0;0)} and
  6340. @var{(1;1)}. This creates a straight line where each original pixel value is
  6341. "adjusted" to its own value, which means no change to the image.
  6342. The filter allows you to redefine these two points and add some more. A new
  6343. curve (using a natural cubic spline interpolation) will be define to pass
  6344. smoothly through all these new coordinates. The new defined points needs to be
  6345. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6346. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6347. the vector spaces, the values will be clipped accordingly.
  6348. The filter accepts the following options:
  6349. @table @option
  6350. @item preset
  6351. Select one of the available color presets. This option can be used in addition
  6352. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6353. options takes priority on the preset values.
  6354. Available presets are:
  6355. @table @samp
  6356. @item none
  6357. @item color_negative
  6358. @item cross_process
  6359. @item darker
  6360. @item increase_contrast
  6361. @item lighter
  6362. @item linear_contrast
  6363. @item medium_contrast
  6364. @item negative
  6365. @item strong_contrast
  6366. @item vintage
  6367. @end table
  6368. Default is @code{none}.
  6369. @item master, m
  6370. Set the master key points. These points will define a second pass mapping. It
  6371. is sometimes called a "luminance" or "value" mapping. It can be used with
  6372. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6373. post-processing LUT.
  6374. @item red, r
  6375. Set the key points for the red component.
  6376. @item green, g
  6377. Set the key points for the green component.
  6378. @item blue, b
  6379. Set the key points for the blue component.
  6380. @item all
  6381. Set the key points for all components (not including master).
  6382. Can be used in addition to the other key points component
  6383. options. In this case, the unset component(s) will fallback on this
  6384. @option{all} setting.
  6385. @item psfile
  6386. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6387. @item plot
  6388. Save Gnuplot script of the curves in specified file.
  6389. @end table
  6390. To avoid some filtergraph syntax conflicts, each key points list need to be
  6391. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6392. @subsection Examples
  6393. @itemize
  6394. @item
  6395. Increase slightly the middle level of blue:
  6396. @example
  6397. curves=blue='0/0 0.5/0.58 1/1'
  6398. @end example
  6399. @item
  6400. Vintage effect:
  6401. @example
  6402. 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'
  6403. @end example
  6404. Here we obtain the following coordinates for each components:
  6405. @table @var
  6406. @item red
  6407. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6408. @item green
  6409. @code{(0;0) (0.50;0.48) (1;1)}
  6410. @item blue
  6411. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6412. @end table
  6413. @item
  6414. The previous example can also be achieved with the associated built-in preset:
  6415. @example
  6416. curves=preset=vintage
  6417. @end example
  6418. @item
  6419. Or simply:
  6420. @example
  6421. curves=vintage
  6422. @end example
  6423. @item
  6424. Use a Photoshop preset and redefine the points of the green component:
  6425. @example
  6426. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6427. @end example
  6428. @item
  6429. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6430. and @command{gnuplot}:
  6431. @example
  6432. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6433. gnuplot -p /tmp/curves.plt
  6434. @end example
  6435. @end itemize
  6436. @section datascope
  6437. Video data analysis filter.
  6438. This filter shows hexadecimal pixel values of part of video.
  6439. The filter accepts the following options:
  6440. @table @option
  6441. @item size, s
  6442. Set output video size.
  6443. @item x
  6444. Set x offset from where to pick pixels.
  6445. @item y
  6446. Set y offset from where to pick pixels.
  6447. @item mode
  6448. Set scope mode, can be one of the following:
  6449. @table @samp
  6450. @item mono
  6451. Draw hexadecimal pixel values with white color on black background.
  6452. @item color
  6453. Draw hexadecimal pixel values with input video pixel color on black
  6454. background.
  6455. @item color2
  6456. Draw hexadecimal pixel values on color background picked from input video,
  6457. the text color is picked in such way so its always visible.
  6458. @end table
  6459. @item axis
  6460. Draw rows and columns numbers on left and top of video.
  6461. @item opacity
  6462. Set background opacity.
  6463. @item format
  6464. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6465. @end table
  6466. @section dctdnoiz
  6467. Denoise frames using 2D DCT (frequency domain filtering).
  6468. This filter is not designed for real time.
  6469. The filter accepts the following options:
  6470. @table @option
  6471. @item sigma, s
  6472. Set the noise sigma constant.
  6473. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6474. coefficient (absolute value) below this threshold with be dropped.
  6475. If you need a more advanced filtering, see @option{expr}.
  6476. Default is @code{0}.
  6477. @item overlap
  6478. Set number overlapping pixels for each block. Since the filter can be slow, you
  6479. may want to reduce this value, at the cost of a less effective filter and the
  6480. risk of various artefacts.
  6481. If the overlapping value doesn't permit processing the whole input width or
  6482. height, a warning will be displayed and according borders won't be denoised.
  6483. Default value is @var{blocksize}-1, which is the best possible setting.
  6484. @item expr, e
  6485. Set the coefficient factor expression.
  6486. For each coefficient of a DCT block, this expression will be evaluated as a
  6487. multiplier value for the coefficient.
  6488. If this is option is set, the @option{sigma} option will be ignored.
  6489. The absolute value of the coefficient can be accessed through the @var{c}
  6490. variable.
  6491. @item n
  6492. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6493. @var{blocksize}, which is the width and height of the processed blocks.
  6494. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6495. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6496. on the speed processing. Also, a larger block size does not necessarily means a
  6497. better de-noising.
  6498. @end table
  6499. @subsection Examples
  6500. Apply a denoise with a @option{sigma} of @code{4.5}:
  6501. @example
  6502. dctdnoiz=4.5
  6503. @end example
  6504. The same operation can be achieved using the expression system:
  6505. @example
  6506. dctdnoiz=e='gte(c, 4.5*3)'
  6507. @end example
  6508. Violent denoise using a block size of @code{16x16}:
  6509. @example
  6510. dctdnoiz=15:n=4
  6511. @end example
  6512. @section deband
  6513. Remove banding artifacts from input video.
  6514. It works by replacing banded pixels with average value of referenced pixels.
  6515. The filter accepts the following options:
  6516. @table @option
  6517. @item 1thr
  6518. @item 2thr
  6519. @item 3thr
  6520. @item 4thr
  6521. Set banding detection threshold for each plane. Default is 0.02.
  6522. Valid range is 0.00003 to 0.5.
  6523. If difference between current pixel and reference pixel is less than threshold,
  6524. it will be considered as banded.
  6525. @item range, r
  6526. Banding detection range in pixels. Default is 16. If positive, random number
  6527. in range 0 to set value will be used. If negative, exact absolute value
  6528. will be used.
  6529. The range defines square of four pixels around current pixel.
  6530. @item direction, d
  6531. Set direction in radians from which four pixel will be compared. If positive,
  6532. random direction from 0 to set direction will be picked. If negative, exact of
  6533. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6534. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6535. column.
  6536. @item blur, b
  6537. If enabled, current pixel is compared with average value of all four
  6538. surrounding pixels. The default is enabled. If disabled current pixel is
  6539. compared with all four surrounding pixels. The pixel is considered banded
  6540. if only all four differences with surrounding pixels are less than threshold.
  6541. @item coupling, c
  6542. If enabled, current pixel is changed if and only if all pixel components are banded,
  6543. e.g. banding detection threshold is triggered for all color components.
  6544. The default is disabled.
  6545. @end table
  6546. @section deblock
  6547. Remove blocking artifacts from input video.
  6548. The filter accepts the following options:
  6549. @table @option
  6550. @item filter
  6551. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6552. This controls what kind of deblocking is applied.
  6553. @item block
  6554. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6555. @item alpha
  6556. @item beta
  6557. @item gamma
  6558. @item delta
  6559. Set blocking detection thresholds. Allowed range is 0 to 1.
  6560. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6561. Using higher threshold gives more deblocking strength.
  6562. Setting @var{alpha} controls threshold detection at exact edge of block.
  6563. Remaining options controls threshold detection near the edge. Each one for
  6564. below/above or left/right. Setting any of those to @var{0} disables
  6565. deblocking.
  6566. @item planes
  6567. Set planes to filter. Default is to filter all available planes.
  6568. @end table
  6569. @subsection Examples
  6570. @itemize
  6571. @item
  6572. Deblock using weak filter and block size of 4 pixels.
  6573. @example
  6574. deblock=filter=weak:block=4
  6575. @end example
  6576. @item
  6577. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6578. deblocking more edges.
  6579. @example
  6580. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6581. @end example
  6582. @item
  6583. Similar as above, but filter only first plane.
  6584. @example
  6585. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6586. @end example
  6587. @item
  6588. Similar as above, but filter only second and third plane.
  6589. @example
  6590. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6591. @end example
  6592. @end itemize
  6593. @anchor{decimate}
  6594. @section decimate
  6595. Drop duplicated frames at regular intervals.
  6596. The filter accepts the following options:
  6597. @table @option
  6598. @item cycle
  6599. Set the number of frames from which one will be dropped. Setting this to
  6600. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6601. Default is @code{5}.
  6602. @item dupthresh
  6603. Set the threshold for duplicate detection. If the difference metric for a frame
  6604. is less than or equal to this value, then it is declared as duplicate. Default
  6605. is @code{1.1}
  6606. @item scthresh
  6607. Set scene change threshold. Default is @code{15}.
  6608. @item blockx
  6609. @item blocky
  6610. Set the size of the x and y-axis blocks used during metric calculations.
  6611. Larger blocks give better noise suppression, but also give worse detection of
  6612. small movements. Must be a power of two. Default is @code{32}.
  6613. @item ppsrc
  6614. Mark main input as a pre-processed input and activate clean source input
  6615. stream. This allows the input to be pre-processed with various filters to help
  6616. the metrics calculation while keeping the frame selection lossless. When set to
  6617. @code{1}, the first stream is for the pre-processed input, and the second
  6618. stream is the clean source from where the kept frames are chosen. Default is
  6619. @code{0}.
  6620. @item chroma
  6621. Set whether or not chroma is considered in the metric calculations. Default is
  6622. @code{1}.
  6623. @end table
  6624. @section deconvolve
  6625. Apply 2D deconvolution of video stream in frequency domain using second stream
  6626. as impulse.
  6627. The filter accepts the following options:
  6628. @table @option
  6629. @item planes
  6630. Set which planes to process.
  6631. @item impulse
  6632. Set which impulse video frames will be processed, can be @var{first}
  6633. or @var{all}. Default is @var{all}.
  6634. @item noise
  6635. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6636. and height are not same and not power of 2 or if stream prior to convolving
  6637. had noise.
  6638. @end table
  6639. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6640. @section dedot
  6641. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6642. It accepts the following options:
  6643. @table @option
  6644. @item m
  6645. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6646. @var{rainbows} for cross-color reduction.
  6647. @item lt
  6648. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6649. @item tl
  6650. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6651. @item tc
  6652. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6653. @item ct
  6654. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6655. @end table
  6656. @section deflate
  6657. Apply deflate effect to the video.
  6658. This filter replaces the pixel by the local(3x3) average by taking into account
  6659. only values lower than the pixel.
  6660. It accepts the following options:
  6661. @table @option
  6662. @item threshold0
  6663. @item threshold1
  6664. @item threshold2
  6665. @item threshold3
  6666. Limit the maximum change for each plane, default is 65535.
  6667. If 0, plane will remain unchanged.
  6668. @end table
  6669. @subsection Commands
  6670. This filter supports the all above options as @ref{commands}.
  6671. @section deflicker
  6672. Remove temporal frame luminance variations.
  6673. It accepts the following options:
  6674. @table @option
  6675. @item size, s
  6676. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6677. @item mode, m
  6678. Set averaging mode to smooth temporal luminance variations.
  6679. Available values are:
  6680. @table @samp
  6681. @item am
  6682. Arithmetic mean
  6683. @item gm
  6684. Geometric mean
  6685. @item hm
  6686. Harmonic mean
  6687. @item qm
  6688. Quadratic mean
  6689. @item cm
  6690. Cubic mean
  6691. @item pm
  6692. Power mean
  6693. @item median
  6694. Median
  6695. @end table
  6696. @item bypass
  6697. Do not actually modify frame. Useful when one only wants metadata.
  6698. @end table
  6699. @section dejudder
  6700. Remove judder produced by partially interlaced telecined content.
  6701. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6702. source was partially telecined content then the output of @code{pullup,dejudder}
  6703. will have a variable frame rate. May change the recorded frame rate of the
  6704. container. Aside from that change, this filter will not affect constant frame
  6705. rate video.
  6706. The option available in this filter is:
  6707. @table @option
  6708. @item cycle
  6709. Specify the length of the window over which the judder repeats.
  6710. Accepts any integer greater than 1. Useful values are:
  6711. @table @samp
  6712. @item 4
  6713. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6714. @item 5
  6715. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6716. @item 20
  6717. If a mixture of the two.
  6718. @end table
  6719. The default is @samp{4}.
  6720. @end table
  6721. @section delogo
  6722. Suppress a TV station logo by a simple interpolation of the surrounding
  6723. pixels. Just set a rectangle covering the logo and watch it disappear
  6724. (and sometimes something even uglier appear - your mileage may vary).
  6725. It accepts the following parameters:
  6726. @table @option
  6727. @item x
  6728. @item y
  6729. Specify the top left corner coordinates of the logo. They must be
  6730. specified.
  6731. @item w
  6732. @item h
  6733. Specify the width and height of the logo to clear. They must be
  6734. specified.
  6735. @item band, t
  6736. Specify the thickness of the fuzzy edge of the rectangle (added to
  6737. @var{w} and @var{h}). The default value is 1. This option is
  6738. deprecated, setting higher values should no longer be necessary and
  6739. is not recommended.
  6740. @item show
  6741. When set to 1, a green rectangle is drawn on the screen to simplify
  6742. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6743. The default value is 0.
  6744. The rectangle is drawn on the outermost pixels which will be (partly)
  6745. replaced with interpolated values. The values of the next pixels
  6746. immediately outside this rectangle in each direction will be used to
  6747. compute the interpolated pixel values inside the rectangle.
  6748. @end table
  6749. @subsection Examples
  6750. @itemize
  6751. @item
  6752. Set a rectangle covering the area with top left corner coordinates 0,0
  6753. and size 100x77, and a band of size 10:
  6754. @example
  6755. delogo=x=0:y=0:w=100:h=77:band=10
  6756. @end example
  6757. @end itemize
  6758. @section derain
  6759. Remove the rain in the input image/video by applying the derain methods based on
  6760. convolutional neural networks. Supported models:
  6761. @itemize
  6762. @item
  6763. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6764. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6765. @end itemize
  6766. Training as well as model generation scripts are provided in
  6767. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6768. Native model files (.model) can be generated from TensorFlow model
  6769. files (.pb) by using tools/python/convert.py
  6770. The filter accepts the following options:
  6771. @table @option
  6772. @item filter_type
  6773. Specify which filter to use. This option accepts the following values:
  6774. @table @samp
  6775. @item derain
  6776. Derain filter. To conduct derain filter, you need to use a derain model.
  6777. @item dehaze
  6778. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6779. @end table
  6780. Default value is @samp{derain}.
  6781. @item dnn_backend
  6782. Specify which DNN backend to use for model loading and execution. This option accepts
  6783. the following values:
  6784. @table @samp
  6785. @item native
  6786. Native implementation of DNN loading and execution.
  6787. @item tensorflow
  6788. TensorFlow backend. To enable this backend you
  6789. need to install the TensorFlow for C library (see
  6790. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6791. @code{--enable-libtensorflow}
  6792. @end table
  6793. Default value is @samp{native}.
  6794. @item model
  6795. Set path to model file specifying network architecture and its parameters.
  6796. Note that different backends use different file formats. TensorFlow and native
  6797. backend can load files for only its format.
  6798. @end table
  6799. @section deshake
  6800. Attempt to fix small changes in horizontal and/or vertical shift. This
  6801. filter helps remove camera shake from hand-holding a camera, bumping a
  6802. tripod, moving on a vehicle, etc.
  6803. The filter accepts the following options:
  6804. @table @option
  6805. @item x
  6806. @item y
  6807. @item w
  6808. @item h
  6809. Specify a rectangular area where to limit the search for motion
  6810. vectors.
  6811. If desired the search for motion vectors can be limited to a
  6812. rectangular area of the frame defined by its top left corner, width
  6813. and height. These parameters have the same meaning as the drawbox
  6814. filter which can be used to visualise the position of the bounding
  6815. box.
  6816. This is useful when simultaneous movement of subjects within the frame
  6817. might be confused for camera motion by the motion vector search.
  6818. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6819. then the full frame is used. This allows later options to be set
  6820. without specifying the bounding box for the motion vector search.
  6821. Default - search the whole frame.
  6822. @item rx
  6823. @item ry
  6824. Specify the maximum extent of movement in x and y directions in the
  6825. range 0-64 pixels. Default 16.
  6826. @item edge
  6827. Specify how to generate pixels to fill blanks at the edge of the
  6828. frame. Available values are:
  6829. @table @samp
  6830. @item blank, 0
  6831. Fill zeroes at blank locations
  6832. @item original, 1
  6833. Original image at blank locations
  6834. @item clamp, 2
  6835. Extruded edge value at blank locations
  6836. @item mirror, 3
  6837. Mirrored edge at blank locations
  6838. @end table
  6839. Default value is @samp{mirror}.
  6840. @item blocksize
  6841. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6842. default 8.
  6843. @item contrast
  6844. Specify the contrast threshold for blocks. Only blocks with more than
  6845. the specified contrast (difference between darkest and lightest
  6846. pixels) will be considered. Range 1-255, default 125.
  6847. @item search
  6848. Specify the search strategy. Available values are:
  6849. @table @samp
  6850. @item exhaustive, 0
  6851. Set exhaustive search
  6852. @item less, 1
  6853. Set less exhaustive search.
  6854. @end table
  6855. Default value is @samp{exhaustive}.
  6856. @item filename
  6857. If set then a detailed log of the motion search is written to the
  6858. specified file.
  6859. @end table
  6860. @section despill
  6861. Remove unwanted contamination of foreground colors, caused by reflected color of
  6862. greenscreen or bluescreen.
  6863. This filter accepts the following options:
  6864. @table @option
  6865. @item type
  6866. Set what type of despill to use.
  6867. @item mix
  6868. Set how spillmap will be generated.
  6869. @item expand
  6870. Set how much to get rid of still remaining spill.
  6871. @item red
  6872. Controls amount of red in spill area.
  6873. @item green
  6874. Controls amount of green in spill area.
  6875. Should be -1 for greenscreen.
  6876. @item blue
  6877. Controls amount of blue in spill area.
  6878. Should be -1 for bluescreen.
  6879. @item brightness
  6880. Controls brightness of spill area, preserving colors.
  6881. @item alpha
  6882. Modify alpha from generated spillmap.
  6883. @end table
  6884. @section detelecine
  6885. Apply an exact inverse of the telecine operation. It requires a predefined
  6886. pattern specified using the pattern option which must be the same as that passed
  6887. to the telecine filter.
  6888. This filter accepts the following options:
  6889. @table @option
  6890. @item first_field
  6891. @table @samp
  6892. @item top, t
  6893. top field first
  6894. @item bottom, b
  6895. bottom field first
  6896. The default value is @code{top}.
  6897. @end table
  6898. @item pattern
  6899. A string of numbers representing the pulldown pattern you wish to apply.
  6900. The default value is @code{23}.
  6901. @item start_frame
  6902. A number representing position of the first frame with respect to the telecine
  6903. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6904. @end table
  6905. @section dilation
  6906. Apply dilation effect to the video.
  6907. This filter replaces the pixel by the local(3x3) maximum.
  6908. It accepts the following options:
  6909. @table @option
  6910. @item threshold0
  6911. @item threshold1
  6912. @item threshold2
  6913. @item threshold3
  6914. Limit the maximum change for each plane, default is 65535.
  6915. If 0, plane will remain unchanged.
  6916. @item coordinates
  6917. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6918. pixels are used.
  6919. Flags to local 3x3 coordinates maps like this:
  6920. 1 2 3
  6921. 4 5
  6922. 6 7 8
  6923. @end table
  6924. @subsection Commands
  6925. This filter supports the all above options as @ref{commands}.
  6926. @section displace
  6927. Displace pixels as indicated by second and third input stream.
  6928. It takes three input streams and outputs one stream, the first input is the
  6929. source, and second and third input are displacement maps.
  6930. The second input specifies how much to displace pixels along the
  6931. x-axis, while the third input specifies how much to displace pixels
  6932. along the y-axis.
  6933. If one of displacement map streams terminates, last frame from that
  6934. displacement map will be used.
  6935. Note that once generated, displacements maps can be reused over and over again.
  6936. A description of the accepted options follows.
  6937. @table @option
  6938. @item edge
  6939. Set displace behavior for pixels that are out of range.
  6940. Available values are:
  6941. @table @samp
  6942. @item blank
  6943. Missing pixels are replaced by black pixels.
  6944. @item smear
  6945. Adjacent pixels will spread out to replace missing pixels.
  6946. @item wrap
  6947. Out of range pixels are wrapped so they point to pixels of other side.
  6948. @item mirror
  6949. Out of range pixels will be replaced with mirrored pixels.
  6950. @end table
  6951. Default is @samp{smear}.
  6952. @end table
  6953. @subsection Examples
  6954. @itemize
  6955. @item
  6956. Add ripple effect to rgb input of video size hd720:
  6957. @example
  6958. 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
  6959. @end example
  6960. @item
  6961. Add wave effect to rgb input of video size hd720:
  6962. @example
  6963. 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
  6964. @end example
  6965. @end itemize
  6966. @section dnn_processing
  6967. Do image processing with deep neural networks. It works together with another filter
  6968. which converts the pixel format of the Frame to what the dnn network requires.
  6969. The filter accepts the following options:
  6970. @table @option
  6971. @item dnn_backend
  6972. Specify which DNN backend to use for model loading and execution. This option accepts
  6973. the following values:
  6974. @table @samp
  6975. @item native
  6976. Native implementation of DNN loading and execution.
  6977. @item tensorflow
  6978. TensorFlow backend. To enable this backend you
  6979. need to install the TensorFlow for C library (see
  6980. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6981. @code{--enable-libtensorflow}
  6982. @end table
  6983. Default value is @samp{native}.
  6984. @item model
  6985. Set path to model file specifying network architecture and its parameters.
  6986. Note that different backends use different file formats. TensorFlow and native
  6987. backend can load files for only its format.
  6988. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  6989. @item input
  6990. Set the input name of the dnn network.
  6991. @item output
  6992. Set the output name of the dnn network.
  6993. @end table
  6994. @itemize
  6995. @item
  6996. Halve the red channle of the frame with format rgb24:
  6997. @example
  6998. ffmpeg -i input.jpg -vf format=rgb24,dnn_processing=model=halve_first_channel.model:input=dnn_in:output=dnn_out:dnn_backend=native out.native.png
  6999. @end example
  7000. @item
  7001. Halve the pixel value of the frame with format gray32f:
  7002. @example
  7003. ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
  7004. @end example
  7005. @end itemize
  7006. @section drawbox
  7007. Draw a colored box on the input image.
  7008. It accepts the following parameters:
  7009. @table @option
  7010. @item x
  7011. @item y
  7012. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7013. @item width, w
  7014. @item height, h
  7015. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7016. the input width and height. It defaults to 0.
  7017. @item color, c
  7018. Specify the color of the box to write. For the general syntax of this option,
  7019. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7020. value @code{invert} is used, the box edge color is the same as the
  7021. video with inverted luma.
  7022. @item thickness, t
  7023. The expression which sets the thickness of the box edge.
  7024. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7025. See below for the list of accepted constants.
  7026. @item replace
  7027. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7028. will overwrite the video's color and alpha pixels.
  7029. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7030. @end table
  7031. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7032. following constants:
  7033. @table @option
  7034. @item dar
  7035. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7036. @item hsub
  7037. @item vsub
  7038. horizontal and vertical chroma subsample values. For example for the
  7039. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7040. @item in_h, ih
  7041. @item in_w, iw
  7042. The input width and height.
  7043. @item sar
  7044. The input sample aspect ratio.
  7045. @item x
  7046. @item y
  7047. The x and y offset coordinates where the box is drawn.
  7048. @item w
  7049. @item h
  7050. The width and height of the drawn box.
  7051. @item t
  7052. The thickness of the drawn box.
  7053. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7054. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7055. @end table
  7056. @subsection Examples
  7057. @itemize
  7058. @item
  7059. Draw a black box around the edge of the input image:
  7060. @example
  7061. drawbox
  7062. @end example
  7063. @item
  7064. Draw a box with color red and an opacity of 50%:
  7065. @example
  7066. drawbox=10:20:200:60:red@@0.5
  7067. @end example
  7068. The previous example can be specified as:
  7069. @example
  7070. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7071. @end example
  7072. @item
  7073. Fill the box with pink color:
  7074. @example
  7075. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7076. @end example
  7077. @item
  7078. Draw a 2-pixel red 2.40:1 mask:
  7079. @example
  7080. 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
  7081. @end example
  7082. @end itemize
  7083. @subsection Commands
  7084. This filter supports same commands as options.
  7085. The command accepts the same syntax of the corresponding option.
  7086. If the specified expression is not valid, it is kept at its current
  7087. value.
  7088. @anchor{drawgraph}
  7089. @section drawgraph
  7090. Draw a graph using input video metadata.
  7091. It accepts the following parameters:
  7092. @table @option
  7093. @item m1
  7094. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7095. @item fg1
  7096. Set 1st foreground color expression.
  7097. @item m2
  7098. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7099. @item fg2
  7100. Set 2nd foreground color expression.
  7101. @item m3
  7102. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7103. @item fg3
  7104. Set 3rd foreground color expression.
  7105. @item m4
  7106. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7107. @item fg4
  7108. Set 4th foreground color expression.
  7109. @item min
  7110. Set minimal value of metadata value.
  7111. @item max
  7112. Set maximal value of metadata value.
  7113. @item bg
  7114. Set graph background color. Default is white.
  7115. @item mode
  7116. Set graph mode.
  7117. Available values for mode is:
  7118. @table @samp
  7119. @item bar
  7120. @item dot
  7121. @item line
  7122. @end table
  7123. Default is @code{line}.
  7124. @item slide
  7125. Set slide mode.
  7126. Available values for slide is:
  7127. @table @samp
  7128. @item frame
  7129. Draw new frame when right border is reached.
  7130. @item replace
  7131. Replace old columns with new ones.
  7132. @item scroll
  7133. Scroll from right to left.
  7134. @item rscroll
  7135. Scroll from left to right.
  7136. @item picture
  7137. Draw single picture.
  7138. @end table
  7139. Default is @code{frame}.
  7140. @item size
  7141. Set size of graph video. For the syntax of this option, check the
  7142. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7143. The default value is @code{900x256}.
  7144. The foreground color expressions can use the following variables:
  7145. @table @option
  7146. @item MIN
  7147. Minimal value of metadata value.
  7148. @item MAX
  7149. Maximal value of metadata value.
  7150. @item VAL
  7151. Current metadata key value.
  7152. @end table
  7153. The color is defined as 0xAABBGGRR.
  7154. @end table
  7155. Example using metadata from @ref{signalstats} filter:
  7156. @example
  7157. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7158. @end example
  7159. Example using metadata from @ref{ebur128} filter:
  7160. @example
  7161. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7162. @end example
  7163. @section drawgrid
  7164. Draw a grid on the input image.
  7165. It accepts the following parameters:
  7166. @table @option
  7167. @item x
  7168. @item y
  7169. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7170. @item width, w
  7171. @item height, h
  7172. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7173. input width and height, respectively, minus @code{thickness}, so image gets
  7174. framed. Default to 0.
  7175. @item color, c
  7176. Specify the color of the grid. For the general syntax of this option,
  7177. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7178. value @code{invert} is used, the grid color is the same as the
  7179. video with inverted luma.
  7180. @item thickness, t
  7181. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7182. See below for the list of accepted constants.
  7183. @item replace
  7184. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7185. will overwrite the video's color and alpha pixels.
  7186. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7187. @end table
  7188. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7189. following constants:
  7190. @table @option
  7191. @item dar
  7192. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7193. @item hsub
  7194. @item vsub
  7195. horizontal and vertical chroma subsample values. For example for the
  7196. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7197. @item in_h, ih
  7198. @item in_w, iw
  7199. The input grid cell width and height.
  7200. @item sar
  7201. The input sample aspect ratio.
  7202. @item x
  7203. @item y
  7204. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7205. @item w
  7206. @item h
  7207. The width and height of the drawn cell.
  7208. @item t
  7209. The thickness of the drawn cell.
  7210. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7211. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7212. @end table
  7213. @subsection Examples
  7214. @itemize
  7215. @item
  7216. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7217. @example
  7218. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7219. @end example
  7220. @item
  7221. Draw a white 3x3 grid with an opacity of 50%:
  7222. @example
  7223. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7224. @end example
  7225. @end itemize
  7226. @subsection Commands
  7227. This filter supports same commands as options.
  7228. The command accepts the same syntax of the corresponding option.
  7229. If the specified expression is not valid, it is kept at its current
  7230. value.
  7231. @anchor{drawtext}
  7232. @section drawtext
  7233. Draw a text string or text from a specified file on top of a video, using the
  7234. libfreetype library.
  7235. To enable compilation of this filter, you need to configure FFmpeg with
  7236. @code{--enable-libfreetype}.
  7237. To enable default font fallback and the @var{font} option you need to
  7238. configure FFmpeg with @code{--enable-libfontconfig}.
  7239. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7240. @code{--enable-libfribidi}.
  7241. @subsection Syntax
  7242. It accepts the following parameters:
  7243. @table @option
  7244. @item box
  7245. Used to draw a box around text using the background color.
  7246. The value must be either 1 (enable) or 0 (disable).
  7247. The default value of @var{box} is 0.
  7248. @item boxborderw
  7249. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7250. The default value of @var{boxborderw} is 0.
  7251. @item boxcolor
  7252. The color to be used for drawing box around text. For the syntax of this
  7253. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7254. The default value of @var{boxcolor} is "white".
  7255. @item line_spacing
  7256. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7257. The default value of @var{line_spacing} is 0.
  7258. @item borderw
  7259. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7260. The default value of @var{borderw} is 0.
  7261. @item bordercolor
  7262. Set the color to be used for drawing border around text. For the syntax of this
  7263. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7264. The default value of @var{bordercolor} is "black".
  7265. @item expansion
  7266. Select how the @var{text} is expanded. Can be either @code{none},
  7267. @code{strftime} (deprecated) or
  7268. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7269. below for details.
  7270. @item basetime
  7271. Set a start time for the count. Value is in microseconds. Only applied
  7272. in the deprecated strftime expansion mode. To emulate in normal expansion
  7273. mode use the @code{pts} function, supplying the start time (in seconds)
  7274. as the second argument.
  7275. @item fix_bounds
  7276. If true, check and fix text coords to avoid clipping.
  7277. @item fontcolor
  7278. The color to be used for drawing fonts. For the syntax of this option, check
  7279. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7280. The default value of @var{fontcolor} is "black".
  7281. @item fontcolor_expr
  7282. String which is expanded the same way as @var{text} to obtain dynamic
  7283. @var{fontcolor} value. By default this option has empty value and is not
  7284. processed. When this option is set, it overrides @var{fontcolor} option.
  7285. @item font
  7286. The font family to be used for drawing text. By default Sans.
  7287. @item fontfile
  7288. The font file to be used for drawing text. The path must be included.
  7289. This parameter is mandatory if the fontconfig support is disabled.
  7290. @item alpha
  7291. Draw the text applying alpha blending. The value can
  7292. be a number between 0.0 and 1.0.
  7293. The expression accepts the same variables @var{x, y} as well.
  7294. The default value is 1.
  7295. Please see @var{fontcolor_expr}.
  7296. @item fontsize
  7297. The font size to be used for drawing text.
  7298. The default value of @var{fontsize} is 16.
  7299. @item text_shaping
  7300. If set to 1, attempt to shape the text (for example, reverse the order of
  7301. right-to-left text and join Arabic characters) before drawing it.
  7302. Otherwise, just draw the text exactly as given.
  7303. By default 1 (if supported).
  7304. @item ft_load_flags
  7305. The flags to be used for loading the fonts.
  7306. The flags map the corresponding flags supported by libfreetype, and are
  7307. a combination of the following values:
  7308. @table @var
  7309. @item default
  7310. @item no_scale
  7311. @item no_hinting
  7312. @item render
  7313. @item no_bitmap
  7314. @item vertical_layout
  7315. @item force_autohint
  7316. @item crop_bitmap
  7317. @item pedantic
  7318. @item ignore_global_advance_width
  7319. @item no_recurse
  7320. @item ignore_transform
  7321. @item monochrome
  7322. @item linear_design
  7323. @item no_autohint
  7324. @end table
  7325. Default value is "default".
  7326. For more information consult the documentation for the FT_LOAD_*
  7327. libfreetype flags.
  7328. @item shadowcolor
  7329. The color to be used for drawing a shadow behind the drawn text. For the
  7330. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7331. ffmpeg-utils manual,ffmpeg-utils}.
  7332. The default value of @var{shadowcolor} is "black".
  7333. @item shadowx
  7334. @item shadowy
  7335. The x and y offsets for the text shadow position with respect to the
  7336. position of the text. They can be either positive or negative
  7337. values. The default value for both is "0".
  7338. @item start_number
  7339. The starting frame number for the n/frame_num variable. The default value
  7340. is "0".
  7341. @item tabsize
  7342. The size in number of spaces to use for rendering the tab.
  7343. Default value is 4.
  7344. @item timecode
  7345. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7346. format. It can be used with or without text parameter. @var{timecode_rate}
  7347. option must be specified.
  7348. @item timecode_rate, rate, r
  7349. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7350. integer. Minimum value is "1".
  7351. Drop-frame timecode is supported for frame rates 30 & 60.
  7352. @item tc24hmax
  7353. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7354. Default is 0 (disabled).
  7355. @item text
  7356. The text string to be drawn. The text must be a sequence of UTF-8
  7357. encoded characters.
  7358. This parameter is mandatory if no file is specified with the parameter
  7359. @var{textfile}.
  7360. @item textfile
  7361. A text file containing text to be drawn. The text must be a sequence
  7362. of UTF-8 encoded characters.
  7363. This parameter is mandatory if no text string is specified with the
  7364. parameter @var{text}.
  7365. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7366. @item reload
  7367. If set to 1, the @var{textfile} will be reloaded before each frame.
  7368. Be sure to update it atomically, or it may be read partially, or even fail.
  7369. @item x
  7370. @item y
  7371. The expressions which specify the offsets where text will be drawn
  7372. within the video frame. They are relative to the top/left border of the
  7373. output image.
  7374. The default value of @var{x} and @var{y} is "0".
  7375. See below for the list of accepted constants and functions.
  7376. @end table
  7377. The parameters for @var{x} and @var{y} are expressions containing the
  7378. following constants and functions:
  7379. @table @option
  7380. @item dar
  7381. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7382. @item hsub
  7383. @item vsub
  7384. horizontal and vertical chroma subsample values. For example for the
  7385. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7386. @item line_h, lh
  7387. the height of each text line
  7388. @item main_h, h, H
  7389. the input height
  7390. @item main_w, w, W
  7391. the input width
  7392. @item max_glyph_a, ascent
  7393. the maximum distance from the baseline to the highest/upper grid
  7394. coordinate used to place a glyph outline point, for all the rendered
  7395. glyphs.
  7396. It is a positive value, due to the grid's orientation with the Y axis
  7397. upwards.
  7398. @item max_glyph_d, descent
  7399. the maximum distance from the baseline to the lowest grid coordinate
  7400. used to place a glyph outline point, for all the rendered glyphs.
  7401. This is a negative value, due to the grid's orientation, with the Y axis
  7402. upwards.
  7403. @item max_glyph_h
  7404. maximum glyph height, that is the maximum height for all the glyphs
  7405. contained in the rendered text, it is equivalent to @var{ascent} -
  7406. @var{descent}.
  7407. @item max_glyph_w
  7408. maximum glyph width, that is the maximum width for all the glyphs
  7409. contained in the rendered text
  7410. @item n
  7411. the number of input frame, starting from 0
  7412. @item rand(min, max)
  7413. return a random number included between @var{min} and @var{max}
  7414. @item sar
  7415. The input sample aspect ratio.
  7416. @item t
  7417. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7418. @item text_h, th
  7419. the height of the rendered text
  7420. @item text_w, tw
  7421. the width of the rendered text
  7422. @item x
  7423. @item y
  7424. the x and y offset coordinates where the text is drawn.
  7425. These parameters allow the @var{x} and @var{y} expressions to refer
  7426. to each other, so you can for example specify @code{y=x/dar}.
  7427. @item pict_type
  7428. A one character description of the current frame's picture type.
  7429. @item pkt_pos
  7430. The current packet's position in the input file or stream
  7431. (in bytes, from the start of the input). A value of -1 indicates
  7432. this info is not available.
  7433. @item pkt_duration
  7434. The current packet's duration, in seconds.
  7435. @item pkt_size
  7436. The current packet's size (in bytes).
  7437. @end table
  7438. @anchor{drawtext_expansion}
  7439. @subsection Text expansion
  7440. If @option{expansion} is set to @code{strftime},
  7441. the filter recognizes strftime() sequences in the provided text and
  7442. expands them accordingly. Check the documentation of strftime(). This
  7443. feature is deprecated.
  7444. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7445. If @option{expansion} is set to @code{normal} (which is the default),
  7446. the following expansion mechanism is used.
  7447. The backslash character @samp{\}, followed by any character, always expands to
  7448. the second character.
  7449. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7450. braces is a function name, possibly followed by arguments separated by ':'.
  7451. If the arguments contain special characters or delimiters (':' or '@}'),
  7452. they should be escaped.
  7453. Note that they probably must also be escaped as the value for the
  7454. @option{text} option in the filter argument string and as the filter
  7455. argument in the filtergraph description, and possibly also for the shell,
  7456. that makes up to four levels of escaping; using a text file avoids these
  7457. problems.
  7458. The following functions are available:
  7459. @table @command
  7460. @item expr, e
  7461. The expression evaluation result.
  7462. It must take one argument specifying the expression to be evaluated,
  7463. which accepts the same constants and functions as the @var{x} and
  7464. @var{y} values. Note that not all constants should be used, for
  7465. example the text size is not known when evaluating the expression, so
  7466. the constants @var{text_w} and @var{text_h} will have an undefined
  7467. value.
  7468. @item expr_int_format, eif
  7469. Evaluate the expression's value and output as formatted integer.
  7470. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7471. The second argument specifies the output format. Allowed values are @samp{x},
  7472. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7473. @code{printf} function.
  7474. The third parameter is optional and sets the number of positions taken by the output.
  7475. It can be used to add padding with zeros from the left.
  7476. @item gmtime
  7477. The time at which the filter is running, expressed in UTC.
  7478. It can accept an argument: a strftime() format string.
  7479. @item localtime
  7480. The time at which the filter is running, expressed in the local time zone.
  7481. It can accept an argument: a strftime() format string.
  7482. @item metadata
  7483. Frame metadata. Takes one or two arguments.
  7484. The first argument is mandatory and specifies the metadata key.
  7485. The second argument is optional and specifies a default value, used when the
  7486. metadata key is not found or empty.
  7487. Available metadata can be identified by inspecting entries
  7488. starting with TAG included within each frame section
  7489. printed by running @code{ffprobe -show_frames}.
  7490. String metadata generated in filters leading to
  7491. the drawtext filter are also available.
  7492. @item n, frame_num
  7493. The frame number, starting from 0.
  7494. @item pict_type
  7495. A one character description of the current picture type.
  7496. @item pts
  7497. The timestamp of the current frame.
  7498. It can take up to three arguments.
  7499. The first argument is the format of the timestamp; it defaults to @code{flt}
  7500. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7501. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7502. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7503. @code{localtime} stands for the timestamp of the frame formatted as
  7504. local time zone time.
  7505. The second argument is an offset added to the timestamp.
  7506. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7507. supplied to present the hour part of the formatted timestamp in 24h format
  7508. (00-23).
  7509. If the format is set to @code{localtime} or @code{gmtime},
  7510. a third argument may be supplied: a strftime() format string.
  7511. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7512. @end table
  7513. @subsection Commands
  7514. This filter supports altering parameters via commands:
  7515. @table @option
  7516. @item reinit
  7517. Alter existing filter parameters.
  7518. Syntax for the argument is the same as for filter invocation, e.g.
  7519. @example
  7520. fontsize=56:fontcolor=green:text='Hello World'
  7521. @end example
  7522. Full filter invocation with sendcmd would look like this:
  7523. @example
  7524. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7525. @end example
  7526. @end table
  7527. If the entire argument can't be parsed or applied as valid values then the filter will
  7528. continue with its existing parameters.
  7529. @subsection Examples
  7530. @itemize
  7531. @item
  7532. Draw "Test Text" with font FreeSerif, using the default values for the
  7533. optional parameters.
  7534. @example
  7535. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7536. @end example
  7537. @item
  7538. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7539. and y=50 (counting from the top-left corner of the screen), text is
  7540. yellow with a red box around it. Both the text and the box have an
  7541. opacity of 20%.
  7542. @example
  7543. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7544. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7545. @end example
  7546. Note that the double quotes are not necessary if spaces are not used
  7547. within the parameter list.
  7548. @item
  7549. Show the text at the center of the video frame:
  7550. @example
  7551. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7552. @end example
  7553. @item
  7554. Show the text at a random position, switching to a new position every 30 seconds:
  7555. @example
  7556. 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)"
  7557. @end example
  7558. @item
  7559. Show a text line sliding from right to left in the last row of the video
  7560. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7561. with no newlines.
  7562. @example
  7563. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7564. @end example
  7565. @item
  7566. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7567. @example
  7568. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7569. @end example
  7570. @item
  7571. Draw a single green letter "g", at the center of the input video.
  7572. The glyph baseline is placed at half screen height.
  7573. @example
  7574. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7575. @end example
  7576. @item
  7577. Show text for 1 second every 3 seconds:
  7578. @example
  7579. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7580. @end example
  7581. @item
  7582. Use fontconfig to set the font. Note that the colons need to be escaped.
  7583. @example
  7584. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7585. @end example
  7586. @item
  7587. Print the date of a real-time encoding (see strftime(3)):
  7588. @example
  7589. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7590. @end example
  7591. @item
  7592. Show text fading in and out (appearing/disappearing):
  7593. @example
  7594. #!/bin/sh
  7595. DS=1.0 # display start
  7596. DE=10.0 # display end
  7597. FID=1.5 # fade in duration
  7598. FOD=5 # fade out duration
  7599. 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 @}"
  7600. @end example
  7601. @item
  7602. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7603. and the @option{fontsize} value are included in the @option{y} offset.
  7604. @example
  7605. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7606. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7607. @end example
  7608. @item
  7609. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7610. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7611. must have option @option{-export_path_metadata 1} for the special metadata fields
  7612. to be available for filters.
  7613. @example
  7614. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7615. @end example
  7616. @end itemize
  7617. For more information about libfreetype, check:
  7618. @url{http://www.freetype.org/}.
  7619. For more information about fontconfig, check:
  7620. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7621. For more information about libfribidi, check:
  7622. @url{http://fribidi.org/}.
  7623. @section edgedetect
  7624. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7625. The filter accepts the following options:
  7626. @table @option
  7627. @item low
  7628. @item high
  7629. Set low and high threshold values used by the Canny thresholding
  7630. algorithm.
  7631. The high threshold selects the "strong" edge pixels, which are then
  7632. connected through 8-connectivity with the "weak" edge pixels selected
  7633. by the low threshold.
  7634. @var{low} and @var{high} threshold values must be chosen in the range
  7635. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7636. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7637. is @code{50/255}.
  7638. @item mode
  7639. Define the drawing mode.
  7640. @table @samp
  7641. @item wires
  7642. Draw white/gray wires on black background.
  7643. @item colormix
  7644. Mix the colors to create a paint/cartoon effect.
  7645. @item canny
  7646. Apply Canny edge detector on all selected planes.
  7647. @end table
  7648. Default value is @var{wires}.
  7649. @item planes
  7650. Select planes for filtering. By default all available planes are filtered.
  7651. @end table
  7652. @subsection Examples
  7653. @itemize
  7654. @item
  7655. Standard edge detection with custom values for the hysteresis thresholding:
  7656. @example
  7657. edgedetect=low=0.1:high=0.4
  7658. @end example
  7659. @item
  7660. Painting effect without thresholding:
  7661. @example
  7662. edgedetect=mode=colormix:high=0
  7663. @end example
  7664. @end itemize
  7665. @section elbg
  7666. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7667. For each input image, the filter will compute the optimal mapping from
  7668. the input to the output given the codebook length, that is the number
  7669. of distinct output colors.
  7670. This filter accepts the following options.
  7671. @table @option
  7672. @item codebook_length, l
  7673. Set codebook length. The value must be a positive integer, and
  7674. represents the number of distinct output colors. Default value is 256.
  7675. @item nb_steps, n
  7676. Set the maximum number of iterations to apply for computing the optimal
  7677. mapping. The higher the value the better the result and the higher the
  7678. computation time. Default value is 1.
  7679. @item seed, s
  7680. Set a random seed, must be an integer included between 0 and
  7681. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7682. will try to use a good random seed on a best effort basis.
  7683. @item pal8
  7684. Set pal8 output pixel format. This option does not work with codebook
  7685. length greater than 256.
  7686. @end table
  7687. @section entropy
  7688. Measure graylevel entropy in histogram of color channels of video frames.
  7689. It accepts the following parameters:
  7690. @table @option
  7691. @item mode
  7692. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7693. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7694. between neighbour histogram values.
  7695. @end table
  7696. @section eq
  7697. Set brightness, contrast, saturation and approximate gamma adjustment.
  7698. The filter accepts the following options:
  7699. @table @option
  7700. @item contrast
  7701. Set the contrast expression. The value must be a float value in range
  7702. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7703. @item brightness
  7704. Set the brightness expression. The value must be a float value in
  7705. range @code{-1.0} to @code{1.0}. The default value is "0".
  7706. @item saturation
  7707. Set the saturation expression. The value must be a float in
  7708. range @code{0.0} to @code{3.0}. The default value is "1".
  7709. @item gamma
  7710. Set the gamma expression. The value must be a float in range
  7711. @code{0.1} to @code{10.0}. The default value is "1".
  7712. @item gamma_r
  7713. Set the gamma expression for red. The value must be a float in
  7714. range @code{0.1} to @code{10.0}. The default value is "1".
  7715. @item gamma_g
  7716. Set the gamma expression for green. The value must be a float in range
  7717. @code{0.1} to @code{10.0}. The default value is "1".
  7718. @item gamma_b
  7719. Set the gamma expression for blue. The value must be a float in range
  7720. @code{0.1} to @code{10.0}. The default value is "1".
  7721. @item gamma_weight
  7722. Set the gamma weight expression. It can be used to reduce the effect
  7723. of a high gamma value on bright image areas, e.g. keep them from
  7724. getting overamplified and just plain white. The value must be a float
  7725. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7726. gamma correction all the way down while @code{1.0} leaves it at its
  7727. full strength. Default is "1".
  7728. @item eval
  7729. Set when the expressions for brightness, contrast, saturation and
  7730. gamma expressions are evaluated.
  7731. It accepts the following values:
  7732. @table @samp
  7733. @item init
  7734. only evaluate expressions once during the filter initialization or
  7735. when a command is processed
  7736. @item frame
  7737. evaluate expressions for each incoming frame
  7738. @end table
  7739. Default value is @samp{init}.
  7740. @end table
  7741. The expressions accept the following parameters:
  7742. @table @option
  7743. @item n
  7744. frame count of the input frame starting from 0
  7745. @item pos
  7746. byte position of the corresponding packet in the input file, NAN if
  7747. unspecified
  7748. @item r
  7749. frame rate of the input video, NAN if the input frame rate is unknown
  7750. @item t
  7751. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7752. @end table
  7753. @subsection Commands
  7754. The filter supports the following commands:
  7755. @table @option
  7756. @item contrast
  7757. Set the contrast expression.
  7758. @item brightness
  7759. Set the brightness expression.
  7760. @item saturation
  7761. Set the saturation expression.
  7762. @item gamma
  7763. Set the gamma expression.
  7764. @item gamma_r
  7765. Set the gamma_r expression.
  7766. @item gamma_g
  7767. Set gamma_g expression.
  7768. @item gamma_b
  7769. Set gamma_b expression.
  7770. @item gamma_weight
  7771. Set gamma_weight expression.
  7772. The command accepts the same syntax of the corresponding option.
  7773. If the specified expression is not valid, it is kept at its current
  7774. value.
  7775. @end table
  7776. @section erosion
  7777. Apply erosion effect to the video.
  7778. This filter replaces the pixel by the local(3x3) minimum.
  7779. It accepts the following options:
  7780. @table @option
  7781. @item threshold0
  7782. @item threshold1
  7783. @item threshold2
  7784. @item threshold3
  7785. Limit the maximum change for each plane, default is 65535.
  7786. If 0, plane will remain unchanged.
  7787. @item coordinates
  7788. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7789. pixels are used.
  7790. Flags to local 3x3 coordinates maps like this:
  7791. 1 2 3
  7792. 4 5
  7793. 6 7 8
  7794. @end table
  7795. @subsection Commands
  7796. This filter supports the all above options as @ref{commands}.
  7797. @section extractplanes
  7798. Extract color channel components from input video stream into
  7799. separate grayscale video streams.
  7800. The filter accepts the following option:
  7801. @table @option
  7802. @item planes
  7803. Set plane(s) to extract.
  7804. Available values for planes are:
  7805. @table @samp
  7806. @item y
  7807. @item u
  7808. @item v
  7809. @item a
  7810. @item r
  7811. @item g
  7812. @item b
  7813. @end table
  7814. Choosing planes not available in the input will result in an error.
  7815. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7816. with @code{y}, @code{u}, @code{v} planes at same time.
  7817. @end table
  7818. @subsection Examples
  7819. @itemize
  7820. @item
  7821. Extract luma, u and v color channel component from input video frame
  7822. into 3 grayscale outputs:
  7823. @example
  7824. 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
  7825. @end example
  7826. @end itemize
  7827. @section fade
  7828. Apply a fade-in/out effect to the input video.
  7829. It accepts the following parameters:
  7830. @table @option
  7831. @item type, t
  7832. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7833. effect.
  7834. Default is @code{in}.
  7835. @item start_frame, s
  7836. Specify the number of the frame to start applying the fade
  7837. effect at. Default is 0.
  7838. @item nb_frames, n
  7839. The number of frames that the fade effect lasts. At the end of the
  7840. fade-in effect, the output video will have the same intensity as the input video.
  7841. At the end of the fade-out transition, the output video will be filled with the
  7842. selected @option{color}.
  7843. Default is 25.
  7844. @item alpha
  7845. If set to 1, fade only alpha channel, if one exists on the input.
  7846. Default value is 0.
  7847. @item start_time, st
  7848. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7849. effect. If both start_frame and start_time are specified, the fade will start at
  7850. whichever comes last. Default is 0.
  7851. @item duration, d
  7852. The number of seconds for which the fade effect has to last. At the end of the
  7853. fade-in effect the output video will have the same intensity as the input video,
  7854. at the end of the fade-out transition the output video will be filled with the
  7855. selected @option{color}.
  7856. If both duration and nb_frames are specified, duration is used. Default is 0
  7857. (nb_frames is used by default).
  7858. @item color, c
  7859. Specify the color of the fade. Default is "black".
  7860. @end table
  7861. @subsection Examples
  7862. @itemize
  7863. @item
  7864. Fade in the first 30 frames of video:
  7865. @example
  7866. fade=in:0:30
  7867. @end example
  7868. The command above is equivalent to:
  7869. @example
  7870. fade=t=in:s=0:n=30
  7871. @end example
  7872. @item
  7873. Fade out the last 45 frames of a 200-frame video:
  7874. @example
  7875. fade=out:155:45
  7876. fade=type=out:start_frame=155:nb_frames=45
  7877. @end example
  7878. @item
  7879. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7880. @example
  7881. fade=in:0:25, fade=out:975:25
  7882. @end example
  7883. @item
  7884. Make the first 5 frames yellow, then fade in from frame 5-24:
  7885. @example
  7886. fade=in:5:20:color=yellow
  7887. @end example
  7888. @item
  7889. Fade in alpha over first 25 frames of video:
  7890. @example
  7891. fade=in:0:25:alpha=1
  7892. @end example
  7893. @item
  7894. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7895. @example
  7896. fade=t=in:st=5.5:d=0.5
  7897. @end example
  7898. @end itemize
  7899. @section fftdnoiz
  7900. Denoise frames using 3D FFT (frequency domain filtering).
  7901. The filter accepts the following options:
  7902. @table @option
  7903. @item sigma
  7904. Set the noise sigma constant. This sets denoising strength.
  7905. Default value is 1. Allowed range is from 0 to 30.
  7906. Using very high sigma with low overlap may give blocking artifacts.
  7907. @item amount
  7908. Set amount of denoising. By default all detected noise is reduced.
  7909. Default value is 1. Allowed range is from 0 to 1.
  7910. @item block
  7911. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7912. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7913. block size in pixels is 2^4 which is 16.
  7914. @item overlap
  7915. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7916. @item prev
  7917. Set number of previous frames to use for denoising. By default is set to 0.
  7918. @item next
  7919. Set number of next frames to to use for denoising. By default is set to 0.
  7920. @item planes
  7921. Set planes which will be filtered, by default are all available filtered
  7922. except alpha.
  7923. @end table
  7924. @section fftfilt
  7925. Apply arbitrary expressions to samples in frequency domain
  7926. @table @option
  7927. @item dc_Y
  7928. Adjust the dc value (gain) of the luma plane of the image. The filter
  7929. accepts an integer value in range @code{0} to @code{1000}. The default
  7930. value is set to @code{0}.
  7931. @item dc_U
  7932. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7933. filter accepts an integer value in range @code{0} to @code{1000}. The
  7934. default value is set to @code{0}.
  7935. @item dc_V
  7936. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7937. filter accepts an integer value in range @code{0} to @code{1000}. The
  7938. default value is set to @code{0}.
  7939. @item weight_Y
  7940. Set the frequency domain weight expression for the luma plane.
  7941. @item weight_U
  7942. Set the frequency domain weight expression for the 1st chroma plane.
  7943. @item weight_V
  7944. Set the frequency domain weight expression for the 2nd chroma plane.
  7945. @item eval
  7946. Set when the expressions are evaluated.
  7947. It accepts the following values:
  7948. @table @samp
  7949. @item init
  7950. Only evaluate expressions once during the filter initialization.
  7951. @item frame
  7952. Evaluate expressions for each incoming frame.
  7953. @end table
  7954. Default value is @samp{init}.
  7955. The filter accepts the following variables:
  7956. @item X
  7957. @item Y
  7958. The coordinates of the current sample.
  7959. @item W
  7960. @item H
  7961. The width and height of the image.
  7962. @item N
  7963. The number of input frame, starting from 0.
  7964. @end table
  7965. @subsection Examples
  7966. @itemize
  7967. @item
  7968. High-pass:
  7969. @example
  7970. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7971. @end example
  7972. @item
  7973. Low-pass:
  7974. @example
  7975. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7976. @end example
  7977. @item
  7978. Sharpen:
  7979. @example
  7980. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7981. @end example
  7982. @item
  7983. Blur:
  7984. @example
  7985. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7986. @end example
  7987. @end itemize
  7988. @section field
  7989. Extract a single field from an interlaced image using stride
  7990. arithmetic to avoid wasting CPU time. The output frames are marked as
  7991. non-interlaced.
  7992. The filter accepts the following options:
  7993. @table @option
  7994. @item type
  7995. Specify whether to extract the top (if the value is @code{0} or
  7996. @code{top}) or the bottom field (if the value is @code{1} or
  7997. @code{bottom}).
  7998. @end table
  7999. @section fieldhint
  8000. Create new frames by copying the top and bottom fields from surrounding frames
  8001. supplied as numbers by the hint file.
  8002. @table @option
  8003. @item hint
  8004. Set file containing hints: absolute/relative frame numbers.
  8005. There must be one line for each frame in a clip. Each line must contain two
  8006. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8007. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8008. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8009. for @code{relative} mode. First number tells from which frame to pick up top
  8010. field and second number tells from which frame to pick up bottom field.
  8011. If optionally followed by @code{+} output frame will be marked as interlaced,
  8012. else if followed by @code{-} output frame will be marked as progressive, else
  8013. it will be marked same as input frame.
  8014. If optionally followed by @code{t} output frame will use only top field, or in
  8015. case of @code{b} it will use only bottom field.
  8016. If line starts with @code{#} or @code{;} that line is skipped.
  8017. @item mode
  8018. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8019. @end table
  8020. Example of first several lines of @code{hint} file for @code{relative} mode:
  8021. @example
  8022. 0,0 - # first frame
  8023. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8024. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8025. 1,0 -
  8026. 0,0 -
  8027. 0,0 -
  8028. 1,0 -
  8029. 1,0 -
  8030. 1,0 -
  8031. 0,0 -
  8032. 0,0 -
  8033. 1,0 -
  8034. 1,0 -
  8035. 1,0 -
  8036. 0,0 -
  8037. @end example
  8038. @section fieldmatch
  8039. Field matching filter for inverse telecine. It is meant to reconstruct the
  8040. progressive frames from a telecined stream. The filter does not drop duplicated
  8041. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8042. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8043. The separation of the field matching and the decimation is notably motivated by
  8044. the possibility of inserting a de-interlacing filter fallback between the two.
  8045. If the source has mixed telecined and real interlaced content,
  8046. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8047. But these remaining combed frames will be marked as interlaced, and thus can be
  8048. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8049. In addition to the various configuration options, @code{fieldmatch} can take an
  8050. optional second stream, activated through the @option{ppsrc} option. If
  8051. enabled, the frames reconstruction will be based on the fields and frames from
  8052. this second stream. This allows the first input to be pre-processed in order to
  8053. help the various algorithms of the filter, while keeping the output lossless
  8054. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8055. or brightness/contrast adjustments can help.
  8056. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8057. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8058. which @code{fieldmatch} is based on. While the semantic and usage are very
  8059. close, some behaviour and options names can differ.
  8060. The @ref{decimate} filter currently only works for constant frame rate input.
  8061. If your input has mixed telecined (30fps) and progressive content with a lower
  8062. framerate like 24fps use the following filterchain to produce the necessary cfr
  8063. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8064. The filter accepts the following options:
  8065. @table @option
  8066. @item order
  8067. Specify the assumed field order of the input stream. Available values are:
  8068. @table @samp
  8069. @item auto
  8070. Auto detect parity (use FFmpeg's internal parity value).
  8071. @item bff
  8072. Assume bottom field first.
  8073. @item tff
  8074. Assume top field first.
  8075. @end table
  8076. Note that it is sometimes recommended not to trust the parity announced by the
  8077. stream.
  8078. Default value is @var{auto}.
  8079. @item mode
  8080. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8081. sense that it won't risk creating jerkiness due to duplicate frames when
  8082. possible, but if there are bad edits or blended fields it will end up
  8083. outputting combed frames when a good match might actually exist. On the other
  8084. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8085. but will almost always find a good frame if there is one. The other values are
  8086. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8087. jerkiness and creating duplicate frames versus finding good matches in sections
  8088. with bad edits, orphaned fields, blended fields, etc.
  8089. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8090. Available values are:
  8091. @table @samp
  8092. @item pc
  8093. 2-way matching (p/c)
  8094. @item pc_n
  8095. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8096. @item pc_u
  8097. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8098. @item pc_n_ub
  8099. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8100. still combed (p/c + n + u/b)
  8101. @item pcn
  8102. 3-way matching (p/c/n)
  8103. @item pcn_ub
  8104. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8105. detected as combed (p/c/n + u/b)
  8106. @end table
  8107. The parenthesis at the end indicate the matches that would be used for that
  8108. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8109. @var{top}).
  8110. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8111. the slowest.
  8112. Default value is @var{pc_n}.
  8113. @item ppsrc
  8114. Mark the main input stream as a pre-processed input, and enable the secondary
  8115. input stream as the clean source to pick the fields from. See the filter
  8116. introduction for more details. It is similar to the @option{clip2} feature from
  8117. VFM/TFM.
  8118. Default value is @code{0} (disabled).
  8119. @item field
  8120. Set the field to match from. It is recommended to set this to the same value as
  8121. @option{order} unless you experience matching failures with that setting. In
  8122. certain circumstances changing the field that is used to match from can have a
  8123. large impact on matching performance. Available values are:
  8124. @table @samp
  8125. @item auto
  8126. Automatic (same value as @option{order}).
  8127. @item bottom
  8128. Match from the bottom field.
  8129. @item top
  8130. Match from the top field.
  8131. @end table
  8132. Default value is @var{auto}.
  8133. @item mchroma
  8134. Set whether or not chroma is included during the match comparisons. In most
  8135. cases it is recommended to leave this enabled. You should set this to @code{0}
  8136. only if your clip has bad chroma problems such as heavy rainbowing or other
  8137. artifacts. Setting this to @code{0} could also be used to speed things up at
  8138. the cost of some accuracy.
  8139. Default value is @code{1}.
  8140. @item y0
  8141. @item y1
  8142. These define an exclusion band which excludes the lines between @option{y0} and
  8143. @option{y1} from being included in the field matching decision. An exclusion
  8144. band can be used to ignore subtitles, a logo, or other things that may
  8145. interfere with the matching. @option{y0} sets the starting scan line and
  8146. @option{y1} sets the ending line; all lines in between @option{y0} and
  8147. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8148. @option{y0} and @option{y1} to the same value will disable the feature.
  8149. @option{y0} and @option{y1} defaults to @code{0}.
  8150. @item scthresh
  8151. Set the scene change detection threshold as a percentage of maximum change on
  8152. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8153. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8154. @option{scthresh} is @code{[0.0, 100.0]}.
  8155. Default value is @code{12.0}.
  8156. @item combmatch
  8157. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8158. account the combed scores of matches when deciding what match to use as the
  8159. final match. Available values are:
  8160. @table @samp
  8161. @item none
  8162. No final matching based on combed scores.
  8163. @item sc
  8164. Combed scores are only used when a scene change is detected.
  8165. @item full
  8166. Use combed scores all the time.
  8167. @end table
  8168. Default is @var{sc}.
  8169. @item combdbg
  8170. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8171. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8172. Available values are:
  8173. @table @samp
  8174. @item none
  8175. No forced calculation.
  8176. @item pcn
  8177. Force p/c/n calculations.
  8178. @item pcnub
  8179. Force p/c/n/u/b calculations.
  8180. @end table
  8181. Default value is @var{none}.
  8182. @item cthresh
  8183. This is the area combing threshold used for combed frame detection. This
  8184. essentially controls how "strong" or "visible" combing must be to be detected.
  8185. Larger values mean combing must be more visible and smaller values mean combing
  8186. can be less visible or strong and still be detected. Valid settings are from
  8187. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8188. be detected as combed). This is basically a pixel difference value. A good
  8189. range is @code{[8, 12]}.
  8190. Default value is @code{9}.
  8191. @item chroma
  8192. Sets whether or not chroma is considered in the combed frame decision. Only
  8193. disable this if your source has chroma problems (rainbowing, etc.) that are
  8194. causing problems for the combed frame detection with chroma enabled. Actually,
  8195. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8196. where there is chroma only combing in the source.
  8197. Default value is @code{0}.
  8198. @item blockx
  8199. @item blocky
  8200. Respectively set the x-axis and y-axis size of the window used during combed
  8201. frame detection. This has to do with the size of the area in which
  8202. @option{combpel} pixels are required to be detected as combed for a frame to be
  8203. declared combed. See the @option{combpel} parameter description for more info.
  8204. Possible values are any number that is a power of 2 starting at 4 and going up
  8205. to 512.
  8206. Default value is @code{16}.
  8207. @item combpel
  8208. The number of combed pixels inside any of the @option{blocky} by
  8209. @option{blockx} size blocks on the frame for the frame to be detected as
  8210. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8211. setting controls "how much" combing there must be in any localized area (a
  8212. window defined by the @option{blockx} and @option{blocky} settings) on the
  8213. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8214. which point no frames will ever be detected as combed). This setting is known
  8215. as @option{MI} in TFM/VFM vocabulary.
  8216. Default value is @code{80}.
  8217. @end table
  8218. @anchor{p/c/n/u/b meaning}
  8219. @subsection p/c/n/u/b meaning
  8220. @subsubsection p/c/n
  8221. We assume the following telecined stream:
  8222. @example
  8223. Top fields: 1 2 2 3 4
  8224. Bottom fields: 1 2 3 4 4
  8225. @end example
  8226. The numbers correspond to the progressive frame the fields relate to. Here, the
  8227. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8228. When @code{fieldmatch} is configured to run a matching from bottom
  8229. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8230. @example
  8231. Input stream:
  8232. T 1 2 2 3 4
  8233. B 1 2 3 4 4 <-- matching reference
  8234. Matches: c c n n c
  8235. Output stream:
  8236. T 1 2 3 4 4
  8237. B 1 2 3 4 4
  8238. @end example
  8239. As a result of the field matching, we can see that some frames get duplicated.
  8240. To perform a complete inverse telecine, you need to rely on a decimation filter
  8241. after this operation. See for instance the @ref{decimate} filter.
  8242. The same operation now matching from top fields (@option{field}=@var{top})
  8243. looks like this:
  8244. @example
  8245. Input stream:
  8246. T 1 2 2 3 4 <-- matching reference
  8247. B 1 2 3 4 4
  8248. Matches: c c p p c
  8249. Output stream:
  8250. T 1 2 2 3 4
  8251. B 1 2 2 3 4
  8252. @end example
  8253. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8254. basically, they refer to the frame and field of the opposite parity:
  8255. @itemize
  8256. @item @var{p} matches the field of the opposite parity in the previous frame
  8257. @item @var{c} matches the field of the opposite parity in the current frame
  8258. @item @var{n} matches the field of the opposite parity in the next frame
  8259. @end itemize
  8260. @subsubsection u/b
  8261. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8262. from the opposite parity flag. In the following examples, we assume that we are
  8263. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8264. 'x' is placed above and below each matched fields.
  8265. With bottom matching (@option{field}=@var{bottom}):
  8266. @example
  8267. Match: c p n b u
  8268. x x x x x
  8269. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8270. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8271. x x x x x
  8272. Output frames:
  8273. 2 1 2 2 2
  8274. 2 2 2 1 3
  8275. @end example
  8276. With top matching (@option{field}=@var{top}):
  8277. @example
  8278. Match: c p n b u
  8279. x x x x x
  8280. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8281. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8282. x x x x x
  8283. Output frames:
  8284. 2 2 2 1 2
  8285. 2 1 3 2 2
  8286. @end example
  8287. @subsection Examples
  8288. Simple IVTC of a top field first telecined stream:
  8289. @example
  8290. fieldmatch=order=tff:combmatch=none, decimate
  8291. @end example
  8292. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8293. @example
  8294. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8295. @end example
  8296. @section fieldorder
  8297. Transform the field order of the input video.
  8298. It accepts the following parameters:
  8299. @table @option
  8300. @item order
  8301. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8302. for bottom field first.
  8303. @end table
  8304. The default value is @samp{tff}.
  8305. The transformation is done by shifting the picture content up or down
  8306. by one line, and filling the remaining line with appropriate picture content.
  8307. This method is consistent with most broadcast field order converters.
  8308. If the input video is not flagged as being interlaced, or it is already
  8309. flagged as being of the required output field order, then this filter does
  8310. not alter the incoming video.
  8311. It is very useful when converting to or from PAL DV material,
  8312. which is bottom field first.
  8313. For example:
  8314. @example
  8315. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8316. @end example
  8317. @section fifo, afifo
  8318. Buffer input images and send them when they are requested.
  8319. It is mainly useful when auto-inserted by the libavfilter
  8320. framework.
  8321. It does not take parameters.
  8322. @section fillborders
  8323. Fill borders of the input video, without changing video stream dimensions.
  8324. Sometimes video can have garbage at the four edges and you may not want to
  8325. crop video input to keep size multiple of some number.
  8326. This filter accepts the following options:
  8327. @table @option
  8328. @item left
  8329. Number of pixels to fill from left border.
  8330. @item right
  8331. Number of pixels to fill from right border.
  8332. @item top
  8333. Number of pixels to fill from top border.
  8334. @item bottom
  8335. Number of pixels to fill from bottom border.
  8336. @item mode
  8337. Set fill mode.
  8338. It accepts the following values:
  8339. @table @samp
  8340. @item smear
  8341. fill pixels using outermost pixels
  8342. @item mirror
  8343. fill pixels using mirroring
  8344. @item fixed
  8345. fill pixels with constant value
  8346. @end table
  8347. Default is @var{smear}.
  8348. @item color
  8349. Set color for pixels in fixed mode. Default is @var{black}.
  8350. @end table
  8351. @subsection Commands
  8352. This filter supports same @ref{commands} as options.
  8353. The command accepts the same syntax of the corresponding option.
  8354. If the specified expression is not valid, it is kept at its current
  8355. value.
  8356. @section find_rect
  8357. Find a rectangular object
  8358. It accepts the following options:
  8359. @table @option
  8360. @item object
  8361. Filepath of the object image, needs to be in gray8.
  8362. @item threshold
  8363. Detection threshold, default is 0.5.
  8364. @item mipmaps
  8365. Number of mipmaps, default is 3.
  8366. @item xmin, ymin, xmax, ymax
  8367. Specifies the rectangle in which to search.
  8368. @end table
  8369. @subsection Examples
  8370. @itemize
  8371. @item
  8372. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8373. @example
  8374. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8375. @end example
  8376. @end itemize
  8377. @section floodfill
  8378. Flood area with values of same pixel components with another values.
  8379. It accepts the following options:
  8380. @table @option
  8381. @item x
  8382. Set pixel x coordinate.
  8383. @item y
  8384. Set pixel y coordinate.
  8385. @item s0
  8386. Set source #0 component value.
  8387. @item s1
  8388. Set source #1 component value.
  8389. @item s2
  8390. Set source #2 component value.
  8391. @item s3
  8392. Set source #3 component value.
  8393. @item d0
  8394. Set destination #0 component value.
  8395. @item d1
  8396. Set destination #1 component value.
  8397. @item d2
  8398. Set destination #2 component value.
  8399. @item d3
  8400. Set destination #3 component value.
  8401. @end table
  8402. @anchor{format}
  8403. @section format
  8404. Convert the input video to one of the specified pixel formats.
  8405. Libavfilter will try to pick one that is suitable as input to
  8406. the next filter.
  8407. It accepts the following parameters:
  8408. @table @option
  8409. @item pix_fmts
  8410. A '|'-separated list of pixel format names, such as
  8411. "pix_fmts=yuv420p|monow|rgb24".
  8412. @end table
  8413. @subsection Examples
  8414. @itemize
  8415. @item
  8416. Convert the input video to the @var{yuv420p} format
  8417. @example
  8418. format=pix_fmts=yuv420p
  8419. @end example
  8420. Convert the input video to any of the formats in the list
  8421. @example
  8422. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8423. @end example
  8424. @end itemize
  8425. @anchor{fps}
  8426. @section fps
  8427. Convert the video to specified constant frame rate by duplicating or dropping
  8428. frames as necessary.
  8429. It accepts the following parameters:
  8430. @table @option
  8431. @item fps
  8432. The desired output frame rate. The default is @code{25}.
  8433. @item start_time
  8434. Assume the first PTS should be the given value, in seconds. This allows for
  8435. padding/trimming at the start of stream. By default, no assumption is made
  8436. about the first frame's expected PTS, so no padding or trimming is done.
  8437. For example, this could be set to 0 to pad the beginning with duplicates of
  8438. the first frame if a video stream starts after the audio stream or to trim any
  8439. frames with a negative PTS.
  8440. @item round
  8441. Timestamp (PTS) rounding method.
  8442. Possible values are:
  8443. @table @option
  8444. @item zero
  8445. round towards 0
  8446. @item inf
  8447. round away from 0
  8448. @item down
  8449. round towards -infinity
  8450. @item up
  8451. round towards +infinity
  8452. @item near
  8453. round to nearest
  8454. @end table
  8455. The default is @code{near}.
  8456. @item eof_action
  8457. Action performed when reading the last frame.
  8458. Possible values are:
  8459. @table @option
  8460. @item round
  8461. Use same timestamp rounding method as used for other frames.
  8462. @item pass
  8463. Pass through last frame if input duration has not been reached yet.
  8464. @end table
  8465. The default is @code{round}.
  8466. @end table
  8467. Alternatively, the options can be specified as a flat string:
  8468. @var{fps}[:@var{start_time}[:@var{round}]].
  8469. See also the @ref{setpts} filter.
  8470. @subsection Examples
  8471. @itemize
  8472. @item
  8473. A typical usage in order to set the fps to 25:
  8474. @example
  8475. fps=fps=25
  8476. @end example
  8477. @item
  8478. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8479. @example
  8480. fps=fps=film:round=near
  8481. @end example
  8482. @end itemize
  8483. @section framepack
  8484. Pack two different video streams into a stereoscopic video, setting proper
  8485. metadata on supported codecs. The two views should have the same size and
  8486. framerate and processing will stop when the shorter video ends. Please note
  8487. that you may conveniently adjust view properties with the @ref{scale} and
  8488. @ref{fps} filters.
  8489. It accepts the following parameters:
  8490. @table @option
  8491. @item format
  8492. The desired packing format. Supported values are:
  8493. @table @option
  8494. @item sbs
  8495. The views are next to each other (default).
  8496. @item tab
  8497. The views are on top of each other.
  8498. @item lines
  8499. The views are packed by line.
  8500. @item columns
  8501. The views are packed by column.
  8502. @item frameseq
  8503. The views are temporally interleaved.
  8504. @end table
  8505. @end table
  8506. Some examples:
  8507. @example
  8508. # Convert left and right views into a frame-sequential video
  8509. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8510. # Convert views into a side-by-side video with the same output resolution as the input
  8511. 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
  8512. @end example
  8513. @section framerate
  8514. Change the frame rate by interpolating new video output frames from the source
  8515. frames.
  8516. This filter is not designed to function correctly with interlaced media. If
  8517. you wish to change the frame rate of interlaced media then you are required
  8518. to deinterlace before this filter and re-interlace after this filter.
  8519. A description of the accepted options follows.
  8520. @table @option
  8521. @item fps
  8522. Specify the output frames per second. This option can also be specified
  8523. as a value alone. The default is @code{50}.
  8524. @item interp_start
  8525. Specify the start of a range where the output frame will be created as a
  8526. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8527. the default is @code{15}.
  8528. @item interp_end
  8529. Specify the end of a range where the output frame will be created as a
  8530. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8531. the default is @code{240}.
  8532. @item scene
  8533. Specify the level at which a scene change is detected as a value between
  8534. 0 and 100 to indicate a new scene; a low value reflects a low
  8535. probability for the current frame to introduce a new scene, while a higher
  8536. value means the current frame is more likely to be one.
  8537. The default is @code{8.2}.
  8538. @item flags
  8539. Specify flags influencing the filter process.
  8540. Available value for @var{flags} is:
  8541. @table @option
  8542. @item scene_change_detect, scd
  8543. Enable scene change detection using the value of the option @var{scene}.
  8544. This flag is enabled by default.
  8545. @end table
  8546. @end table
  8547. @section framestep
  8548. Select one frame every N-th frame.
  8549. This filter accepts the following option:
  8550. @table @option
  8551. @item step
  8552. Select frame after every @code{step} frames.
  8553. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8554. @end table
  8555. @section freezedetect
  8556. Detect frozen video.
  8557. This filter logs a message and sets frame metadata when it detects that the
  8558. input video has no significant change in content during a specified duration.
  8559. Video freeze detection calculates the mean average absolute difference of all
  8560. the components of video frames and compares it to a noise floor.
  8561. The printed times and duration are expressed in seconds. The
  8562. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8563. whose timestamp equals or exceeds the detection duration and it contains the
  8564. timestamp of the first frame of the freeze. The
  8565. @code{lavfi.freezedetect.freeze_duration} and
  8566. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8567. after the freeze.
  8568. The filter accepts the following options:
  8569. @table @option
  8570. @item noise, n
  8571. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8572. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8573. 0.001.
  8574. @item duration, d
  8575. Set freeze duration until notification (default is 2 seconds).
  8576. @end table
  8577. @anchor{frei0r}
  8578. @section frei0r
  8579. Apply a frei0r effect to the input video.
  8580. To enable the compilation of this filter, you need to install the frei0r
  8581. header and configure FFmpeg with @code{--enable-frei0r}.
  8582. It accepts the following parameters:
  8583. @table @option
  8584. @item filter_name
  8585. The name of the frei0r effect to load. If the environment variable
  8586. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8587. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8588. Otherwise, the standard frei0r paths are searched, in this order:
  8589. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8590. @file{/usr/lib/frei0r-1/}.
  8591. @item filter_params
  8592. A '|'-separated list of parameters to pass to the frei0r effect.
  8593. @end table
  8594. A frei0r effect parameter can be a boolean (its value is either
  8595. "y" or "n"), a double, a color (specified as
  8596. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8597. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8598. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8599. a position (specified as @var{X}/@var{Y}, where
  8600. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8601. The number and types of parameters depend on the loaded effect. If an
  8602. effect parameter is not specified, the default value is set.
  8603. @subsection Examples
  8604. @itemize
  8605. @item
  8606. Apply the distort0r effect, setting the first two double parameters:
  8607. @example
  8608. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8609. @end example
  8610. @item
  8611. Apply the colordistance effect, taking a color as the first parameter:
  8612. @example
  8613. frei0r=colordistance:0.2/0.3/0.4
  8614. frei0r=colordistance:violet
  8615. frei0r=colordistance:0x112233
  8616. @end example
  8617. @item
  8618. Apply the perspective effect, specifying the top left and top right image
  8619. positions:
  8620. @example
  8621. frei0r=perspective:0.2/0.2|0.8/0.2
  8622. @end example
  8623. @end itemize
  8624. For more information, see
  8625. @url{http://frei0r.dyne.org}
  8626. @section fspp
  8627. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8628. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8629. processing filter, one of them is performed once per block, not per pixel.
  8630. This allows for much higher speed.
  8631. The filter accepts the following options:
  8632. @table @option
  8633. @item quality
  8634. Set quality. This option defines the number of levels for averaging. It accepts
  8635. an integer in the range 4-5. Default value is @code{4}.
  8636. @item qp
  8637. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8638. If not set, the filter will use the QP from the video stream (if available).
  8639. @item strength
  8640. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8641. more details but also more artifacts, while higher values make the image smoother
  8642. but also blurrier. Default value is @code{0} − PSNR optimal.
  8643. @item use_bframe_qp
  8644. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8645. option may cause flicker since the B-Frames have often larger QP. Default is
  8646. @code{0} (not enabled).
  8647. @end table
  8648. @section gblur
  8649. Apply Gaussian blur filter.
  8650. The filter accepts the following options:
  8651. @table @option
  8652. @item sigma
  8653. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8654. @item steps
  8655. Set number of steps for Gaussian approximation. Default is @code{1}.
  8656. @item planes
  8657. Set which planes to filter. By default all planes are filtered.
  8658. @item sigmaV
  8659. Set vertical sigma, if negative it will be same as @code{sigma}.
  8660. Default is @code{-1}.
  8661. @end table
  8662. @subsection Commands
  8663. This filter supports same commands as options.
  8664. The command accepts the same syntax of the corresponding option.
  8665. If the specified expression is not valid, it is kept at its current
  8666. value.
  8667. @section geq
  8668. Apply generic equation to each pixel.
  8669. The filter accepts the following options:
  8670. @table @option
  8671. @item lum_expr, lum
  8672. Set the luminance expression.
  8673. @item cb_expr, cb
  8674. Set the chrominance blue expression.
  8675. @item cr_expr, cr
  8676. Set the chrominance red expression.
  8677. @item alpha_expr, a
  8678. Set the alpha expression.
  8679. @item red_expr, r
  8680. Set the red expression.
  8681. @item green_expr, g
  8682. Set the green expression.
  8683. @item blue_expr, b
  8684. Set the blue expression.
  8685. @end table
  8686. The colorspace is selected according to the specified options. If one
  8687. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8688. options is specified, the filter will automatically select a YCbCr
  8689. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8690. @option{blue_expr} options is specified, it will select an RGB
  8691. colorspace.
  8692. If one of the chrominance expression is not defined, it falls back on the other
  8693. one. If no alpha expression is specified it will evaluate to opaque value.
  8694. If none of chrominance expressions are specified, they will evaluate
  8695. to the luminance expression.
  8696. The expressions can use the following variables and functions:
  8697. @table @option
  8698. @item N
  8699. The sequential number of the filtered frame, starting from @code{0}.
  8700. @item X
  8701. @item Y
  8702. The coordinates of the current sample.
  8703. @item W
  8704. @item H
  8705. The width and height of the image.
  8706. @item SW
  8707. @item SH
  8708. Width and height scale depending on the currently filtered plane. It is the
  8709. ratio between the corresponding luma plane number of pixels and the current
  8710. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8711. @code{0.5,0.5} for chroma planes.
  8712. @item T
  8713. Time of the current frame, expressed in seconds.
  8714. @item p(x, y)
  8715. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8716. plane.
  8717. @item lum(x, y)
  8718. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8719. plane.
  8720. @item cb(x, y)
  8721. Return the value of the pixel at location (@var{x},@var{y}) of the
  8722. blue-difference chroma plane. Return 0 if there is no such plane.
  8723. @item cr(x, y)
  8724. Return the value of the pixel at location (@var{x},@var{y}) of the
  8725. red-difference chroma plane. Return 0 if there is no such plane.
  8726. @item r(x, y)
  8727. @item g(x, y)
  8728. @item b(x, y)
  8729. Return the value of the pixel at location (@var{x},@var{y}) of the
  8730. red/green/blue component. Return 0 if there is no such component.
  8731. @item alpha(x, y)
  8732. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8733. plane. Return 0 if there is no such plane.
  8734. @item interpolation
  8735. Set one of interpolation methods:
  8736. @table @option
  8737. @item nearest, n
  8738. @item bilinear, b
  8739. @end table
  8740. Default is bilinear.
  8741. @end table
  8742. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8743. automatically clipped to the closer edge.
  8744. @subsection Examples
  8745. @itemize
  8746. @item
  8747. Flip the image horizontally:
  8748. @example
  8749. geq=p(W-X\,Y)
  8750. @end example
  8751. @item
  8752. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8753. wavelength of 100 pixels:
  8754. @example
  8755. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8756. @end example
  8757. @item
  8758. Generate a fancy enigmatic moving light:
  8759. @example
  8760. 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
  8761. @end example
  8762. @item
  8763. Generate a quick emboss effect:
  8764. @example
  8765. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8766. @end example
  8767. @item
  8768. Modify RGB components depending on pixel position:
  8769. @example
  8770. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8771. @end example
  8772. @item
  8773. Create a radial gradient that is the same size as the input (also see
  8774. the @ref{vignette} filter):
  8775. @example
  8776. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8777. @end example
  8778. @end itemize
  8779. @section gradfun
  8780. Fix the banding artifacts that are sometimes introduced into nearly flat
  8781. regions by truncation to 8-bit color depth.
  8782. Interpolate the gradients that should go where the bands are, and
  8783. dither them.
  8784. It is designed for playback only. Do not use it prior to
  8785. lossy compression, because compression tends to lose the dither and
  8786. bring back the bands.
  8787. It accepts the following parameters:
  8788. @table @option
  8789. @item strength
  8790. The maximum amount by which the filter will change any one pixel. This is also
  8791. the threshold for detecting nearly flat regions. Acceptable values range from
  8792. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8793. valid range.
  8794. @item radius
  8795. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8796. gradients, but also prevents the filter from modifying the pixels near detailed
  8797. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8798. values will be clipped to the valid range.
  8799. @end table
  8800. Alternatively, the options can be specified as a flat string:
  8801. @var{strength}[:@var{radius}]
  8802. @subsection Examples
  8803. @itemize
  8804. @item
  8805. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8806. @example
  8807. gradfun=3.5:8
  8808. @end example
  8809. @item
  8810. Specify radius, omitting the strength (which will fall-back to the default
  8811. value):
  8812. @example
  8813. gradfun=radius=8
  8814. @end example
  8815. @end itemize
  8816. @anchor{graphmonitor}
  8817. @section graphmonitor
  8818. Show various filtergraph stats.
  8819. With this filter one can debug complete filtergraph.
  8820. Especially issues with links filling with queued frames.
  8821. The filter accepts the following options:
  8822. @table @option
  8823. @item size, s
  8824. Set video output size. Default is @var{hd720}.
  8825. @item opacity, o
  8826. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8827. @item mode, m
  8828. Set output mode, can be @var{fulll} or @var{compact}.
  8829. In @var{compact} mode only filters with some queued frames have displayed stats.
  8830. @item flags, f
  8831. Set flags which enable which stats are shown in video.
  8832. Available values for flags are:
  8833. @table @samp
  8834. @item queue
  8835. Display number of queued frames in each link.
  8836. @item frame_count_in
  8837. Display number of frames taken from filter.
  8838. @item frame_count_out
  8839. Display number of frames given out from filter.
  8840. @item pts
  8841. Display current filtered frame pts.
  8842. @item time
  8843. Display current filtered frame time.
  8844. @item timebase
  8845. Display time base for filter link.
  8846. @item format
  8847. Display used format for filter link.
  8848. @item size
  8849. Display video size or number of audio channels in case of audio used by filter link.
  8850. @item rate
  8851. Display video frame rate or sample rate in case of audio used by filter link.
  8852. @end table
  8853. @item rate, r
  8854. Set upper limit for video rate of output stream, Default value is @var{25}.
  8855. This guarantee that output video frame rate will not be higher than this value.
  8856. @end table
  8857. @section greyedge
  8858. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8859. and corrects the scene colors accordingly.
  8860. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8861. The filter accepts the following options:
  8862. @table @option
  8863. @item difford
  8864. The order of differentiation to be applied on the scene. Must be chosen in the range
  8865. [0,2] and default value is 1.
  8866. @item minknorm
  8867. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8868. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8869. max value instead of calculating Minkowski distance.
  8870. @item sigma
  8871. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8872. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8873. can't be equal to 0 if @var{difford} is greater than 0.
  8874. @end table
  8875. @subsection Examples
  8876. @itemize
  8877. @item
  8878. Grey Edge:
  8879. @example
  8880. greyedge=difford=1:minknorm=5:sigma=2
  8881. @end example
  8882. @item
  8883. Max Edge:
  8884. @example
  8885. greyedge=difford=1:minknorm=0:sigma=2
  8886. @end example
  8887. @end itemize
  8888. @anchor{haldclut}
  8889. @section haldclut
  8890. Apply a Hald CLUT to a video stream.
  8891. First input is the video stream to process, and second one is the Hald CLUT.
  8892. The Hald CLUT input can be a simple picture or a complete video stream.
  8893. The filter accepts the following options:
  8894. @table @option
  8895. @item shortest
  8896. Force termination when the shortest input terminates. Default is @code{0}.
  8897. @item repeatlast
  8898. Continue applying the last CLUT after the end of the stream. A value of
  8899. @code{0} disable the filter after the last frame of the CLUT is reached.
  8900. Default is @code{1}.
  8901. @end table
  8902. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8903. filters share the same internals).
  8904. This filter also supports the @ref{framesync} options.
  8905. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8906. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8907. @subsection Workflow examples
  8908. @subsubsection Hald CLUT video stream
  8909. Generate an identity Hald CLUT stream altered with various effects:
  8910. @example
  8911. 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
  8912. @end example
  8913. Note: make sure you use a lossless codec.
  8914. Then use it with @code{haldclut} to apply it on some random stream:
  8915. @example
  8916. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8917. @end example
  8918. The Hald CLUT will be applied to the 10 first seconds (duration of
  8919. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8920. to the remaining frames of the @code{mandelbrot} stream.
  8921. @subsubsection Hald CLUT with preview
  8922. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8923. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8924. biggest possible square starting at the top left of the picture. The remaining
  8925. padding pixels (bottom or right) will be ignored. This area can be used to add
  8926. a preview of the Hald CLUT.
  8927. Typically, the following generated Hald CLUT will be supported by the
  8928. @code{haldclut} filter:
  8929. @example
  8930. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8931. pad=iw+320 [padded_clut];
  8932. smptebars=s=320x256, split [a][b];
  8933. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8934. [main][b] overlay=W-320" -frames:v 1 clut.png
  8935. @end example
  8936. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8937. bars are displayed on the right-top, and below the same color bars processed by
  8938. the color changes.
  8939. Then, the effect of this Hald CLUT can be visualized with:
  8940. @example
  8941. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8942. @end example
  8943. @section hflip
  8944. Flip the input video horizontally.
  8945. For example, to horizontally flip the input video with @command{ffmpeg}:
  8946. @example
  8947. ffmpeg -i in.avi -vf "hflip" out.avi
  8948. @end example
  8949. @section histeq
  8950. This filter applies a global color histogram equalization on a
  8951. per-frame basis.
  8952. It can be used to correct video that has a compressed range of pixel
  8953. intensities. The filter redistributes the pixel intensities to
  8954. equalize their distribution across the intensity range. It may be
  8955. viewed as an "automatically adjusting contrast filter". This filter is
  8956. useful only for correcting degraded or poorly captured source
  8957. video.
  8958. The filter accepts the following options:
  8959. @table @option
  8960. @item strength
  8961. Determine the amount of equalization to be applied. As the strength
  8962. is reduced, the distribution of pixel intensities more-and-more
  8963. approaches that of the input frame. The value must be a float number
  8964. in the range [0,1] and defaults to 0.200.
  8965. @item intensity
  8966. Set the maximum intensity that can generated and scale the output
  8967. values appropriately. The strength should be set as desired and then
  8968. the intensity can be limited if needed to avoid washing-out. The value
  8969. must be a float number in the range [0,1] and defaults to 0.210.
  8970. @item antibanding
  8971. Set the antibanding level. If enabled the filter will randomly vary
  8972. the luminance of output pixels by a small amount to avoid banding of
  8973. the histogram. Possible values are @code{none}, @code{weak} or
  8974. @code{strong}. It defaults to @code{none}.
  8975. @end table
  8976. @anchor{histogram}
  8977. @section histogram
  8978. Compute and draw a color distribution histogram for the input video.
  8979. The computed histogram is a representation of the color component
  8980. distribution in an image.
  8981. Standard histogram displays the color components distribution in an image.
  8982. Displays color graph for each color component. Shows distribution of
  8983. the Y, U, V, A or R, G, B components, depending on input format, in the
  8984. current frame. Below each graph a color component scale meter is shown.
  8985. The filter accepts the following options:
  8986. @table @option
  8987. @item level_height
  8988. Set height of level. Default value is @code{200}.
  8989. Allowed range is [50, 2048].
  8990. @item scale_height
  8991. Set height of color scale. Default value is @code{12}.
  8992. Allowed range is [0, 40].
  8993. @item display_mode
  8994. Set display mode.
  8995. It accepts the following values:
  8996. @table @samp
  8997. @item stack
  8998. Per color component graphs are placed below each other.
  8999. @item parade
  9000. Per color component graphs are placed side by side.
  9001. @item overlay
  9002. Presents information identical to that in the @code{parade}, except
  9003. that the graphs representing color components are superimposed directly
  9004. over one another.
  9005. @end table
  9006. Default is @code{stack}.
  9007. @item levels_mode
  9008. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9009. Default is @code{linear}.
  9010. @item components
  9011. Set what color components to display.
  9012. Default is @code{7}.
  9013. @item fgopacity
  9014. Set foreground opacity. Default is @code{0.7}.
  9015. @item bgopacity
  9016. Set background opacity. Default is @code{0.5}.
  9017. @end table
  9018. @subsection Examples
  9019. @itemize
  9020. @item
  9021. Calculate and draw histogram:
  9022. @example
  9023. ffplay -i input -vf histogram
  9024. @end example
  9025. @end itemize
  9026. @anchor{hqdn3d}
  9027. @section hqdn3d
  9028. This is a high precision/quality 3d denoise filter. It aims to reduce
  9029. image noise, producing smooth images and making still images really
  9030. still. It should enhance compressibility.
  9031. It accepts the following optional parameters:
  9032. @table @option
  9033. @item luma_spatial
  9034. A non-negative floating point number which specifies spatial luma strength.
  9035. It defaults to 4.0.
  9036. @item chroma_spatial
  9037. A non-negative floating point number which specifies spatial chroma strength.
  9038. It defaults to 3.0*@var{luma_spatial}/4.0.
  9039. @item luma_tmp
  9040. A floating point number which specifies luma temporal strength. It defaults to
  9041. 6.0*@var{luma_spatial}/4.0.
  9042. @item chroma_tmp
  9043. A floating point number which specifies chroma temporal strength. It defaults to
  9044. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9045. @end table
  9046. @subsection Commands
  9047. This filter supports same @ref{commands} as options.
  9048. The command accepts the same syntax of the corresponding option.
  9049. If the specified expression is not valid, it is kept at its current
  9050. value.
  9051. @anchor{hwdownload}
  9052. @section hwdownload
  9053. Download hardware frames to system memory.
  9054. The input must be in hardware frames, and the output a non-hardware format.
  9055. Not all formats will be supported on the output - it may be necessary to insert
  9056. an additional @option{format} filter immediately following in the graph to get
  9057. the output in a supported format.
  9058. @section hwmap
  9059. Map hardware frames to system memory or to another device.
  9060. This filter has several different modes of operation; which one is used depends
  9061. on the input and output formats:
  9062. @itemize
  9063. @item
  9064. Hardware frame input, normal frame output
  9065. Map the input frames to system memory and pass them to the output. If the
  9066. original hardware frame is later required (for example, after overlaying
  9067. something else on part of it), the @option{hwmap} filter can be used again
  9068. in the next mode to retrieve it.
  9069. @item
  9070. Normal frame input, hardware frame output
  9071. If the input is actually a software-mapped hardware frame, then unmap it -
  9072. that is, return the original hardware frame.
  9073. Otherwise, a device must be provided. Create new hardware surfaces on that
  9074. device for the output, then map them back to the software format at the input
  9075. and give those frames to the preceding filter. This will then act like the
  9076. @option{hwupload} filter, but may be able to avoid an additional copy when
  9077. the input is already in a compatible format.
  9078. @item
  9079. Hardware frame input and output
  9080. A device must be supplied for the output, either directly or with the
  9081. @option{derive_device} option. The input and output devices must be of
  9082. different types and compatible - the exact meaning of this is
  9083. system-dependent, but typically it means that they must refer to the same
  9084. underlying hardware context (for example, refer to the same graphics card).
  9085. If the input frames were originally created on the output device, then unmap
  9086. to retrieve the original frames.
  9087. Otherwise, map the frames to the output device - create new hardware frames
  9088. on the output corresponding to the frames on the input.
  9089. @end itemize
  9090. The following additional parameters are accepted:
  9091. @table @option
  9092. @item mode
  9093. Set the frame mapping mode. Some combination of:
  9094. @table @var
  9095. @item read
  9096. The mapped frame should be readable.
  9097. @item write
  9098. The mapped frame should be writeable.
  9099. @item overwrite
  9100. The mapping will always overwrite the entire frame.
  9101. This may improve performance in some cases, as the original contents of the
  9102. frame need not be loaded.
  9103. @item direct
  9104. The mapping must not involve any copying.
  9105. Indirect mappings to copies of frames are created in some cases where either
  9106. direct mapping is not possible or it would have unexpected properties.
  9107. Setting this flag ensures that the mapping is direct and will fail if that is
  9108. not possible.
  9109. @end table
  9110. Defaults to @var{read+write} if not specified.
  9111. @item derive_device @var{type}
  9112. Rather than using the device supplied at initialisation, instead derive a new
  9113. device of type @var{type} from the device the input frames exist on.
  9114. @item reverse
  9115. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9116. and map them back to the source. This may be necessary in some cases where
  9117. a mapping in one direction is required but only the opposite direction is
  9118. supported by the devices being used.
  9119. This option is dangerous - it may break the preceding filter in undefined
  9120. ways if there are any additional constraints on that filter's output.
  9121. Do not use it without fully understanding the implications of its use.
  9122. @end table
  9123. @anchor{hwupload}
  9124. @section hwupload
  9125. Upload system memory frames to hardware surfaces.
  9126. The device to upload to must be supplied when the filter is initialised. If
  9127. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9128. option.
  9129. @anchor{hwupload_cuda}
  9130. @section hwupload_cuda
  9131. Upload system memory frames to a CUDA device.
  9132. It accepts the following optional parameters:
  9133. @table @option
  9134. @item device
  9135. The number of the CUDA device to use
  9136. @end table
  9137. @section hqx
  9138. Apply a high-quality magnification filter designed for pixel art. This filter
  9139. was originally created by Maxim Stepin.
  9140. It accepts the following option:
  9141. @table @option
  9142. @item n
  9143. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9144. @code{hq3x} and @code{4} for @code{hq4x}.
  9145. Default is @code{3}.
  9146. @end table
  9147. @section hstack
  9148. Stack input videos horizontally.
  9149. All streams must be of same pixel format and of same height.
  9150. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9151. to create same output.
  9152. The filter accepts the following option:
  9153. @table @option
  9154. @item inputs
  9155. Set number of input streams. Default is 2.
  9156. @item shortest
  9157. If set to 1, force the output to terminate when the shortest input
  9158. terminates. Default value is 0.
  9159. @end table
  9160. @section hue
  9161. Modify the hue and/or the saturation of the input.
  9162. It accepts the following parameters:
  9163. @table @option
  9164. @item h
  9165. Specify the hue angle as a number of degrees. It accepts an expression,
  9166. and defaults to "0".
  9167. @item s
  9168. Specify the saturation in the [-10,10] range. It accepts an expression and
  9169. defaults to "1".
  9170. @item H
  9171. Specify the hue angle as a number of radians. It accepts an
  9172. expression, and defaults to "0".
  9173. @item b
  9174. Specify the brightness in the [-10,10] range. It accepts an expression and
  9175. defaults to "0".
  9176. @end table
  9177. @option{h} and @option{H} are mutually exclusive, and can't be
  9178. specified at the same time.
  9179. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9180. expressions containing the following constants:
  9181. @table @option
  9182. @item n
  9183. frame count of the input frame starting from 0
  9184. @item pts
  9185. presentation timestamp of the input frame expressed in time base units
  9186. @item r
  9187. frame rate of the input video, NAN if the input frame rate is unknown
  9188. @item t
  9189. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9190. @item tb
  9191. time base of the input video
  9192. @end table
  9193. @subsection Examples
  9194. @itemize
  9195. @item
  9196. Set the hue to 90 degrees and the saturation to 1.0:
  9197. @example
  9198. hue=h=90:s=1
  9199. @end example
  9200. @item
  9201. Same command but expressing the hue in radians:
  9202. @example
  9203. hue=H=PI/2:s=1
  9204. @end example
  9205. @item
  9206. Rotate hue and make the saturation swing between 0
  9207. and 2 over a period of 1 second:
  9208. @example
  9209. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9210. @end example
  9211. @item
  9212. Apply a 3 seconds saturation fade-in effect starting at 0:
  9213. @example
  9214. hue="s=min(t/3\,1)"
  9215. @end example
  9216. The general fade-in expression can be written as:
  9217. @example
  9218. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9219. @end example
  9220. @item
  9221. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9222. @example
  9223. hue="s=max(0\, min(1\, (8-t)/3))"
  9224. @end example
  9225. The general fade-out expression can be written as:
  9226. @example
  9227. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9228. @end example
  9229. @end itemize
  9230. @subsection Commands
  9231. This filter supports the following commands:
  9232. @table @option
  9233. @item b
  9234. @item s
  9235. @item h
  9236. @item H
  9237. Modify the hue and/or the saturation and/or brightness of the input video.
  9238. The command accepts the same syntax of the corresponding option.
  9239. If the specified expression is not valid, it is kept at its current
  9240. value.
  9241. @end table
  9242. @section hysteresis
  9243. Grow first stream into second stream by connecting components.
  9244. This makes it possible to build more robust edge masks.
  9245. This filter accepts the following options:
  9246. @table @option
  9247. @item planes
  9248. Set which planes will be processed as bitmap, unprocessed planes will be
  9249. copied from first stream.
  9250. By default value 0xf, all planes will be processed.
  9251. @item threshold
  9252. Set threshold which is used in filtering. If pixel component value is higher than
  9253. this value filter algorithm for connecting components is activated.
  9254. By default value is 0.
  9255. @end table
  9256. @section idet
  9257. Detect video interlacing type.
  9258. This filter tries to detect if the input frames are interlaced, progressive,
  9259. top or bottom field first. It will also try to detect fields that are
  9260. repeated between adjacent frames (a sign of telecine).
  9261. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9262. Multiple frame detection incorporates the classification history of previous frames.
  9263. The filter will log these metadata values:
  9264. @table @option
  9265. @item single.current_frame
  9266. Detected type of current frame using single-frame detection. One of:
  9267. ``tff'' (top field first), ``bff'' (bottom field first),
  9268. ``progressive'', or ``undetermined''
  9269. @item single.tff
  9270. Cumulative number of frames detected as top field first using single-frame detection.
  9271. @item multiple.tff
  9272. Cumulative number of frames detected as top field first using multiple-frame detection.
  9273. @item single.bff
  9274. Cumulative number of frames detected as bottom field first using single-frame detection.
  9275. @item multiple.current_frame
  9276. Detected type of current frame using multiple-frame detection. One of:
  9277. ``tff'' (top field first), ``bff'' (bottom field first),
  9278. ``progressive'', or ``undetermined''
  9279. @item multiple.bff
  9280. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9281. @item single.progressive
  9282. Cumulative number of frames detected as progressive using single-frame detection.
  9283. @item multiple.progressive
  9284. Cumulative number of frames detected as progressive using multiple-frame detection.
  9285. @item single.undetermined
  9286. Cumulative number of frames that could not be classified using single-frame detection.
  9287. @item multiple.undetermined
  9288. Cumulative number of frames that could not be classified using multiple-frame detection.
  9289. @item repeated.current_frame
  9290. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9291. @item repeated.neither
  9292. Cumulative number of frames with no repeated field.
  9293. @item repeated.top
  9294. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9295. @item repeated.bottom
  9296. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9297. @end table
  9298. The filter accepts the following options:
  9299. @table @option
  9300. @item intl_thres
  9301. Set interlacing threshold.
  9302. @item prog_thres
  9303. Set progressive threshold.
  9304. @item rep_thres
  9305. Threshold for repeated field detection.
  9306. @item half_life
  9307. Number of frames after which a given frame's contribution to the
  9308. statistics is halved (i.e., it contributes only 0.5 to its
  9309. classification). The default of 0 means that all frames seen are given
  9310. full weight of 1.0 forever.
  9311. @item analyze_interlaced_flag
  9312. When this is not 0 then idet will use the specified number of frames to determine
  9313. if the interlaced flag is accurate, it will not count undetermined frames.
  9314. If the flag is found to be accurate it will be used without any further
  9315. computations, if it is found to be inaccurate it will be cleared without any
  9316. further computations. This allows inserting the idet filter as a low computational
  9317. method to clean up the interlaced flag
  9318. @end table
  9319. @section il
  9320. Deinterleave or interleave fields.
  9321. This filter allows one to process interlaced images fields without
  9322. deinterlacing them. Deinterleaving splits the input frame into 2
  9323. fields (so called half pictures). Odd lines are moved to the top
  9324. half of the output image, even lines to the bottom half.
  9325. You can process (filter) them independently and then re-interleave them.
  9326. The filter accepts the following options:
  9327. @table @option
  9328. @item luma_mode, l
  9329. @item chroma_mode, c
  9330. @item alpha_mode, a
  9331. Available values for @var{luma_mode}, @var{chroma_mode} and
  9332. @var{alpha_mode} are:
  9333. @table @samp
  9334. @item none
  9335. Do nothing.
  9336. @item deinterleave, d
  9337. Deinterleave fields, placing one above the other.
  9338. @item interleave, i
  9339. Interleave fields. Reverse the effect of deinterleaving.
  9340. @end table
  9341. Default value is @code{none}.
  9342. @item luma_swap, ls
  9343. @item chroma_swap, cs
  9344. @item alpha_swap, as
  9345. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9346. @end table
  9347. @subsection Commands
  9348. This filter supports the all above options as @ref{commands}.
  9349. @section inflate
  9350. Apply inflate effect to the video.
  9351. This filter replaces the pixel by the local(3x3) average by taking into account
  9352. only values higher than the pixel.
  9353. It accepts the following options:
  9354. @table @option
  9355. @item threshold0
  9356. @item threshold1
  9357. @item threshold2
  9358. @item threshold3
  9359. Limit the maximum change for each plane, default is 65535.
  9360. If 0, plane will remain unchanged.
  9361. @end table
  9362. @subsection Commands
  9363. This filter supports the all above options as @ref{commands}.
  9364. @section interlace
  9365. Simple interlacing filter from progressive contents. This interleaves upper (or
  9366. lower) lines from odd frames with lower (or upper) lines from even frames,
  9367. halving the frame rate and preserving image height.
  9368. @example
  9369. Original Original New Frame
  9370. Frame 'j' Frame 'j+1' (tff)
  9371. ========== =========== ==================
  9372. Line 0 --------------------> Frame 'j' Line 0
  9373. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9374. Line 2 ---------------------> Frame 'j' Line 2
  9375. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9376. ... ... ...
  9377. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9378. @end example
  9379. It accepts the following optional parameters:
  9380. @table @option
  9381. @item scan
  9382. This determines whether the interlaced frame is taken from the even
  9383. (tff - default) or odd (bff) lines of the progressive frame.
  9384. @item lowpass
  9385. Vertical lowpass filter to avoid twitter interlacing and
  9386. reduce moire patterns.
  9387. @table @samp
  9388. @item 0, off
  9389. Disable vertical lowpass filter
  9390. @item 1, linear
  9391. Enable linear filter (default)
  9392. @item 2, complex
  9393. Enable complex filter. This will slightly less reduce twitter and moire
  9394. but better retain detail and subjective sharpness impression.
  9395. @end table
  9396. @end table
  9397. @section kerndeint
  9398. Deinterlace input video by applying Donald Graft's adaptive kernel
  9399. deinterling. Work on interlaced parts of a video to produce
  9400. progressive frames.
  9401. The description of the accepted parameters follows.
  9402. @table @option
  9403. @item thresh
  9404. Set the threshold which affects the filter's tolerance when
  9405. determining if a pixel line must be processed. It must be an integer
  9406. in the range [0,255] and defaults to 10. A value of 0 will result in
  9407. applying the process on every pixels.
  9408. @item map
  9409. Paint pixels exceeding the threshold value to white if set to 1.
  9410. Default is 0.
  9411. @item order
  9412. Set the fields order. Swap fields if set to 1, leave fields alone if
  9413. 0. Default is 0.
  9414. @item sharp
  9415. Enable additional sharpening if set to 1. Default is 0.
  9416. @item twoway
  9417. Enable twoway sharpening if set to 1. Default is 0.
  9418. @end table
  9419. @subsection Examples
  9420. @itemize
  9421. @item
  9422. Apply default values:
  9423. @example
  9424. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9425. @end example
  9426. @item
  9427. Enable additional sharpening:
  9428. @example
  9429. kerndeint=sharp=1
  9430. @end example
  9431. @item
  9432. Paint processed pixels in white:
  9433. @example
  9434. kerndeint=map=1
  9435. @end example
  9436. @end itemize
  9437. @section lagfun
  9438. Slowly update darker pixels.
  9439. This filter makes short flashes of light appear longer.
  9440. This filter accepts the following options:
  9441. @table @option
  9442. @item decay
  9443. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9444. @item planes
  9445. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9446. @end table
  9447. @section lenscorrection
  9448. Correct radial lens distortion
  9449. This filter can be used to correct for radial distortion as can result from the use
  9450. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9451. one can use tools available for example as part of opencv or simply trial-and-error.
  9452. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9453. and extract the k1 and k2 coefficients from the resulting matrix.
  9454. Note that effectively the same filter is available in the open-source tools Krita and
  9455. Digikam from the KDE project.
  9456. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9457. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9458. brightness distribution, so you may want to use both filters together in certain
  9459. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9460. be applied before or after lens correction.
  9461. @subsection Options
  9462. The filter accepts the following options:
  9463. @table @option
  9464. @item cx
  9465. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9466. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9467. width. Default is 0.5.
  9468. @item cy
  9469. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9470. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9471. height. Default is 0.5.
  9472. @item k1
  9473. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9474. no correction. Default is 0.
  9475. @item k2
  9476. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9477. 0 means no correction. Default is 0.
  9478. @end table
  9479. The formula that generates the correction is:
  9480. @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)
  9481. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9482. distances from the focal point in the source and target images, respectively.
  9483. @section lensfun
  9484. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9485. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9486. to apply the lens correction. The filter will load the lensfun database and
  9487. query it to find the corresponding camera and lens entries in the database. As
  9488. long as these entries can be found with the given options, the filter can
  9489. perform corrections on frames. Note that incomplete strings will result in the
  9490. filter choosing the best match with the given options, and the filter will
  9491. output the chosen camera and lens models (logged with level "info"). You must
  9492. provide the make, camera model, and lens model as they are required.
  9493. The filter accepts the following options:
  9494. @table @option
  9495. @item make
  9496. The make of the camera (for example, "Canon"). This option is required.
  9497. @item model
  9498. The model of the camera (for example, "Canon EOS 100D"). This option is
  9499. required.
  9500. @item lens_model
  9501. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9502. option is required.
  9503. @item mode
  9504. The type of correction to apply. The following values are valid options:
  9505. @table @samp
  9506. @item vignetting
  9507. Enables fixing lens vignetting.
  9508. @item geometry
  9509. Enables fixing lens geometry. This is the default.
  9510. @item subpixel
  9511. Enables fixing chromatic aberrations.
  9512. @item vig_geo
  9513. Enables fixing lens vignetting and lens geometry.
  9514. @item vig_subpixel
  9515. Enables fixing lens vignetting and chromatic aberrations.
  9516. @item distortion
  9517. Enables fixing both lens geometry and chromatic aberrations.
  9518. @item all
  9519. Enables all possible corrections.
  9520. @end table
  9521. @item focal_length
  9522. The focal length of the image/video (zoom; expected constant for video). For
  9523. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9524. range should be chosen when using that lens. Default 18.
  9525. @item aperture
  9526. The aperture of the image/video (expected constant for video). Note that
  9527. aperture is only used for vignetting correction. Default 3.5.
  9528. @item focus_distance
  9529. The focus distance of the image/video (expected constant for video). Note that
  9530. focus distance is only used for vignetting and only slightly affects the
  9531. vignetting correction process. If unknown, leave it at the default value (which
  9532. is 1000).
  9533. @item scale
  9534. The scale factor which is applied after transformation. After correction the
  9535. video is no longer necessarily rectangular. This parameter controls how much of
  9536. the resulting image is visible. The value 0 means that a value will be chosen
  9537. automatically such that there is little or no unmapped area in the output
  9538. image. 1.0 means that no additional scaling is done. Lower values may result
  9539. in more of the corrected image being visible, while higher values may avoid
  9540. unmapped areas in the output.
  9541. @item target_geometry
  9542. The target geometry of the output image/video. The following values are valid
  9543. options:
  9544. @table @samp
  9545. @item rectilinear (default)
  9546. @item fisheye
  9547. @item panoramic
  9548. @item equirectangular
  9549. @item fisheye_orthographic
  9550. @item fisheye_stereographic
  9551. @item fisheye_equisolid
  9552. @item fisheye_thoby
  9553. @end table
  9554. @item reverse
  9555. Apply the reverse of image correction (instead of correcting distortion, apply
  9556. it).
  9557. @item interpolation
  9558. The type of interpolation used when correcting distortion. The following values
  9559. are valid options:
  9560. @table @samp
  9561. @item nearest
  9562. @item linear (default)
  9563. @item lanczos
  9564. @end table
  9565. @end table
  9566. @subsection Examples
  9567. @itemize
  9568. @item
  9569. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9570. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9571. aperture of "8.0".
  9572. @example
  9573. 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
  9574. @end example
  9575. @item
  9576. Apply the same as before, but only for the first 5 seconds of video.
  9577. @example
  9578. 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
  9579. @end example
  9580. @end itemize
  9581. @section libvmaf
  9582. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9583. score between two input videos.
  9584. The obtained VMAF score is printed through the logging system.
  9585. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9586. After installing the library it can be enabled using:
  9587. @code{./configure --enable-libvmaf --enable-version3}.
  9588. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9589. The filter has following options:
  9590. @table @option
  9591. @item model_path
  9592. Set the model path which is to be used for SVM.
  9593. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9594. @item log_path
  9595. Set the file path to be used to store logs.
  9596. @item log_fmt
  9597. Set the format of the log file (xml or json).
  9598. @item enable_transform
  9599. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9600. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9601. Default value: @code{false}
  9602. @item phone_model
  9603. Invokes the phone model which will generate VMAF scores higher than in the
  9604. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9605. Default value: @code{false}
  9606. @item psnr
  9607. Enables computing psnr along with vmaf.
  9608. Default value: @code{false}
  9609. @item ssim
  9610. Enables computing ssim along with vmaf.
  9611. Default value: @code{false}
  9612. @item ms_ssim
  9613. Enables computing ms_ssim along with vmaf.
  9614. Default value: @code{false}
  9615. @item pool
  9616. Set the pool method to be used for computing vmaf.
  9617. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9618. @item n_threads
  9619. Set number of threads to be used when computing vmaf.
  9620. Default value: @code{0}, which makes use of all available logical processors.
  9621. @item n_subsample
  9622. Set interval for frame subsampling used when computing vmaf.
  9623. Default value: @code{1}
  9624. @item enable_conf_interval
  9625. Enables confidence interval.
  9626. Default value: @code{false}
  9627. @end table
  9628. This filter also supports the @ref{framesync} options.
  9629. @subsection Examples
  9630. @itemize
  9631. @item
  9632. On the below examples the input file @file{main.mpg} being processed is
  9633. compared with the reference file @file{ref.mpg}.
  9634. @example
  9635. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9636. @end example
  9637. @item
  9638. Example with options:
  9639. @example
  9640. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9641. @end example
  9642. @item
  9643. Example with options and different containers:
  9644. @example
  9645. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]libvmaf=psnr=1:log_fmt=json" -f null -
  9646. @end example
  9647. @end itemize
  9648. @section limiter
  9649. Limits the pixel components values to the specified range [min, max].
  9650. The filter accepts the following options:
  9651. @table @option
  9652. @item min
  9653. Lower bound. Defaults to the lowest allowed value for the input.
  9654. @item max
  9655. Upper bound. Defaults to the highest allowed value for the input.
  9656. @item planes
  9657. Specify which planes will be processed. Defaults to all available.
  9658. @end table
  9659. @section loop
  9660. Loop video frames.
  9661. The filter accepts the following options:
  9662. @table @option
  9663. @item loop
  9664. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9665. Default is 0.
  9666. @item size
  9667. Set maximal size in number of frames. Default is 0.
  9668. @item start
  9669. Set first frame of loop. Default is 0.
  9670. @end table
  9671. @subsection Examples
  9672. @itemize
  9673. @item
  9674. Loop single first frame infinitely:
  9675. @example
  9676. loop=loop=-1:size=1:start=0
  9677. @end example
  9678. @item
  9679. Loop single first frame 10 times:
  9680. @example
  9681. loop=loop=10:size=1:start=0
  9682. @end example
  9683. @item
  9684. Loop 10 first frames 5 times:
  9685. @example
  9686. loop=loop=5:size=10:start=0
  9687. @end example
  9688. @end itemize
  9689. @section lut1d
  9690. Apply a 1D LUT to an input video.
  9691. The filter accepts the following options:
  9692. @table @option
  9693. @item file
  9694. Set the 1D LUT file name.
  9695. Currently supported formats:
  9696. @table @samp
  9697. @item cube
  9698. Iridas
  9699. @item csp
  9700. cineSpace
  9701. @end table
  9702. @item interp
  9703. Select interpolation mode.
  9704. Available values are:
  9705. @table @samp
  9706. @item nearest
  9707. Use values from the nearest defined point.
  9708. @item linear
  9709. Interpolate values using the linear interpolation.
  9710. @item cosine
  9711. Interpolate values using the cosine interpolation.
  9712. @item cubic
  9713. Interpolate values using the cubic interpolation.
  9714. @item spline
  9715. Interpolate values using the spline interpolation.
  9716. @end table
  9717. @end table
  9718. @anchor{lut3d}
  9719. @section lut3d
  9720. Apply a 3D LUT to an input video.
  9721. The filter accepts the following options:
  9722. @table @option
  9723. @item file
  9724. Set the 3D LUT file name.
  9725. Currently supported formats:
  9726. @table @samp
  9727. @item 3dl
  9728. AfterEffects
  9729. @item cube
  9730. Iridas
  9731. @item dat
  9732. DaVinci
  9733. @item m3d
  9734. Pandora
  9735. @item csp
  9736. cineSpace
  9737. @end table
  9738. @item interp
  9739. Select interpolation mode.
  9740. Available values are:
  9741. @table @samp
  9742. @item nearest
  9743. Use values from the nearest defined point.
  9744. @item trilinear
  9745. Interpolate values using the 8 points defining a cube.
  9746. @item tetrahedral
  9747. Interpolate values using a tetrahedron.
  9748. @end table
  9749. @end table
  9750. @section lumakey
  9751. Turn certain luma values into transparency.
  9752. The filter accepts the following options:
  9753. @table @option
  9754. @item threshold
  9755. Set the luma which will be used as base for transparency.
  9756. Default value is @code{0}.
  9757. @item tolerance
  9758. Set the range of luma values to be keyed out.
  9759. Default value is @code{0.01}.
  9760. @item softness
  9761. Set the range of softness. Default value is @code{0}.
  9762. Use this to control gradual transition from zero to full transparency.
  9763. @end table
  9764. @subsection Commands
  9765. This filter supports same @ref{commands} as options.
  9766. The command accepts the same syntax of the corresponding option.
  9767. If the specified expression is not valid, it is kept at its current
  9768. value.
  9769. @section lut, lutrgb, lutyuv
  9770. Compute a look-up table for binding each pixel component input value
  9771. to an output value, and apply it to the input video.
  9772. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9773. to an RGB input video.
  9774. These filters accept the following parameters:
  9775. @table @option
  9776. @item c0
  9777. set first pixel component expression
  9778. @item c1
  9779. set second pixel component expression
  9780. @item c2
  9781. set third pixel component expression
  9782. @item c3
  9783. set fourth pixel component expression, corresponds to the alpha component
  9784. @item r
  9785. set red component expression
  9786. @item g
  9787. set green component expression
  9788. @item b
  9789. set blue component expression
  9790. @item a
  9791. alpha component expression
  9792. @item y
  9793. set Y/luminance component expression
  9794. @item u
  9795. set U/Cb component expression
  9796. @item v
  9797. set V/Cr component expression
  9798. @end table
  9799. Each of them specifies the expression to use for computing the lookup table for
  9800. the corresponding pixel component values.
  9801. The exact component associated to each of the @var{c*} options depends on the
  9802. format in input.
  9803. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9804. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9805. The expressions can contain the following constants and functions:
  9806. @table @option
  9807. @item w
  9808. @item h
  9809. The input width and height.
  9810. @item val
  9811. The input value for the pixel component.
  9812. @item clipval
  9813. The input value, clipped to the @var{minval}-@var{maxval} range.
  9814. @item maxval
  9815. The maximum value for the pixel component.
  9816. @item minval
  9817. The minimum value for the pixel component.
  9818. @item negval
  9819. The negated value for the pixel component value, clipped to the
  9820. @var{minval}-@var{maxval} range; it corresponds to the expression
  9821. "maxval-clipval+minval".
  9822. @item clip(val)
  9823. The computed value in @var{val}, clipped to the
  9824. @var{minval}-@var{maxval} range.
  9825. @item gammaval(gamma)
  9826. The computed gamma correction value of the pixel component value,
  9827. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9828. expression
  9829. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9830. @end table
  9831. All expressions default to "val".
  9832. @subsection Examples
  9833. @itemize
  9834. @item
  9835. Negate input video:
  9836. @example
  9837. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9838. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9839. @end example
  9840. The above is the same as:
  9841. @example
  9842. lutrgb="r=negval:g=negval:b=negval"
  9843. lutyuv="y=negval:u=negval:v=negval"
  9844. @end example
  9845. @item
  9846. Negate luminance:
  9847. @example
  9848. lutyuv=y=negval
  9849. @end example
  9850. @item
  9851. Remove chroma components, turning the video into a graytone image:
  9852. @example
  9853. lutyuv="u=128:v=128"
  9854. @end example
  9855. @item
  9856. Apply a luma burning effect:
  9857. @example
  9858. lutyuv="y=2*val"
  9859. @end example
  9860. @item
  9861. Remove green and blue components:
  9862. @example
  9863. lutrgb="g=0:b=0"
  9864. @end example
  9865. @item
  9866. Set a constant alpha channel value on input:
  9867. @example
  9868. format=rgba,lutrgb=a="maxval-minval/2"
  9869. @end example
  9870. @item
  9871. Correct luminance gamma by a factor of 0.5:
  9872. @example
  9873. lutyuv=y=gammaval(0.5)
  9874. @end example
  9875. @item
  9876. Discard least significant bits of luma:
  9877. @example
  9878. lutyuv=y='bitand(val, 128+64+32)'
  9879. @end example
  9880. @item
  9881. Technicolor like effect:
  9882. @example
  9883. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9884. @end example
  9885. @end itemize
  9886. @section lut2, tlut2
  9887. The @code{lut2} filter takes two input streams and outputs one
  9888. stream.
  9889. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9890. from one single stream.
  9891. This filter accepts the following parameters:
  9892. @table @option
  9893. @item c0
  9894. set first pixel component expression
  9895. @item c1
  9896. set second pixel component expression
  9897. @item c2
  9898. set third pixel component expression
  9899. @item c3
  9900. set fourth pixel component expression, corresponds to the alpha component
  9901. @item d
  9902. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9903. which means bit depth is automatically picked from first input format.
  9904. @end table
  9905. Each of them specifies the expression to use for computing the lookup table for
  9906. the corresponding pixel component values.
  9907. The exact component associated to each of the @var{c*} options depends on the
  9908. format in inputs.
  9909. The expressions can contain the following constants:
  9910. @table @option
  9911. @item w
  9912. @item h
  9913. The input width and height.
  9914. @item x
  9915. The first input value for the pixel component.
  9916. @item y
  9917. The second input value for the pixel component.
  9918. @item bdx
  9919. The first input video bit depth.
  9920. @item bdy
  9921. The second input video bit depth.
  9922. @end table
  9923. All expressions default to "x".
  9924. @subsection Examples
  9925. @itemize
  9926. @item
  9927. Highlight differences between two RGB video streams:
  9928. @example
  9929. 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)'
  9930. @end example
  9931. @item
  9932. Highlight differences between two YUV video streams:
  9933. @example
  9934. 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)'
  9935. @end example
  9936. @item
  9937. Show max difference between two video streams:
  9938. @example
  9939. 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)))'
  9940. @end example
  9941. @end itemize
  9942. @section maskedclamp
  9943. Clamp the first input stream with the second input and third input stream.
  9944. Returns the value of first stream to be between second input
  9945. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9946. This filter accepts the following options:
  9947. @table @option
  9948. @item undershoot
  9949. Default value is @code{0}.
  9950. @item overshoot
  9951. Default value is @code{0}.
  9952. @item planes
  9953. Set which planes will be processed as bitmap, unprocessed planes will be
  9954. copied from first stream.
  9955. By default value 0xf, all planes will be processed.
  9956. @end table
  9957. @section maskedmax
  9958. Merge the second and third input stream into output stream using absolute differences
  9959. between second input stream and first input stream and absolute difference between
  9960. third input stream and first input stream. The picked value will be from second input
  9961. stream if second absolute difference is greater than first one or from third input stream
  9962. otherwise.
  9963. This filter accepts the following options:
  9964. @table @option
  9965. @item planes
  9966. Set which planes will be processed as bitmap, unprocessed planes will be
  9967. copied from first stream.
  9968. By default value 0xf, all planes will be processed.
  9969. @end table
  9970. @section maskedmerge
  9971. Merge the first input stream with the second input stream using per pixel
  9972. weights in the third input stream.
  9973. A value of 0 in the third stream pixel component means that pixel component
  9974. from first stream is returned unchanged, while maximum value (eg. 255 for
  9975. 8-bit videos) means that pixel component from second stream is returned
  9976. unchanged. Intermediate values define the amount of merging between both
  9977. input stream's pixel components.
  9978. This filter accepts the following options:
  9979. @table @option
  9980. @item planes
  9981. Set which planes will be processed as bitmap, unprocessed planes will be
  9982. copied from first stream.
  9983. By default value 0xf, all planes will be processed.
  9984. @end table
  9985. @section maskedmin
  9986. Merge the second and third input stream into output stream using absolute differences
  9987. between second input stream and first input stream and absolute difference between
  9988. third input stream and first input stream. The picked value will be from second input
  9989. stream if second absolute difference is less than first one or from third input stream
  9990. otherwise.
  9991. This filter accepts the following options:
  9992. @table @option
  9993. @item planes
  9994. Set which planes will be processed as bitmap, unprocessed planes will be
  9995. copied from first stream.
  9996. By default value 0xf, all planes will be processed.
  9997. @end table
  9998. @section maskfun
  9999. Create mask from input video.
  10000. For example it is useful to create motion masks after @code{tblend} filter.
  10001. This filter accepts the following options:
  10002. @table @option
  10003. @item low
  10004. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10005. @item high
  10006. Set high threshold. Any pixel component higher than this value will be set to max value
  10007. allowed for current pixel format.
  10008. @item planes
  10009. Set planes to filter, by default all available planes are filtered.
  10010. @item fill
  10011. Fill all frame pixels with this value.
  10012. @item sum
  10013. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10014. average, output frame will be completely filled with value set by @var{fill} option.
  10015. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10016. @end table
  10017. @section mcdeint
  10018. Apply motion-compensation deinterlacing.
  10019. It needs one field per frame as input and must thus be used together
  10020. with yadif=1/3 or equivalent.
  10021. This filter accepts the following options:
  10022. @table @option
  10023. @item mode
  10024. Set the deinterlacing mode.
  10025. It accepts one of the following values:
  10026. @table @samp
  10027. @item fast
  10028. @item medium
  10029. @item slow
  10030. use iterative motion estimation
  10031. @item extra_slow
  10032. like @samp{slow}, but use multiple reference frames.
  10033. @end table
  10034. Default value is @samp{fast}.
  10035. @item parity
  10036. Set the picture field parity assumed for the input video. It must be
  10037. one of the following values:
  10038. @table @samp
  10039. @item 0, tff
  10040. assume top field first
  10041. @item 1, bff
  10042. assume bottom field first
  10043. @end table
  10044. Default value is @samp{bff}.
  10045. @item qp
  10046. Set per-block quantization parameter (QP) used by the internal
  10047. encoder.
  10048. Higher values should result in a smoother motion vector field but less
  10049. optimal individual vectors. Default value is 1.
  10050. @end table
  10051. @section median
  10052. Pick median pixel from certain rectangle defined by radius.
  10053. This filter accepts the following options:
  10054. @table @option
  10055. @item radius
  10056. Set horizontal radius size. Default value is @code{1}.
  10057. Allowed range is integer from 1 to 127.
  10058. @item planes
  10059. Set which planes to process. Default is @code{15}, which is all available planes.
  10060. @item radiusV
  10061. Set vertical radius size. Default value is @code{0}.
  10062. Allowed range is integer from 0 to 127.
  10063. If it is 0, value will be picked from horizontal @code{radius} option.
  10064. @end table
  10065. @subsection Commands
  10066. This filter supports same @ref{commands} as options.
  10067. The command accepts the same syntax of the corresponding option.
  10068. If the specified expression is not valid, it is kept at its current
  10069. value.
  10070. @section mergeplanes
  10071. Merge color channel components from several video streams.
  10072. The filter accepts up to 4 input streams, and merge selected input
  10073. planes to the output video.
  10074. This filter accepts the following options:
  10075. @table @option
  10076. @item mapping
  10077. Set input to output plane mapping. Default is @code{0}.
  10078. The mappings is specified as a bitmap. It should be specified as a
  10079. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10080. mapping for the first plane of the output stream. 'A' sets the number of
  10081. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10082. corresponding input to use (from 0 to 3). The rest of the mappings is
  10083. similar, 'Bb' describes the mapping for the output stream second
  10084. plane, 'Cc' describes the mapping for the output stream third plane and
  10085. 'Dd' describes the mapping for the output stream fourth plane.
  10086. @item format
  10087. Set output pixel format. Default is @code{yuva444p}.
  10088. @end table
  10089. @subsection Examples
  10090. @itemize
  10091. @item
  10092. Merge three gray video streams of same width and height into single video stream:
  10093. @example
  10094. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10095. @end example
  10096. @item
  10097. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10098. @example
  10099. [a0][a1]mergeplanes=0x00010210:yuva444p
  10100. @end example
  10101. @item
  10102. Swap Y and A plane in yuva444p stream:
  10103. @example
  10104. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10105. @end example
  10106. @item
  10107. Swap U and V plane in yuv420p stream:
  10108. @example
  10109. format=yuv420p,mergeplanes=0x000201:yuv420p
  10110. @end example
  10111. @item
  10112. Cast a rgb24 clip to yuv444p:
  10113. @example
  10114. format=rgb24,mergeplanes=0x000102:yuv444p
  10115. @end example
  10116. @end itemize
  10117. @section mestimate
  10118. Estimate and export motion vectors using block matching algorithms.
  10119. Motion vectors are stored in frame side data to be used by other filters.
  10120. This filter accepts the following options:
  10121. @table @option
  10122. @item method
  10123. Specify the motion estimation method. Accepts one of the following values:
  10124. @table @samp
  10125. @item esa
  10126. Exhaustive search algorithm.
  10127. @item tss
  10128. Three step search algorithm.
  10129. @item tdls
  10130. Two dimensional logarithmic search algorithm.
  10131. @item ntss
  10132. New three step search algorithm.
  10133. @item fss
  10134. Four step search algorithm.
  10135. @item ds
  10136. Diamond search algorithm.
  10137. @item hexbs
  10138. Hexagon-based search algorithm.
  10139. @item epzs
  10140. Enhanced predictive zonal search algorithm.
  10141. @item umh
  10142. Uneven multi-hexagon search algorithm.
  10143. @end table
  10144. Default value is @samp{esa}.
  10145. @item mb_size
  10146. Macroblock size. Default @code{16}.
  10147. @item search_param
  10148. Search parameter. Default @code{7}.
  10149. @end table
  10150. @section midequalizer
  10151. Apply Midway Image Equalization effect using two video streams.
  10152. Midway Image Equalization adjusts a pair of images to have the same
  10153. histogram, while maintaining their dynamics as much as possible. It's
  10154. useful for e.g. matching exposures from a pair of stereo cameras.
  10155. This filter has two inputs and one output, which must be of same pixel format, but
  10156. may be of different sizes. The output of filter is first input adjusted with
  10157. midway histogram of both inputs.
  10158. This filter accepts the following option:
  10159. @table @option
  10160. @item planes
  10161. Set which planes to process. Default is @code{15}, which is all available planes.
  10162. @end table
  10163. @section minterpolate
  10164. Convert the video to specified frame rate using motion interpolation.
  10165. This filter accepts the following options:
  10166. @table @option
  10167. @item fps
  10168. 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}.
  10169. @item mi_mode
  10170. Motion interpolation mode. Following values are accepted:
  10171. @table @samp
  10172. @item dup
  10173. Duplicate previous or next frame for interpolating new ones.
  10174. @item blend
  10175. Blend source frames. Interpolated frame is mean of previous and next frames.
  10176. @item mci
  10177. Motion compensated interpolation. Following options are effective when this mode is selected:
  10178. @table @samp
  10179. @item mc_mode
  10180. Motion compensation mode. Following values are accepted:
  10181. @table @samp
  10182. @item obmc
  10183. Overlapped block motion compensation.
  10184. @item aobmc
  10185. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10186. @end table
  10187. Default mode is @samp{obmc}.
  10188. @item me_mode
  10189. Motion estimation mode. Following values are accepted:
  10190. @table @samp
  10191. @item bidir
  10192. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10193. @item bilat
  10194. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10195. @end table
  10196. Default mode is @samp{bilat}.
  10197. @item me
  10198. The algorithm to be used for motion estimation. Following values are accepted:
  10199. @table @samp
  10200. @item esa
  10201. Exhaustive search algorithm.
  10202. @item tss
  10203. Three step search algorithm.
  10204. @item tdls
  10205. Two dimensional logarithmic search algorithm.
  10206. @item ntss
  10207. New three step search algorithm.
  10208. @item fss
  10209. Four step search algorithm.
  10210. @item ds
  10211. Diamond search algorithm.
  10212. @item hexbs
  10213. Hexagon-based search algorithm.
  10214. @item epzs
  10215. Enhanced predictive zonal search algorithm.
  10216. @item umh
  10217. Uneven multi-hexagon search algorithm.
  10218. @end table
  10219. Default algorithm is @samp{epzs}.
  10220. @item mb_size
  10221. Macroblock size. Default @code{16}.
  10222. @item search_param
  10223. Motion estimation search parameter. Default @code{32}.
  10224. @item vsbmc
  10225. 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).
  10226. @end table
  10227. @end table
  10228. @item scd
  10229. 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:
  10230. @table @samp
  10231. @item none
  10232. Disable scene change detection.
  10233. @item fdiff
  10234. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10235. @end table
  10236. Default method is @samp{fdiff}.
  10237. @item scd_threshold
  10238. Scene change detection threshold. Default is @code{5.0}.
  10239. @end table
  10240. @section mix
  10241. Mix several video input streams into one video stream.
  10242. A description of the accepted options follows.
  10243. @table @option
  10244. @item nb_inputs
  10245. The number of inputs. If unspecified, it defaults to 2.
  10246. @item weights
  10247. Specify weight of each input video stream as sequence.
  10248. Each weight is separated by space. If number of weights
  10249. is smaller than number of @var{frames} last specified
  10250. weight will be used for all remaining unset weights.
  10251. @item scale
  10252. Specify scale, if it is set it will be multiplied with sum
  10253. of each weight multiplied with pixel values to give final destination
  10254. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10255. @item duration
  10256. Specify how end of stream is determined.
  10257. @table @samp
  10258. @item longest
  10259. The duration of the longest input. (default)
  10260. @item shortest
  10261. The duration of the shortest input.
  10262. @item first
  10263. The duration of the first input.
  10264. @end table
  10265. @end table
  10266. @section mpdecimate
  10267. Drop frames that do not differ greatly from the previous frame in
  10268. order to reduce frame rate.
  10269. The main use of this filter is for very-low-bitrate encoding
  10270. (e.g. streaming over dialup modem), but it could in theory be used for
  10271. fixing movies that were inverse-telecined incorrectly.
  10272. A description of the accepted options follows.
  10273. @table @option
  10274. @item max
  10275. Set the maximum number of consecutive frames which can be dropped (if
  10276. positive), or the minimum interval between dropped frames (if
  10277. negative). If the value is 0, the frame is dropped disregarding the
  10278. number of previous sequentially dropped frames.
  10279. Default value is 0.
  10280. @item hi
  10281. @item lo
  10282. @item frac
  10283. Set the dropping threshold values.
  10284. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10285. represent actual pixel value differences, so a threshold of 64
  10286. corresponds to 1 unit of difference for each pixel, or the same spread
  10287. out differently over the block.
  10288. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10289. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10290. meaning the whole image) differ by more than a threshold of @option{lo}.
  10291. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10292. 64*5, and default value for @option{frac} is 0.33.
  10293. @end table
  10294. @section negate
  10295. Negate (invert) the input video.
  10296. It accepts the following option:
  10297. @table @option
  10298. @item negate_alpha
  10299. With value 1, it negates the alpha component, if present. Default value is 0.
  10300. @end table
  10301. @anchor{nlmeans}
  10302. @section nlmeans
  10303. Denoise frames using Non-Local Means algorithm.
  10304. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10305. context similarity is defined by comparing their surrounding patches of size
  10306. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10307. around the pixel.
  10308. Note that the research area defines centers for patches, which means some
  10309. patches will be made of pixels outside that research area.
  10310. The filter accepts the following options.
  10311. @table @option
  10312. @item s
  10313. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10314. @item p
  10315. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10316. @item pc
  10317. Same as @option{p} but for chroma planes.
  10318. The default value is @var{0} and means automatic.
  10319. @item r
  10320. Set research size. Default is 15. Must be odd number in range [0, 99].
  10321. @item rc
  10322. Same as @option{r} but for chroma planes.
  10323. The default value is @var{0} and means automatic.
  10324. @end table
  10325. @section nnedi
  10326. Deinterlace video using neural network edge directed interpolation.
  10327. This filter accepts the following options:
  10328. @table @option
  10329. @item weights
  10330. Mandatory option, without binary file filter can not work.
  10331. Currently file can be found here:
  10332. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10333. @item deint
  10334. Set which frames to deinterlace, by default it is @code{all}.
  10335. Can be @code{all} or @code{interlaced}.
  10336. @item field
  10337. Set mode of operation.
  10338. Can be one of the following:
  10339. @table @samp
  10340. @item af
  10341. Use frame flags, both fields.
  10342. @item a
  10343. Use frame flags, single field.
  10344. @item t
  10345. Use top field only.
  10346. @item b
  10347. Use bottom field only.
  10348. @item tf
  10349. Use both fields, top first.
  10350. @item bf
  10351. Use both fields, bottom first.
  10352. @end table
  10353. @item planes
  10354. Set which planes to process, by default filter process all frames.
  10355. @item nsize
  10356. Set size of local neighborhood around each pixel, used by the predictor neural
  10357. network.
  10358. Can be one of the following:
  10359. @table @samp
  10360. @item s8x6
  10361. @item s16x6
  10362. @item s32x6
  10363. @item s48x6
  10364. @item s8x4
  10365. @item s16x4
  10366. @item s32x4
  10367. @end table
  10368. @item nns
  10369. Set the number of neurons in predictor neural network.
  10370. Can be one of the following:
  10371. @table @samp
  10372. @item n16
  10373. @item n32
  10374. @item n64
  10375. @item n128
  10376. @item n256
  10377. @end table
  10378. @item qual
  10379. Controls the number of different neural network predictions that are blended
  10380. together to compute the final output value. Can be @code{fast}, default or
  10381. @code{slow}.
  10382. @item etype
  10383. Set which set of weights to use in the predictor.
  10384. Can be one of the following:
  10385. @table @samp
  10386. @item a
  10387. weights trained to minimize absolute error
  10388. @item s
  10389. weights trained to minimize squared error
  10390. @end table
  10391. @item pscrn
  10392. Controls whether or not the prescreener neural network is used to decide
  10393. which pixels should be processed by the predictor neural network and which
  10394. can be handled by simple cubic interpolation.
  10395. The prescreener is trained to know whether cubic interpolation will be
  10396. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10397. The computational complexity of the prescreener nn is much less than that of
  10398. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10399. using the prescreener generally results in much faster processing.
  10400. The prescreener is pretty accurate, so the difference between using it and not
  10401. using it is almost always unnoticeable.
  10402. Can be one of the following:
  10403. @table @samp
  10404. @item none
  10405. @item original
  10406. @item new
  10407. @end table
  10408. Default is @code{new}.
  10409. @item fapprox
  10410. Set various debugging flags.
  10411. @end table
  10412. @section noformat
  10413. Force libavfilter not to use any of the specified pixel formats for the
  10414. input to the next filter.
  10415. It accepts the following parameters:
  10416. @table @option
  10417. @item pix_fmts
  10418. A '|'-separated list of pixel format names, such as
  10419. pix_fmts=yuv420p|monow|rgb24".
  10420. @end table
  10421. @subsection Examples
  10422. @itemize
  10423. @item
  10424. Force libavfilter to use a format different from @var{yuv420p} for the
  10425. input to the vflip filter:
  10426. @example
  10427. noformat=pix_fmts=yuv420p,vflip
  10428. @end example
  10429. @item
  10430. Convert the input video to any of the formats not contained in the list:
  10431. @example
  10432. noformat=yuv420p|yuv444p|yuv410p
  10433. @end example
  10434. @end itemize
  10435. @section noise
  10436. Add noise on video input frame.
  10437. The filter accepts the following options:
  10438. @table @option
  10439. @item all_seed
  10440. @item c0_seed
  10441. @item c1_seed
  10442. @item c2_seed
  10443. @item c3_seed
  10444. Set noise seed for specific pixel component or all pixel components in case
  10445. of @var{all_seed}. Default value is @code{123457}.
  10446. @item all_strength, alls
  10447. @item c0_strength, c0s
  10448. @item c1_strength, c1s
  10449. @item c2_strength, c2s
  10450. @item c3_strength, c3s
  10451. Set noise strength for specific pixel component or all pixel components in case
  10452. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10453. @item all_flags, allf
  10454. @item c0_flags, c0f
  10455. @item c1_flags, c1f
  10456. @item c2_flags, c2f
  10457. @item c3_flags, c3f
  10458. Set pixel component flags or set flags for all components if @var{all_flags}.
  10459. Available values for component flags are:
  10460. @table @samp
  10461. @item a
  10462. averaged temporal noise (smoother)
  10463. @item p
  10464. mix random noise with a (semi)regular pattern
  10465. @item t
  10466. temporal noise (noise pattern changes between frames)
  10467. @item u
  10468. uniform noise (gaussian otherwise)
  10469. @end table
  10470. @end table
  10471. @subsection Examples
  10472. Add temporal and uniform noise to input video:
  10473. @example
  10474. noise=alls=20:allf=t+u
  10475. @end example
  10476. @section normalize
  10477. Normalize RGB video (aka histogram stretching, contrast stretching).
  10478. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10479. For each channel of each frame, the filter computes the input range and maps
  10480. it linearly to the user-specified output range. The output range defaults
  10481. to the full dynamic range from pure black to pure white.
  10482. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10483. changes in brightness) caused when small dark or bright objects enter or leave
  10484. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10485. video camera, and, like a video camera, it may cause a period of over- or
  10486. under-exposure of the video.
  10487. The R,G,B channels can be normalized independently, which may cause some
  10488. color shifting, or linked together as a single channel, which prevents
  10489. color shifting. Linked normalization preserves hue. Independent normalization
  10490. does not, so it can be used to remove some color casts. Independent and linked
  10491. normalization can be combined in any ratio.
  10492. The normalize filter accepts the following options:
  10493. @table @option
  10494. @item blackpt
  10495. @item whitept
  10496. Colors which define the output range. The minimum input value is mapped to
  10497. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10498. The defaults are black and white respectively. Specifying white for
  10499. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10500. normalized video. Shades of grey can be used to reduce the dynamic range
  10501. (contrast). Specifying saturated colors here can create some interesting
  10502. effects.
  10503. @item smoothing
  10504. The number of previous frames to use for temporal smoothing. The input range
  10505. of each channel is smoothed using a rolling average over the current frame
  10506. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10507. smoothing).
  10508. @item independence
  10509. Controls the ratio of independent (color shifting) channel normalization to
  10510. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10511. independent. Defaults to 1.0 (fully independent).
  10512. @item strength
  10513. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10514. expensive no-op. Defaults to 1.0 (full strength).
  10515. @end table
  10516. @subsection Commands
  10517. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10518. The command accepts the same syntax of the corresponding option.
  10519. If the specified expression is not valid, it is kept at its current
  10520. value.
  10521. @subsection Examples
  10522. Stretch video contrast to use the full dynamic range, with no temporal
  10523. smoothing; may flicker depending on the source content:
  10524. @example
  10525. normalize=blackpt=black:whitept=white:smoothing=0
  10526. @end example
  10527. As above, but with 50 frames of temporal smoothing; flicker should be
  10528. reduced, depending on the source content:
  10529. @example
  10530. normalize=blackpt=black:whitept=white:smoothing=50
  10531. @end example
  10532. As above, but with hue-preserving linked channel normalization:
  10533. @example
  10534. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10535. @end example
  10536. As above, but with half strength:
  10537. @example
  10538. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10539. @end example
  10540. Map the darkest input color to red, the brightest input color to cyan:
  10541. @example
  10542. normalize=blackpt=red:whitept=cyan
  10543. @end example
  10544. @section null
  10545. Pass the video source unchanged to the output.
  10546. @section ocr
  10547. Optical Character Recognition
  10548. This filter uses Tesseract for optical character recognition. To enable
  10549. compilation of this filter, you need to configure FFmpeg with
  10550. @code{--enable-libtesseract}.
  10551. It accepts the following options:
  10552. @table @option
  10553. @item datapath
  10554. Set datapath to tesseract data. Default is to use whatever was
  10555. set at installation.
  10556. @item language
  10557. Set language, default is "eng".
  10558. @item whitelist
  10559. Set character whitelist.
  10560. @item blacklist
  10561. Set character blacklist.
  10562. @end table
  10563. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10564. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10565. @section ocv
  10566. Apply a video transform using libopencv.
  10567. To enable this filter, install the libopencv library and headers and
  10568. configure FFmpeg with @code{--enable-libopencv}.
  10569. It accepts the following parameters:
  10570. @table @option
  10571. @item filter_name
  10572. The name of the libopencv filter to apply.
  10573. @item filter_params
  10574. The parameters to pass to the libopencv filter. If not specified, the default
  10575. values are assumed.
  10576. @end table
  10577. Refer to the official libopencv documentation for more precise
  10578. information:
  10579. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10580. Several libopencv filters are supported; see the following subsections.
  10581. @anchor{dilate}
  10582. @subsection dilate
  10583. Dilate an image by using a specific structuring element.
  10584. It corresponds to the libopencv function @code{cvDilate}.
  10585. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10586. @var{struct_el} represents a structuring element, and has the syntax:
  10587. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10588. @var{cols} and @var{rows} represent the number of columns and rows of
  10589. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10590. point, and @var{shape} the shape for the structuring element. @var{shape}
  10591. must be "rect", "cross", "ellipse", or "custom".
  10592. If the value for @var{shape} is "custom", it must be followed by a
  10593. string of the form "=@var{filename}". The file with name
  10594. @var{filename} is assumed to represent a binary image, with each
  10595. printable character corresponding to a bright pixel. When a custom
  10596. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10597. or columns and rows of the read file are assumed instead.
  10598. The default value for @var{struct_el} is "3x3+0x0/rect".
  10599. @var{nb_iterations} specifies the number of times the transform is
  10600. applied to the image, and defaults to 1.
  10601. Some examples:
  10602. @example
  10603. # Use the default values
  10604. ocv=dilate
  10605. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10606. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10607. # Read the shape from the file diamond.shape, iterating two times.
  10608. # The file diamond.shape may contain a pattern of characters like this
  10609. # *
  10610. # ***
  10611. # *****
  10612. # ***
  10613. # *
  10614. # The specified columns and rows are ignored
  10615. # but the anchor point coordinates are not
  10616. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10617. @end example
  10618. @subsection erode
  10619. Erode an image by using a specific structuring element.
  10620. It corresponds to the libopencv function @code{cvErode}.
  10621. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10622. with the same syntax and semantics as the @ref{dilate} filter.
  10623. @subsection smooth
  10624. Smooth the input video.
  10625. The filter takes the following parameters:
  10626. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10627. @var{type} is the type of smooth filter to apply, and must be one of
  10628. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10629. or "bilateral". The default value is "gaussian".
  10630. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10631. depends on the smooth type. @var{param1} and
  10632. @var{param2} accept integer positive values or 0. @var{param3} and
  10633. @var{param4} accept floating point values.
  10634. The default value for @var{param1} is 3. The default value for the
  10635. other parameters is 0.
  10636. These parameters correspond to the parameters assigned to the
  10637. libopencv function @code{cvSmooth}.
  10638. @section oscilloscope
  10639. 2D Video Oscilloscope.
  10640. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10641. It accepts the following parameters:
  10642. @table @option
  10643. @item x
  10644. Set scope center x position.
  10645. @item y
  10646. Set scope center y position.
  10647. @item s
  10648. Set scope size, relative to frame diagonal.
  10649. @item t
  10650. Set scope tilt/rotation.
  10651. @item o
  10652. Set trace opacity.
  10653. @item tx
  10654. Set trace center x position.
  10655. @item ty
  10656. Set trace center y position.
  10657. @item tw
  10658. Set trace width, relative to width of frame.
  10659. @item th
  10660. Set trace height, relative to height of frame.
  10661. @item c
  10662. Set which components to trace. By default it traces first three components.
  10663. @item g
  10664. Draw trace grid. By default is enabled.
  10665. @item st
  10666. Draw some statistics. By default is enabled.
  10667. @item sc
  10668. Draw scope. By default is enabled.
  10669. @end table
  10670. @subsection Commands
  10671. This filter supports same @ref{commands} as options.
  10672. The command accepts the same syntax of the corresponding option.
  10673. If the specified expression is not valid, it is kept at its current
  10674. value.
  10675. @subsection Examples
  10676. @itemize
  10677. @item
  10678. Inspect full first row of video frame.
  10679. @example
  10680. oscilloscope=x=0.5:y=0:s=1
  10681. @end example
  10682. @item
  10683. Inspect full last row of video frame.
  10684. @example
  10685. oscilloscope=x=0.5:y=1:s=1
  10686. @end example
  10687. @item
  10688. Inspect full 5th line of video frame of height 1080.
  10689. @example
  10690. oscilloscope=x=0.5:y=5/1080:s=1
  10691. @end example
  10692. @item
  10693. Inspect full last column of video frame.
  10694. @example
  10695. oscilloscope=x=1:y=0.5:s=1:t=1
  10696. @end example
  10697. @end itemize
  10698. @anchor{overlay}
  10699. @section overlay
  10700. Overlay one video on top of another.
  10701. It takes two inputs and has one output. The first input is the "main"
  10702. video on which the second input is overlaid.
  10703. It accepts the following parameters:
  10704. A description of the accepted options follows.
  10705. @table @option
  10706. @item x
  10707. @item y
  10708. Set the expression for the x and y coordinates of the overlaid video
  10709. on the main video. Default value is "0" for both expressions. In case
  10710. the expression is invalid, it is set to a huge value (meaning that the
  10711. overlay will not be displayed within the output visible area).
  10712. @item eof_action
  10713. See @ref{framesync}.
  10714. @item eval
  10715. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10716. It accepts the following values:
  10717. @table @samp
  10718. @item init
  10719. only evaluate expressions once during the filter initialization or
  10720. when a command is processed
  10721. @item frame
  10722. evaluate expressions for each incoming frame
  10723. @end table
  10724. Default value is @samp{frame}.
  10725. @item shortest
  10726. See @ref{framesync}.
  10727. @item format
  10728. Set the format for the output video.
  10729. It accepts the following values:
  10730. @table @samp
  10731. @item yuv420
  10732. force YUV420 output
  10733. @item yuv422
  10734. force YUV422 output
  10735. @item yuv444
  10736. force YUV444 output
  10737. @item rgb
  10738. force packed RGB output
  10739. @item gbrp
  10740. force planar RGB output
  10741. @item auto
  10742. automatically pick format
  10743. @end table
  10744. Default value is @samp{yuv420}.
  10745. @item repeatlast
  10746. See @ref{framesync}.
  10747. @item alpha
  10748. Set format of alpha of the overlaid video, it can be @var{straight} or
  10749. @var{premultiplied}. Default is @var{straight}.
  10750. @end table
  10751. The @option{x}, and @option{y} expressions can contain the following
  10752. parameters.
  10753. @table @option
  10754. @item main_w, W
  10755. @item main_h, H
  10756. The main input width and height.
  10757. @item overlay_w, w
  10758. @item overlay_h, h
  10759. The overlay input width and height.
  10760. @item x
  10761. @item y
  10762. The computed values for @var{x} and @var{y}. They are evaluated for
  10763. each new frame.
  10764. @item hsub
  10765. @item vsub
  10766. horizontal and vertical chroma subsample values of the output
  10767. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10768. @var{vsub} is 1.
  10769. @item n
  10770. the number of input frame, starting from 0
  10771. @item pos
  10772. the position in the file of the input frame, NAN if unknown
  10773. @item t
  10774. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10775. @end table
  10776. This filter also supports the @ref{framesync} options.
  10777. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10778. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10779. when @option{eval} is set to @samp{init}.
  10780. Be aware that frames are taken from each input video in timestamp
  10781. order, hence, if their initial timestamps differ, it is a good idea
  10782. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10783. have them begin in the same zero timestamp, as the example for
  10784. the @var{movie} filter does.
  10785. You can chain together more overlays but you should test the
  10786. efficiency of such approach.
  10787. @subsection Commands
  10788. This filter supports the following commands:
  10789. @table @option
  10790. @item x
  10791. @item y
  10792. Modify the x and y of the overlay input.
  10793. The command accepts the same syntax of the corresponding option.
  10794. If the specified expression is not valid, it is kept at its current
  10795. value.
  10796. @end table
  10797. @subsection Examples
  10798. @itemize
  10799. @item
  10800. Draw the overlay at 10 pixels from the bottom right corner of the main
  10801. video:
  10802. @example
  10803. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10804. @end example
  10805. Using named options the example above becomes:
  10806. @example
  10807. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10808. @end example
  10809. @item
  10810. Insert a transparent PNG logo in the bottom left corner of the input,
  10811. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10812. @example
  10813. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10814. @end example
  10815. @item
  10816. Insert 2 different transparent PNG logos (second logo on bottom
  10817. right corner) using the @command{ffmpeg} tool:
  10818. @example
  10819. 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
  10820. @end example
  10821. @item
  10822. Add a transparent color layer on top of the main video; @code{WxH}
  10823. must specify the size of the main input to the overlay filter:
  10824. @example
  10825. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10826. @end example
  10827. @item
  10828. Play an original video and a filtered version (here with the deshake
  10829. filter) side by side using the @command{ffplay} tool:
  10830. @example
  10831. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10832. @end example
  10833. The above command is the same as:
  10834. @example
  10835. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10836. @end example
  10837. @item
  10838. Make a sliding overlay appearing from the left to the right top part of the
  10839. screen starting since time 2:
  10840. @example
  10841. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10842. @end example
  10843. @item
  10844. Compose output by putting two input videos side to side:
  10845. @example
  10846. ffmpeg -i left.avi -i right.avi -filter_complex "
  10847. nullsrc=size=200x100 [background];
  10848. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10849. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10850. [background][left] overlay=shortest=1 [background+left];
  10851. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10852. "
  10853. @end example
  10854. @item
  10855. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10856. @example
  10857. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10858. -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]'
  10859. masked.avi
  10860. @end example
  10861. @item
  10862. Chain several overlays in cascade:
  10863. @example
  10864. nullsrc=s=200x200 [bg];
  10865. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10866. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10867. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10868. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10869. [in3] null, [mid2] overlay=100:100 [out0]
  10870. @end example
  10871. @end itemize
  10872. @section owdenoise
  10873. Apply Overcomplete Wavelet denoiser.
  10874. The filter accepts the following options:
  10875. @table @option
  10876. @item depth
  10877. Set depth.
  10878. Larger depth values will denoise lower frequency components more, but
  10879. slow down filtering.
  10880. Must be an int in the range 8-16, default is @code{8}.
  10881. @item luma_strength, ls
  10882. Set luma strength.
  10883. Must be a double value in the range 0-1000, default is @code{1.0}.
  10884. @item chroma_strength, cs
  10885. Set chroma strength.
  10886. Must be a double value in the range 0-1000, default is @code{1.0}.
  10887. @end table
  10888. @anchor{pad}
  10889. @section pad
  10890. Add paddings to the input image, and place the original input at the
  10891. provided @var{x}, @var{y} coordinates.
  10892. It accepts the following parameters:
  10893. @table @option
  10894. @item width, w
  10895. @item height, h
  10896. Specify an expression for the size of the output image with the
  10897. paddings added. If the value for @var{width} or @var{height} is 0, the
  10898. corresponding input size is used for the output.
  10899. The @var{width} expression can reference the value set by the
  10900. @var{height} expression, and vice versa.
  10901. The default value of @var{width} and @var{height} is 0.
  10902. @item x
  10903. @item y
  10904. Specify the offsets to place the input image at within the padded area,
  10905. with respect to the top/left border of the output image.
  10906. The @var{x} expression can reference the value set by the @var{y}
  10907. expression, and vice versa.
  10908. The default value of @var{x} and @var{y} is 0.
  10909. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10910. so the input image is centered on the padded area.
  10911. @item color
  10912. Specify the color of the padded area. For the syntax of this option,
  10913. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10914. manual,ffmpeg-utils}.
  10915. The default value of @var{color} is "black".
  10916. @item eval
  10917. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10918. It accepts the following values:
  10919. @table @samp
  10920. @item init
  10921. Only evaluate expressions once during the filter initialization or when
  10922. a command is processed.
  10923. @item frame
  10924. Evaluate expressions for each incoming frame.
  10925. @end table
  10926. Default value is @samp{init}.
  10927. @item aspect
  10928. Pad to aspect instead to a resolution.
  10929. @end table
  10930. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10931. options are expressions containing the following constants:
  10932. @table @option
  10933. @item in_w
  10934. @item in_h
  10935. The input video width and height.
  10936. @item iw
  10937. @item ih
  10938. These are the same as @var{in_w} and @var{in_h}.
  10939. @item out_w
  10940. @item out_h
  10941. The output width and height (the size of the padded area), as
  10942. specified by the @var{width} and @var{height} expressions.
  10943. @item ow
  10944. @item oh
  10945. These are the same as @var{out_w} and @var{out_h}.
  10946. @item x
  10947. @item y
  10948. The x and y offsets as specified by the @var{x} and @var{y}
  10949. expressions, or NAN if not yet specified.
  10950. @item a
  10951. same as @var{iw} / @var{ih}
  10952. @item sar
  10953. input sample aspect ratio
  10954. @item dar
  10955. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10956. @item hsub
  10957. @item vsub
  10958. The horizontal and vertical chroma subsample values. For example for the
  10959. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10960. @end table
  10961. @subsection Examples
  10962. @itemize
  10963. @item
  10964. Add paddings with the color "violet" to the input video. The output video
  10965. size is 640x480, and the top-left corner of the input video is placed at
  10966. column 0, row 40
  10967. @example
  10968. pad=640:480:0:40:violet
  10969. @end example
  10970. The example above is equivalent to the following command:
  10971. @example
  10972. pad=width=640:height=480:x=0:y=40:color=violet
  10973. @end example
  10974. @item
  10975. Pad the input to get an output with dimensions increased by 3/2,
  10976. and put the input video at the center of the padded area:
  10977. @example
  10978. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10979. @end example
  10980. @item
  10981. Pad the input to get a squared output with size equal to the maximum
  10982. value between the input width and height, and put the input video at
  10983. the center of the padded area:
  10984. @example
  10985. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10986. @end example
  10987. @item
  10988. Pad the input to get a final w/h ratio of 16:9:
  10989. @example
  10990. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10991. @end example
  10992. @item
  10993. In case of anamorphic video, in order to set the output display aspect
  10994. correctly, it is necessary to use @var{sar} in the expression,
  10995. according to the relation:
  10996. @example
  10997. (ih * X / ih) * sar = output_dar
  10998. X = output_dar / sar
  10999. @end example
  11000. Thus the previous example needs to be modified to:
  11001. @example
  11002. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11003. @end example
  11004. @item
  11005. Double the output size and put the input video in the bottom-right
  11006. corner of the output padded area:
  11007. @example
  11008. pad="2*iw:2*ih:ow-iw:oh-ih"
  11009. @end example
  11010. @end itemize
  11011. @anchor{palettegen}
  11012. @section palettegen
  11013. Generate one palette for a whole video stream.
  11014. It accepts the following options:
  11015. @table @option
  11016. @item max_colors
  11017. Set the maximum number of colors to quantize in the palette.
  11018. Note: the palette will still contain 256 colors; the unused palette entries
  11019. will be black.
  11020. @item reserve_transparent
  11021. Create a palette of 255 colors maximum and reserve the last one for
  11022. transparency. Reserving the transparency color is useful for GIF optimization.
  11023. If not set, the maximum of colors in the palette will be 256. You probably want
  11024. to disable this option for a standalone image.
  11025. Set by default.
  11026. @item transparency_color
  11027. Set the color that will be used as background for transparency.
  11028. @item stats_mode
  11029. Set statistics mode.
  11030. It accepts the following values:
  11031. @table @samp
  11032. @item full
  11033. Compute full frame histograms.
  11034. @item diff
  11035. Compute histograms only for the part that differs from previous frame. This
  11036. might be relevant to give more importance to the moving part of your input if
  11037. the background is static.
  11038. @item single
  11039. Compute new histogram for each frame.
  11040. @end table
  11041. Default value is @var{full}.
  11042. @end table
  11043. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11044. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11045. color quantization of the palette. This information is also visible at
  11046. @var{info} logging level.
  11047. @subsection Examples
  11048. @itemize
  11049. @item
  11050. Generate a representative palette of a given video using @command{ffmpeg}:
  11051. @example
  11052. ffmpeg -i input.mkv -vf palettegen palette.png
  11053. @end example
  11054. @end itemize
  11055. @section paletteuse
  11056. Use a palette to downsample an input video stream.
  11057. The filter takes two inputs: one video stream and a palette. The palette must
  11058. be a 256 pixels image.
  11059. It accepts the following options:
  11060. @table @option
  11061. @item dither
  11062. Select dithering mode. Available algorithms are:
  11063. @table @samp
  11064. @item bayer
  11065. Ordered 8x8 bayer dithering (deterministic)
  11066. @item heckbert
  11067. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11068. Note: this dithering is sometimes considered "wrong" and is included as a
  11069. reference.
  11070. @item floyd_steinberg
  11071. Floyd and Steingberg dithering (error diffusion)
  11072. @item sierra2
  11073. Frankie Sierra dithering v2 (error diffusion)
  11074. @item sierra2_4a
  11075. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11076. @end table
  11077. Default is @var{sierra2_4a}.
  11078. @item bayer_scale
  11079. When @var{bayer} dithering is selected, this option defines the scale of the
  11080. pattern (how much the crosshatch pattern is visible). A low value means more
  11081. visible pattern for less banding, and higher value means less visible pattern
  11082. at the cost of more banding.
  11083. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11084. @item diff_mode
  11085. If set, define the zone to process
  11086. @table @samp
  11087. @item rectangle
  11088. Only the changing rectangle will be reprocessed. This is similar to GIF
  11089. cropping/offsetting compression mechanism. This option can be useful for speed
  11090. if only a part of the image is changing, and has use cases such as limiting the
  11091. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11092. moving scene (it leads to more deterministic output if the scene doesn't change
  11093. much, and as a result less moving noise and better GIF compression).
  11094. @end table
  11095. Default is @var{none}.
  11096. @item new
  11097. Take new palette for each output frame.
  11098. @item alpha_threshold
  11099. Sets the alpha threshold for transparency. Alpha values above this threshold
  11100. will be treated as completely opaque, and values below this threshold will be
  11101. treated as completely transparent.
  11102. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11103. @end table
  11104. @subsection Examples
  11105. @itemize
  11106. @item
  11107. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11108. using @command{ffmpeg}:
  11109. @example
  11110. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11111. @end example
  11112. @end itemize
  11113. @section perspective
  11114. Correct perspective of video not recorded perpendicular to the screen.
  11115. A description of the accepted parameters follows.
  11116. @table @option
  11117. @item x0
  11118. @item y0
  11119. @item x1
  11120. @item y1
  11121. @item x2
  11122. @item y2
  11123. @item x3
  11124. @item y3
  11125. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11126. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11127. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11128. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11129. then the corners of the source will be sent to the specified coordinates.
  11130. The expressions can use the following variables:
  11131. @table @option
  11132. @item W
  11133. @item H
  11134. the width and height of video frame.
  11135. @item in
  11136. Input frame count.
  11137. @item on
  11138. Output frame count.
  11139. @end table
  11140. @item interpolation
  11141. Set interpolation for perspective correction.
  11142. It accepts the following values:
  11143. @table @samp
  11144. @item linear
  11145. @item cubic
  11146. @end table
  11147. Default value is @samp{linear}.
  11148. @item sense
  11149. Set interpretation of coordinate options.
  11150. It accepts the following values:
  11151. @table @samp
  11152. @item 0, source
  11153. Send point in the source specified by the given coordinates to
  11154. the corners of the destination.
  11155. @item 1, destination
  11156. Send the corners of the source to the point in the destination specified
  11157. by the given coordinates.
  11158. Default value is @samp{source}.
  11159. @end table
  11160. @item eval
  11161. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11162. It accepts the following values:
  11163. @table @samp
  11164. @item init
  11165. only evaluate expressions once during the filter initialization or
  11166. when a command is processed
  11167. @item frame
  11168. evaluate expressions for each incoming frame
  11169. @end table
  11170. Default value is @samp{init}.
  11171. @end table
  11172. @section phase
  11173. Delay interlaced video by one field time so that the field order changes.
  11174. The intended use is to fix PAL movies that have been captured with the
  11175. opposite field order to the film-to-video transfer.
  11176. A description of the accepted parameters follows.
  11177. @table @option
  11178. @item mode
  11179. Set phase mode.
  11180. It accepts the following values:
  11181. @table @samp
  11182. @item t
  11183. Capture field order top-first, transfer bottom-first.
  11184. Filter will delay the bottom field.
  11185. @item b
  11186. Capture field order bottom-first, transfer top-first.
  11187. Filter will delay the top field.
  11188. @item p
  11189. Capture and transfer with the same field order. This mode only exists
  11190. for the documentation of the other options to refer to, but if you
  11191. actually select it, the filter will faithfully do nothing.
  11192. @item a
  11193. Capture field order determined automatically by field flags, transfer
  11194. opposite.
  11195. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11196. basis using field flags. If no field information is available,
  11197. then this works just like @samp{u}.
  11198. @item u
  11199. Capture unknown or varying, transfer opposite.
  11200. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11201. analyzing the images and selecting the alternative that produces best
  11202. match between the fields.
  11203. @item T
  11204. Capture top-first, transfer unknown or varying.
  11205. Filter selects among @samp{t} and @samp{p} using image analysis.
  11206. @item B
  11207. Capture bottom-first, transfer unknown or varying.
  11208. Filter selects among @samp{b} and @samp{p} using image analysis.
  11209. @item A
  11210. Capture determined by field flags, transfer unknown or varying.
  11211. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11212. image analysis. If no field information is available, then this works just
  11213. like @samp{U}. This is the default mode.
  11214. @item U
  11215. Both capture and transfer unknown or varying.
  11216. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11217. @end table
  11218. @end table
  11219. @section photosensitivity
  11220. Reduce various flashes in video, so to help users with epilepsy.
  11221. It accepts the following options:
  11222. @table @option
  11223. @item frames, f
  11224. Set how many frames to use when filtering. Default is 30.
  11225. @item threshold, t
  11226. Set detection threshold factor. Default is 1.
  11227. Lower is stricter.
  11228. @item skip
  11229. Set how many pixels to skip when sampling frames. Default is 1.
  11230. Allowed range is from 1 to 1024.
  11231. @item bypass
  11232. Leave frames unchanged. Default is disabled.
  11233. @end table
  11234. @section pixdesctest
  11235. Pixel format descriptor test filter, mainly useful for internal
  11236. testing. The output video should be equal to the input video.
  11237. For example:
  11238. @example
  11239. format=monow, pixdesctest
  11240. @end example
  11241. can be used to test the monowhite pixel format descriptor definition.
  11242. @section pixscope
  11243. Display sample values of color channels. Mainly useful for checking color
  11244. and levels. Minimum supported resolution is 640x480.
  11245. The filters accept the following options:
  11246. @table @option
  11247. @item x
  11248. Set scope X position, relative offset on X axis.
  11249. @item y
  11250. Set scope Y position, relative offset on Y axis.
  11251. @item w
  11252. Set scope width.
  11253. @item h
  11254. Set scope height.
  11255. @item o
  11256. Set window opacity. This window also holds statistics about pixel area.
  11257. @item wx
  11258. Set window X position, relative offset on X axis.
  11259. @item wy
  11260. Set window Y position, relative offset on Y axis.
  11261. @end table
  11262. @section pp
  11263. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11264. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11265. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11266. Each subfilter and some options have a short and a long name that can be used
  11267. interchangeably, i.e. dr/dering are the same.
  11268. The filters accept the following options:
  11269. @table @option
  11270. @item subfilters
  11271. Set postprocessing subfilters string.
  11272. @end table
  11273. All subfilters share common options to determine their scope:
  11274. @table @option
  11275. @item a/autoq
  11276. Honor the quality commands for this subfilter.
  11277. @item c/chrom
  11278. Do chrominance filtering, too (default).
  11279. @item y/nochrom
  11280. Do luminance filtering only (no chrominance).
  11281. @item n/noluma
  11282. Do chrominance filtering only (no luminance).
  11283. @end table
  11284. These options can be appended after the subfilter name, separated by a '|'.
  11285. Available subfilters are:
  11286. @table @option
  11287. @item hb/hdeblock[|difference[|flatness]]
  11288. Horizontal deblocking filter
  11289. @table @option
  11290. @item difference
  11291. Difference factor where higher values mean more deblocking (default: @code{32}).
  11292. @item flatness
  11293. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11294. @end table
  11295. @item vb/vdeblock[|difference[|flatness]]
  11296. Vertical deblocking filter
  11297. @table @option
  11298. @item difference
  11299. Difference factor where higher values mean more deblocking (default: @code{32}).
  11300. @item flatness
  11301. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11302. @end table
  11303. @item ha/hadeblock[|difference[|flatness]]
  11304. Accurate horizontal deblocking filter
  11305. @table @option
  11306. @item difference
  11307. Difference factor where higher values mean more deblocking (default: @code{32}).
  11308. @item flatness
  11309. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11310. @end table
  11311. @item va/vadeblock[|difference[|flatness]]
  11312. Accurate vertical deblocking filter
  11313. @table @option
  11314. @item difference
  11315. Difference factor where higher values mean more deblocking (default: @code{32}).
  11316. @item flatness
  11317. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11318. @end table
  11319. @end table
  11320. The horizontal and vertical deblocking filters share the difference and
  11321. flatness values so you cannot set different horizontal and vertical
  11322. thresholds.
  11323. @table @option
  11324. @item h1/x1hdeblock
  11325. Experimental horizontal deblocking filter
  11326. @item v1/x1vdeblock
  11327. Experimental vertical deblocking filter
  11328. @item dr/dering
  11329. Deringing filter
  11330. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11331. @table @option
  11332. @item threshold1
  11333. larger -> stronger filtering
  11334. @item threshold2
  11335. larger -> stronger filtering
  11336. @item threshold3
  11337. larger -> stronger filtering
  11338. @end table
  11339. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11340. @table @option
  11341. @item f/fullyrange
  11342. Stretch luminance to @code{0-255}.
  11343. @end table
  11344. @item lb/linblenddeint
  11345. Linear blend deinterlacing filter that deinterlaces the given block by
  11346. filtering all lines with a @code{(1 2 1)} filter.
  11347. @item li/linipoldeint
  11348. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11349. linearly interpolating every second line.
  11350. @item ci/cubicipoldeint
  11351. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11352. cubically interpolating every second line.
  11353. @item md/mediandeint
  11354. Median deinterlacing filter that deinterlaces the given block by applying a
  11355. median filter to every second line.
  11356. @item fd/ffmpegdeint
  11357. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11358. second line with a @code{(-1 4 2 4 -1)} filter.
  11359. @item l5/lowpass5
  11360. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11361. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11362. @item fq/forceQuant[|quantizer]
  11363. Overrides the quantizer table from the input with the constant quantizer you
  11364. specify.
  11365. @table @option
  11366. @item quantizer
  11367. Quantizer to use
  11368. @end table
  11369. @item de/default
  11370. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11371. @item fa/fast
  11372. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11373. @item ac
  11374. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11375. @end table
  11376. @subsection Examples
  11377. @itemize
  11378. @item
  11379. Apply horizontal and vertical deblocking, deringing and automatic
  11380. brightness/contrast:
  11381. @example
  11382. pp=hb/vb/dr/al
  11383. @end example
  11384. @item
  11385. Apply default filters without brightness/contrast correction:
  11386. @example
  11387. pp=de/-al
  11388. @end example
  11389. @item
  11390. Apply default filters and temporal denoiser:
  11391. @example
  11392. pp=default/tmpnoise|1|2|3
  11393. @end example
  11394. @item
  11395. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11396. automatically depending on available CPU time:
  11397. @example
  11398. pp=hb|y/vb|a
  11399. @end example
  11400. @end itemize
  11401. @section pp7
  11402. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11403. similar to spp = 6 with 7 point DCT, where only the center sample is
  11404. used after IDCT.
  11405. The filter accepts the following options:
  11406. @table @option
  11407. @item qp
  11408. Force a constant quantization parameter. It accepts an integer in range
  11409. 0 to 63. If not set, the filter will use the QP from the video stream
  11410. (if available).
  11411. @item mode
  11412. Set thresholding mode. Available modes are:
  11413. @table @samp
  11414. @item hard
  11415. Set hard thresholding.
  11416. @item soft
  11417. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11418. @item medium
  11419. Set medium thresholding (good results, default).
  11420. @end table
  11421. @end table
  11422. @section premultiply
  11423. Apply alpha premultiply effect to input video stream using first plane
  11424. of second stream as alpha.
  11425. Both streams must have same dimensions and same pixel format.
  11426. The filter accepts the following option:
  11427. @table @option
  11428. @item planes
  11429. Set which planes will be processed, unprocessed planes will be copied.
  11430. By default value 0xf, all planes will be processed.
  11431. @item inplace
  11432. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11433. @end table
  11434. @section prewitt
  11435. Apply prewitt operator to input video stream.
  11436. The filter accepts the following option:
  11437. @table @option
  11438. @item planes
  11439. Set which planes will be processed, unprocessed planes will be copied.
  11440. By default value 0xf, all planes will be processed.
  11441. @item scale
  11442. Set value which will be multiplied with filtered result.
  11443. @item delta
  11444. Set value which will be added to filtered result.
  11445. @end table
  11446. @anchor{program_opencl}
  11447. @section program_opencl
  11448. Filter video using an OpenCL program.
  11449. @table @option
  11450. @item source
  11451. OpenCL program source file.
  11452. @item kernel
  11453. Kernel name in program.
  11454. @item inputs
  11455. Number of inputs to the filter. Defaults to 1.
  11456. @item size, s
  11457. Size of output frames. Defaults to the same as the first input.
  11458. @end table
  11459. The program source file must contain a kernel function with the given name,
  11460. which will be run once for each plane of the output. Each run on a plane
  11461. gets enqueued as a separate 2D global NDRange with one work-item for each
  11462. pixel to be generated. The global ID offset for each work-item is therefore
  11463. the coordinates of a pixel in the destination image.
  11464. The kernel function needs to take the following arguments:
  11465. @itemize
  11466. @item
  11467. Destination image, @var{__write_only image2d_t}.
  11468. This image will become the output; the kernel should write all of it.
  11469. @item
  11470. Frame index, @var{unsigned int}.
  11471. This is a counter starting from zero and increasing by one for each frame.
  11472. @item
  11473. Source images, @var{__read_only image2d_t}.
  11474. These are the most recent images on each input. The kernel may read from
  11475. them to generate the output, but they can't be written to.
  11476. @end itemize
  11477. Example programs:
  11478. @itemize
  11479. @item
  11480. Copy the input to the output (output must be the same size as the input).
  11481. @verbatim
  11482. __kernel void copy(__write_only image2d_t destination,
  11483. unsigned int index,
  11484. __read_only image2d_t source)
  11485. {
  11486. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  11487. int2 location = (int2)(get_global_id(0), get_global_id(1));
  11488. float4 value = read_imagef(source, sampler, location);
  11489. write_imagef(destination, location, value);
  11490. }
  11491. @end verbatim
  11492. @item
  11493. Apply a simple transformation, rotating the input by an amount increasing
  11494. with the index counter. Pixel values are linearly interpolated by the
  11495. sampler, and the output need not have the same dimensions as the input.
  11496. @verbatim
  11497. __kernel void rotate_image(__write_only image2d_t dst,
  11498. unsigned int index,
  11499. __read_only image2d_t src)
  11500. {
  11501. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11502. CLK_FILTER_LINEAR);
  11503. float angle = (float)index / 100.0f;
  11504. float2 dst_dim = convert_float2(get_image_dim(dst));
  11505. float2 src_dim = convert_float2(get_image_dim(src));
  11506. float2 dst_cen = dst_dim / 2.0f;
  11507. float2 src_cen = src_dim / 2.0f;
  11508. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11509. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11510. float2 src_pos = {
  11511. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11512. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11513. };
  11514. src_pos = src_pos * src_dim / dst_dim;
  11515. float2 src_loc = src_pos + src_cen;
  11516. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11517. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11518. write_imagef(dst, dst_loc, 0.5f);
  11519. else
  11520. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11521. }
  11522. @end verbatim
  11523. @item
  11524. Blend two inputs together, with the amount of each input used varying
  11525. with the index counter.
  11526. @verbatim
  11527. __kernel void blend_images(__write_only image2d_t dst,
  11528. unsigned int index,
  11529. __read_only image2d_t src1,
  11530. __read_only image2d_t src2)
  11531. {
  11532. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11533. CLK_FILTER_LINEAR);
  11534. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11535. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11536. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11537. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11538. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11539. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11540. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11541. }
  11542. @end verbatim
  11543. @end itemize
  11544. @section pseudocolor
  11545. Alter frame colors in video with pseudocolors.
  11546. This filter accepts the following options:
  11547. @table @option
  11548. @item c0
  11549. set pixel first component expression
  11550. @item c1
  11551. set pixel second component expression
  11552. @item c2
  11553. set pixel third component expression
  11554. @item c3
  11555. set pixel fourth component expression, corresponds to the alpha component
  11556. @item i
  11557. set component to use as base for altering colors
  11558. @end table
  11559. Each of them specifies the expression to use for computing the lookup table for
  11560. the corresponding pixel component values.
  11561. The expressions can contain the following constants and functions:
  11562. @table @option
  11563. @item w
  11564. @item h
  11565. The input width and height.
  11566. @item val
  11567. The input value for the pixel component.
  11568. @item ymin, umin, vmin, amin
  11569. The minimum allowed component value.
  11570. @item ymax, umax, vmax, amax
  11571. The maximum allowed component value.
  11572. @end table
  11573. All expressions default to "val".
  11574. @subsection Examples
  11575. @itemize
  11576. @item
  11577. Change too high luma values to gradient:
  11578. @example
  11579. 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'"
  11580. @end example
  11581. @end itemize
  11582. @section psnr
  11583. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11584. Ratio) between two input videos.
  11585. This filter takes in input two input videos, the first input is
  11586. considered the "main" source and is passed unchanged to the
  11587. output. The second input is used as a "reference" video for computing
  11588. the PSNR.
  11589. Both video inputs must have the same resolution and pixel format for
  11590. this filter to work correctly. Also it assumes that both inputs
  11591. have the same number of frames, which are compared one by one.
  11592. The obtained average PSNR is printed through the logging system.
  11593. The filter stores the accumulated MSE (mean squared error) of each
  11594. frame, and at the end of the processing it is averaged across all frames
  11595. equally, and the following formula is applied to obtain the PSNR:
  11596. @example
  11597. PSNR = 10*log10(MAX^2/MSE)
  11598. @end example
  11599. Where MAX is the average of the maximum values of each component of the
  11600. image.
  11601. The description of the accepted parameters follows.
  11602. @table @option
  11603. @item stats_file, f
  11604. If specified the filter will use the named file to save the PSNR of
  11605. each individual frame. When filename equals "-" the data is sent to
  11606. standard output.
  11607. @item stats_version
  11608. Specifies which version of the stats file format to use. Details of
  11609. each format are written below.
  11610. Default value is 1.
  11611. @item stats_add_max
  11612. Determines whether the max value is output to the stats log.
  11613. Default value is 0.
  11614. Requires stats_version >= 2. If this is set and stats_version < 2,
  11615. the filter will return an error.
  11616. @end table
  11617. This filter also supports the @ref{framesync} options.
  11618. The file printed if @var{stats_file} is selected, contains a sequence of
  11619. key/value pairs of the form @var{key}:@var{value} for each compared
  11620. couple of frames.
  11621. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11622. the list of per-frame-pair stats, with key value pairs following the frame
  11623. format with the following parameters:
  11624. @table @option
  11625. @item psnr_log_version
  11626. The version of the log file format. Will match @var{stats_version}.
  11627. @item fields
  11628. A comma separated list of the per-frame-pair parameters included in
  11629. the log.
  11630. @end table
  11631. A description of each shown per-frame-pair parameter follows:
  11632. @table @option
  11633. @item n
  11634. sequential number of the input frame, starting from 1
  11635. @item mse_avg
  11636. Mean Square Error pixel-by-pixel average difference of the compared
  11637. frames, averaged over all the image components.
  11638. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11639. Mean Square Error pixel-by-pixel average difference of the compared
  11640. frames for the component specified by the suffix.
  11641. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11642. Peak Signal to Noise ratio of the compared frames for the component
  11643. specified by the suffix.
  11644. @item max_avg, max_y, max_u, max_v
  11645. Maximum allowed value for each channel, and average over all
  11646. channels.
  11647. @end table
  11648. @subsection Examples
  11649. @itemize
  11650. @item
  11651. For example:
  11652. @example
  11653. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11654. [main][ref] psnr="stats_file=stats.log" [out]
  11655. @end example
  11656. On this example the input file being processed is compared with the
  11657. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11658. is stored in @file{stats.log}.
  11659. @item
  11660. Another example with different containers:
  11661. @example
  11662. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
  11663. @end example
  11664. @end itemize
  11665. @anchor{pullup}
  11666. @section pullup
  11667. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11668. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11669. content.
  11670. The pullup filter is designed to take advantage of future context in making
  11671. its decisions. This filter is stateless in the sense that it does not lock
  11672. onto a pattern to follow, but it instead looks forward to the following
  11673. fields in order to identify matches and rebuild progressive frames.
  11674. To produce content with an even framerate, insert the fps filter after
  11675. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11676. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11677. The filter accepts the following options:
  11678. @table @option
  11679. @item jl
  11680. @item jr
  11681. @item jt
  11682. @item jb
  11683. These options set the amount of "junk" to ignore at the left, right, top, and
  11684. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11685. while top and bottom are in units of 2 lines.
  11686. The default is 8 pixels on each side.
  11687. @item sb
  11688. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11689. filter generating an occasional mismatched frame, but it may also cause an
  11690. excessive number of frames to be dropped during high motion sequences.
  11691. Conversely, setting it to -1 will make filter match fields more easily.
  11692. This may help processing of video where there is slight blurring between
  11693. the fields, but may also cause there to be interlaced frames in the output.
  11694. Default value is @code{0}.
  11695. @item mp
  11696. Set the metric plane to use. It accepts the following values:
  11697. @table @samp
  11698. @item l
  11699. Use luma plane.
  11700. @item u
  11701. Use chroma blue plane.
  11702. @item v
  11703. Use chroma red plane.
  11704. @end table
  11705. This option may be set to use chroma plane instead of the default luma plane
  11706. for doing filter's computations. This may improve accuracy on very clean
  11707. source material, but more likely will decrease accuracy, especially if there
  11708. is chroma noise (rainbow effect) or any grayscale video.
  11709. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11710. load and make pullup usable in realtime on slow machines.
  11711. @end table
  11712. For best results (without duplicated frames in the output file) it is
  11713. necessary to change the output frame rate. For example, to inverse
  11714. telecine NTSC input:
  11715. @example
  11716. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11717. @end example
  11718. @section qp
  11719. Change video quantization parameters (QP).
  11720. The filter accepts the following option:
  11721. @table @option
  11722. @item qp
  11723. Set expression for quantization parameter.
  11724. @end table
  11725. The expression is evaluated through the eval API and can contain, among others,
  11726. the following constants:
  11727. @table @var
  11728. @item known
  11729. 1 if index is not 129, 0 otherwise.
  11730. @item qp
  11731. Sequential index starting from -129 to 128.
  11732. @end table
  11733. @subsection Examples
  11734. @itemize
  11735. @item
  11736. Some equation like:
  11737. @example
  11738. qp=2+2*sin(PI*qp)
  11739. @end example
  11740. @end itemize
  11741. @section random
  11742. Flush video frames from internal cache of frames into a random order.
  11743. No frame is discarded.
  11744. Inspired by @ref{frei0r} nervous filter.
  11745. @table @option
  11746. @item frames
  11747. Set size in number of frames of internal cache, in range from @code{2} to
  11748. @code{512}. Default is @code{30}.
  11749. @item seed
  11750. Set seed for random number generator, must be an integer included between
  11751. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11752. less than @code{0}, the filter will try to use a good random seed on a
  11753. best effort basis.
  11754. @end table
  11755. @section readeia608
  11756. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11757. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11758. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11759. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11760. @table @option
  11761. @item lavfi.readeia608.X.cc
  11762. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11763. @item lavfi.readeia608.X.line
  11764. The number of the line on which the EIA-608 data was identified and read.
  11765. @end table
  11766. This filter accepts the following options:
  11767. @table @option
  11768. @item scan_min
  11769. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11770. @item scan_max
  11771. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11772. @item spw
  11773. Set the ratio of width reserved for sync code detection.
  11774. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  11775. @item chp
  11776. Enable checking the parity bit. In the event of a parity error, the filter will output
  11777. @code{0x00} for that character. Default is false.
  11778. @item lp
  11779. Lowpass lines prior to further processing. Default is enabled.
  11780. @end table
  11781. @subsection Examples
  11782. @itemize
  11783. @item
  11784. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11785. @example
  11786. 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
  11787. @end example
  11788. @end itemize
  11789. @section readvitc
  11790. Read vertical interval timecode (VITC) information from the top lines of a
  11791. video frame.
  11792. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11793. timecode value, if a valid timecode has been detected. Further metadata key
  11794. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11795. timecode data has been found or not.
  11796. This filter accepts the following options:
  11797. @table @option
  11798. @item scan_max
  11799. Set the maximum number of lines to scan for VITC data. If the value is set to
  11800. @code{-1} the full video frame is scanned. Default is @code{45}.
  11801. @item thr_b
  11802. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11803. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11804. @item thr_w
  11805. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11806. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11807. @end table
  11808. @subsection Examples
  11809. @itemize
  11810. @item
  11811. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11812. draw @code{--:--:--:--} as a placeholder:
  11813. @example
  11814. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11815. @end example
  11816. @end itemize
  11817. @section remap
  11818. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11819. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11820. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11821. value for pixel will be used for destination pixel.
  11822. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11823. will have Xmap/Ymap video stream dimensions.
  11824. Xmap and Ymap input video streams are 16bit depth, single channel.
  11825. @table @option
  11826. @item format
  11827. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11828. Default is @code{color}.
  11829. @end table
  11830. @section removegrain
  11831. The removegrain filter is a spatial denoiser for progressive video.
  11832. @table @option
  11833. @item m0
  11834. Set mode for the first plane.
  11835. @item m1
  11836. Set mode for the second plane.
  11837. @item m2
  11838. Set mode for the third plane.
  11839. @item m3
  11840. Set mode for the fourth plane.
  11841. @end table
  11842. Range of mode is from 0 to 24. Description of each mode follows:
  11843. @table @var
  11844. @item 0
  11845. Leave input plane unchanged. Default.
  11846. @item 1
  11847. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11848. @item 2
  11849. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11850. @item 3
  11851. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11852. @item 4
  11853. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11854. This is equivalent to a median filter.
  11855. @item 5
  11856. Line-sensitive clipping giving the minimal change.
  11857. @item 6
  11858. Line-sensitive clipping, intermediate.
  11859. @item 7
  11860. Line-sensitive clipping, intermediate.
  11861. @item 8
  11862. Line-sensitive clipping, intermediate.
  11863. @item 9
  11864. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11865. @item 10
  11866. Replaces the target pixel with the closest neighbour.
  11867. @item 11
  11868. [1 2 1] horizontal and vertical kernel blur.
  11869. @item 12
  11870. Same as mode 11.
  11871. @item 13
  11872. Bob mode, interpolates top field from the line where the neighbours
  11873. pixels are the closest.
  11874. @item 14
  11875. Bob mode, interpolates bottom field from the line where the neighbours
  11876. pixels are the closest.
  11877. @item 15
  11878. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11879. interpolation formula.
  11880. @item 16
  11881. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11882. interpolation formula.
  11883. @item 17
  11884. Clips the pixel with the minimum and maximum of respectively the maximum and
  11885. minimum of each pair of opposite neighbour pixels.
  11886. @item 18
  11887. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11888. the current pixel is minimal.
  11889. @item 19
  11890. Replaces the pixel with the average of its 8 neighbours.
  11891. @item 20
  11892. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11893. @item 21
  11894. Clips pixels using the averages of opposite neighbour.
  11895. @item 22
  11896. Same as mode 21 but simpler and faster.
  11897. @item 23
  11898. Small edge and halo removal, but reputed useless.
  11899. @item 24
  11900. Similar as 23.
  11901. @end table
  11902. @section removelogo
  11903. Suppress a TV station logo, using an image file to determine which
  11904. pixels comprise the logo. It works by filling in the pixels that
  11905. comprise the logo with neighboring pixels.
  11906. The filter accepts the following options:
  11907. @table @option
  11908. @item filename, f
  11909. Set the filter bitmap file, which can be any image format supported by
  11910. libavformat. The width and height of the image file must match those of the
  11911. video stream being processed.
  11912. @end table
  11913. Pixels in the provided bitmap image with a value of zero are not
  11914. considered part of the logo, non-zero pixels are considered part of
  11915. the logo. If you use white (255) for the logo and black (0) for the
  11916. rest, you will be safe. For making the filter bitmap, it is
  11917. recommended to take a screen capture of a black frame with the logo
  11918. visible, and then using a threshold filter followed by the erode
  11919. filter once or twice.
  11920. If needed, little splotches can be fixed manually. Remember that if
  11921. logo pixels are not covered, the filter quality will be much
  11922. reduced. Marking too many pixels as part of the logo does not hurt as
  11923. much, but it will increase the amount of blurring needed to cover over
  11924. the image and will destroy more information than necessary, and extra
  11925. pixels will slow things down on a large logo.
  11926. @section repeatfields
  11927. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11928. fields based on its value.
  11929. @section reverse
  11930. Reverse a video clip.
  11931. Warning: This filter requires memory to buffer the entire clip, so trimming
  11932. is suggested.
  11933. @subsection Examples
  11934. @itemize
  11935. @item
  11936. Take the first 5 seconds of a clip, and reverse it.
  11937. @example
  11938. trim=end=5,reverse
  11939. @end example
  11940. @end itemize
  11941. @section rgbashift
  11942. Shift R/G/B/A pixels horizontally and/or vertically.
  11943. The filter accepts the following options:
  11944. @table @option
  11945. @item rh
  11946. Set amount to shift red horizontally.
  11947. @item rv
  11948. Set amount to shift red vertically.
  11949. @item gh
  11950. Set amount to shift green horizontally.
  11951. @item gv
  11952. Set amount to shift green vertically.
  11953. @item bh
  11954. Set amount to shift blue horizontally.
  11955. @item bv
  11956. Set amount to shift blue vertically.
  11957. @item ah
  11958. Set amount to shift alpha horizontally.
  11959. @item av
  11960. Set amount to shift alpha vertically.
  11961. @item edge
  11962. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11963. @end table
  11964. @subsection Commands
  11965. This filter supports the all above options as @ref{commands}.
  11966. @section roberts
  11967. Apply roberts cross operator to input video stream.
  11968. The filter accepts the following option:
  11969. @table @option
  11970. @item planes
  11971. Set which planes will be processed, unprocessed planes will be copied.
  11972. By default value 0xf, all planes will be processed.
  11973. @item scale
  11974. Set value which will be multiplied with filtered result.
  11975. @item delta
  11976. Set value which will be added to filtered result.
  11977. @end table
  11978. @section rotate
  11979. Rotate video by an arbitrary angle expressed in radians.
  11980. The filter accepts the following options:
  11981. A description of the optional parameters follows.
  11982. @table @option
  11983. @item angle, a
  11984. Set an expression for the angle by which to rotate the input video
  11985. clockwise, expressed as a number of radians. A negative value will
  11986. result in a counter-clockwise rotation. By default it is set to "0".
  11987. This expression is evaluated for each frame.
  11988. @item out_w, ow
  11989. Set the output width expression, default value is "iw".
  11990. This expression is evaluated just once during configuration.
  11991. @item out_h, oh
  11992. Set the output height expression, default value is "ih".
  11993. This expression is evaluated just once during configuration.
  11994. @item bilinear
  11995. Enable bilinear interpolation if set to 1, a value of 0 disables
  11996. it. Default value is 1.
  11997. @item fillcolor, c
  11998. Set the color used to fill the output area not covered by the rotated
  11999. image. For the general syntax of this option, check the
  12000. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12001. If the special value "none" is selected then no
  12002. background is printed (useful for example if the background is never shown).
  12003. Default value is "black".
  12004. @end table
  12005. The expressions for the angle and the output size can contain the
  12006. following constants and functions:
  12007. @table @option
  12008. @item n
  12009. sequential number of the input frame, starting from 0. It is always NAN
  12010. before the first frame is filtered.
  12011. @item t
  12012. time in seconds of the input frame, it is set to 0 when the filter is
  12013. configured. It is always NAN before the first frame is filtered.
  12014. @item hsub
  12015. @item vsub
  12016. horizontal and vertical chroma subsample values. For example for the
  12017. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12018. @item in_w, iw
  12019. @item in_h, ih
  12020. the input video width and height
  12021. @item out_w, ow
  12022. @item out_h, oh
  12023. the output width and height, that is the size of the padded area as
  12024. specified by the @var{width} and @var{height} expressions
  12025. @item rotw(a)
  12026. @item roth(a)
  12027. the minimal width/height required for completely containing the input
  12028. video rotated by @var{a} radians.
  12029. These are only available when computing the @option{out_w} and
  12030. @option{out_h} expressions.
  12031. @end table
  12032. @subsection Examples
  12033. @itemize
  12034. @item
  12035. Rotate the input by PI/6 radians clockwise:
  12036. @example
  12037. rotate=PI/6
  12038. @end example
  12039. @item
  12040. Rotate the input by PI/6 radians counter-clockwise:
  12041. @example
  12042. rotate=-PI/6
  12043. @end example
  12044. @item
  12045. Rotate the input by 45 degrees clockwise:
  12046. @example
  12047. rotate=45*PI/180
  12048. @end example
  12049. @item
  12050. Apply a constant rotation with period T, starting from an angle of PI/3:
  12051. @example
  12052. rotate=PI/3+2*PI*t/T
  12053. @end example
  12054. @item
  12055. Make the input video rotation oscillating with a period of T
  12056. seconds and an amplitude of A radians:
  12057. @example
  12058. rotate=A*sin(2*PI/T*t)
  12059. @end example
  12060. @item
  12061. Rotate the video, output size is chosen so that the whole rotating
  12062. input video is always completely contained in the output:
  12063. @example
  12064. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12065. @end example
  12066. @item
  12067. Rotate the video, reduce the output size so that no background is ever
  12068. shown:
  12069. @example
  12070. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12071. @end example
  12072. @end itemize
  12073. @subsection Commands
  12074. The filter supports the following commands:
  12075. @table @option
  12076. @item a, angle
  12077. Set the angle expression.
  12078. The command accepts the same syntax of the corresponding option.
  12079. If the specified expression is not valid, it is kept at its current
  12080. value.
  12081. @end table
  12082. @section sab
  12083. Apply Shape Adaptive Blur.
  12084. The filter accepts the following options:
  12085. @table @option
  12086. @item luma_radius, lr
  12087. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12088. value is 1.0. A greater value will result in a more blurred image, and
  12089. in slower processing.
  12090. @item luma_pre_filter_radius, lpfr
  12091. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12092. value is 1.0.
  12093. @item luma_strength, ls
  12094. Set luma maximum difference between pixels to still be considered, must
  12095. be a value in the 0.1-100.0 range, default value is 1.0.
  12096. @item chroma_radius, cr
  12097. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12098. greater value will result in a more blurred image, and in slower
  12099. processing.
  12100. @item chroma_pre_filter_radius, cpfr
  12101. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12102. @item chroma_strength, cs
  12103. Set chroma maximum difference between pixels to still be considered,
  12104. must be a value in the -0.9-100.0 range.
  12105. @end table
  12106. Each chroma option value, if not explicitly specified, is set to the
  12107. corresponding luma option value.
  12108. @anchor{scale}
  12109. @section scale
  12110. Scale (resize) the input video, using the libswscale library.
  12111. The scale filter forces the output display aspect ratio to be the same
  12112. of the input, by changing the output sample aspect ratio.
  12113. If the input image format is different from the format requested by
  12114. the next filter, the scale filter will convert the input to the
  12115. requested format.
  12116. @subsection Options
  12117. The filter accepts the following options, or any of the options
  12118. supported by the libswscale scaler.
  12119. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12120. the complete list of scaler options.
  12121. @table @option
  12122. @item width, w
  12123. @item height, h
  12124. Set the output video dimension expression. Default value is the input
  12125. dimension.
  12126. If the @var{width} or @var{w} value is 0, the input width is used for
  12127. the output. If the @var{height} or @var{h} value is 0, the input height
  12128. is used for the output.
  12129. If one and only one of the values is -n with n >= 1, the scale filter
  12130. will use a value that maintains the aspect ratio of the input image,
  12131. calculated from the other specified dimension. After that it will,
  12132. however, make sure that the calculated dimension is divisible by n and
  12133. adjust the value if necessary.
  12134. If both values are -n with n >= 1, the behavior will be identical to
  12135. both values being set to 0 as previously detailed.
  12136. See below for the list of accepted constants for use in the dimension
  12137. expression.
  12138. @item eval
  12139. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12140. @table @samp
  12141. @item init
  12142. Only evaluate expressions once during the filter initialization or when a command is processed.
  12143. @item frame
  12144. Evaluate expressions for each incoming frame.
  12145. @end table
  12146. Default value is @samp{init}.
  12147. @item interl
  12148. Set the interlacing mode. It accepts the following values:
  12149. @table @samp
  12150. @item 1
  12151. Force interlaced aware scaling.
  12152. @item 0
  12153. Do not apply interlaced scaling.
  12154. @item -1
  12155. Select interlaced aware scaling depending on whether the source frames
  12156. are flagged as interlaced or not.
  12157. @end table
  12158. Default value is @samp{0}.
  12159. @item flags
  12160. Set libswscale scaling flags. See
  12161. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12162. complete list of values. If not explicitly specified the filter applies
  12163. the default flags.
  12164. @item param0, param1
  12165. Set libswscale input parameters for scaling algorithms that need them. See
  12166. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12167. complete documentation. If not explicitly specified the filter applies
  12168. empty parameters.
  12169. @item size, s
  12170. Set the video size. For the syntax of this option, check the
  12171. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12172. @item in_color_matrix
  12173. @item out_color_matrix
  12174. Set in/output YCbCr color space type.
  12175. This allows the autodetected value to be overridden as well as allows forcing
  12176. a specific value used for the output and encoder.
  12177. If not specified, the color space type depends on the pixel format.
  12178. Possible values:
  12179. @table @samp
  12180. @item auto
  12181. Choose automatically.
  12182. @item bt709
  12183. Format conforming to International Telecommunication Union (ITU)
  12184. Recommendation BT.709.
  12185. @item fcc
  12186. Set color space conforming to the United States Federal Communications
  12187. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12188. @item bt601
  12189. @item bt470
  12190. @item smpte170m
  12191. Set color space conforming to:
  12192. @itemize
  12193. @item
  12194. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12195. @item
  12196. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12197. @item
  12198. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12199. @end itemize
  12200. @item smpte240m
  12201. Set color space conforming to SMPTE ST 240:1999.
  12202. @item bt2020
  12203. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12204. @end table
  12205. @item in_range
  12206. @item out_range
  12207. Set in/output YCbCr sample range.
  12208. This allows the autodetected value to be overridden as well as allows forcing
  12209. a specific value used for the output and encoder. If not specified, the
  12210. range depends on the pixel format. Possible values:
  12211. @table @samp
  12212. @item auto/unknown
  12213. Choose automatically.
  12214. @item jpeg/full/pc
  12215. Set full range (0-255 in case of 8-bit luma).
  12216. @item mpeg/limited/tv
  12217. Set "MPEG" range (16-235 in case of 8-bit luma).
  12218. @end table
  12219. @item force_original_aspect_ratio
  12220. Enable decreasing or increasing output video width or height if necessary to
  12221. keep the original aspect ratio. Possible values:
  12222. @table @samp
  12223. @item disable
  12224. Scale the video as specified and disable this feature.
  12225. @item decrease
  12226. The output video dimensions will automatically be decreased if needed.
  12227. @item increase
  12228. The output video dimensions will automatically be increased if needed.
  12229. @end table
  12230. One useful instance of this option is that when you know a specific device's
  12231. maximum allowed resolution, you can use this to limit the output video to
  12232. that, while retaining the aspect ratio. For example, device A allows
  12233. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12234. decrease) and specifying 1280x720 to the command line makes the output
  12235. 1280x533.
  12236. Please note that this is a different thing than specifying -1 for @option{w}
  12237. or @option{h}, you still need to specify the output resolution for this option
  12238. to work.
  12239. @item force_divisible_by
  12240. Ensures that both the output dimensions, width and height, are divisible by the
  12241. given integer when used together with @option{force_original_aspect_ratio}. This
  12242. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12243. This option respects the value set for @option{force_original_aspect_ratio},
  12244. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12245. may be slightly modified.
  12246. This option can be handy if you need to have a video fit within or exceed
  12247. a defined resolution using @option{force_original_aspect_ratio} but also have
  12248. encoder restrictions on width or height divisibility.
  12249. @end table
  12250. The values of the @option{w} and @option{h} options are expressions
  12251. containing the following constants:
  12252. @table @var
  12253. @item in_w
  12254. @item in_h
  12255. The input width and height
  12256. @item iw
  12257. @item ih
  12258. These are the same as @var{in_w} and @var{in_h}.
  12259. @item out_w
  12260. @item out_h
  12261. The output (scaled) width and height
  12262. @item ow
  12263. @item oh
  12264. These are the same as @var{out_w} and @var{out_h}
  12265. @item a
  12266. The same as @var{iw} / @var{ih}
  12267. @item sar
  12268. input sample aspect ratio
  12269. @item dar
  12270. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12271. @item hsub
  12272. @item vsub
  12273. horizontal and vertical input chroma subsample values. For example for the
  12274. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12275. @item ohsub
  12276. @item ovsub
  12277. horizontal and vertical output chroma subsample values. For example for the
  12278. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12279. @end table
  12280. @subsection Examples
  12281. @itemize
  12282. @item
  12283. Scale the input video to a size of 200x100
  12284. @example
  12285. scale=w=200:h=100
  12286. @end example
  12287. This is equivalent to:
  12288. @example
  12289. scale=200:100
  12290. @end example
  12291. or:
  12292. @example
  12293. scale=200x100
  12294. @end example
  12295. @item
  12296. Specify a size abbreviation for the output size:
  12297. @example
  12298. scale=qcif
  12299. @end example
  12300. which can also be written as:
  12301. @example
  12302. scale=size=qcif
  12303. @end example
  12304. @item
  12305. Scale the input to 2x:
  12306. @example
  12307. scale=w=2*iw:h=2*ih
  12308. @end example
  12309. @item
  12310. The above is the same as:
  12311. @example
  12312. scale=2*in_w:2*in_h
  12313. @end example
  12314. @item
  12315. Scale the input to 2x with forced interlaced scaling:
  12316. @example
  12317. scale=2*iw:2*ih:interl=1
  12318. @end example
  12319. @item
  12320. Scale the input to half size:
  12321. @example
  12322. scale=w=iw/2:h=ih/2
  12323. @end example
  12324. @item
  12325. Increase the width, and set the height to the same size:
  12326. @example
  12327. scale=3/2*iw:ow
  12328. @end example
  12329. @item
  12330. Seek Greek harmony:
  12331. @example
  12332. scale=iw:1/PHI*iw
  12333. scale=ih*PHI:ih
  12334. @end example
  12335. @item
  12336. Increase the height, and set the width to 3/2 of the height:
  12337. @example
  12338. scale=w=3/2*oh:h=3/5*ih
  12339. @end example
  12340. @item
  12341. Increase the size, making the size a multiple of the chroma
  12342. subsample values:
  12343. @example
  12344. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12345. @end example
  12346. @item
  12347. Increase the width to a maximum of 500 pixels,
  12348. keeping the same aspect ratio as the input:
  12349. @example
  12350. scale=w='min(500\, iw*3/2):h=-1'
  12351. @end example
  12352. @item
  12353. Make pixels square by combining scale and setsar:
  12354. @example
  12355. scale='trunc(ih*dar):ih',setsar=1/1
  12356. @end example
  12357. @item
  12358. Make pixels square by combining scale and setsar,
  12359. making sure the resulting resolution is even (required by some codecs):
  12360. @example
  12361. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12362. @end example
  12363. @end itemize
  12364. @subsection Commands
  12365. This filter supports the following commands:
  12366. @table @option
  12367. @item width, w
  12368. @item height, h
  12369. Set the output video dimension expression.
  12370. The command accepts the same syntax of the corresponding option.
  12371. If the specified expression is not valid, it is kept at its current
  12372. value.
  12373. @end table
  12374. @section scale_npp
  12375. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12376. format conversion on CUDA video frames. Setting the output width and height
  12377. works in the same way as for the @var{scale} filter.
  12378. The following additional options are accepted:
  12379. @table @option
  12380. @item format
  12381. The pixel format of the output CUDA frames. If set to the string "same" (the
  12382. default), the input format will be kept. Note that automatic format negotiation
  12383. and conversion is not yet supported for hardware frames
  12384. @item interp_algo
  12385. The interpolation algorithm used for resizing. One of the following:
  12386. @table @option
  12387. @item nn
  12388. Nearest neighbour.
  12389. @item linear
  12390. @item cubic
  12391. @item cubic2p_bspline
  12392. 2-parameter cubic (B=1, C=0)
  12393. @item cubic2p_catmullrom
  12394. 2-parameter cubic (B=0, C=1/2)
  12395. @item cubic2p_b05c03
  12396. 2-parameter cubic (B=1/2, C=3/10)
  12397. @item super
  12398. Supersampling
  12399. @item lanczos
  12400. @end table
  12401. @item force_original_aspect_ratio
  12402. Enable decreasing or increasing output video width or height if necessary to
  12403. keep the original aspect ratio. Possible values:
  12404. @table @samp
  12405. @item disable
  12406. Scale the video as specified and disable this feature.
  12407. @item decrease
  12408. The output video dimensions will automatically be decreased if needed.
  12409. @item increase
  12410. The output video dimensions will automatically be increased if needed.
  12411. @end table
  12412. One useful instance of this option is that when you know a specific device's
  12413. maximum allowed resolution, you can use this to limit the output video to
  12414. that, while retaining the aspect ratio. For example, device A allows
  12415. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12416. decrease) and specifying 1280x720 to the command line makes the output
  12417. 1280x533.
  12418. Please note that this is a different thing than specifying -1 for @option{w}
  12419. or @option{h}, you still need to specify the output resolution for this option
  12420. to work.
  12421. @item force_divisible_by
  12422. Ensures that both the output dimensions, width and height, are divisible by the
  12423. given integer when used together with @option{force_original_aspect_ratio}. This
  12424. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12425. This option respects the value set for @option{force_original_aspect_ratio},
  12426. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12427. may be slightly modified.
  12428. This option can be handy if you need to have a video fit within or exceed
  12429. a defined resolution using @option{force_original_aspect_ratio} but also have
  12430. encoder restrictions on width or height divisibility.
  12431. @end table
  12432. @section scale2ref
  12433. Scale (resize) the input video, based on a reference video.
  12434. See the scale filter for available options, scale2ref supports the same but
  12435. uses the reference video instead of the main input as basis. scale2ref also
  12436. supports the following additional constants for the @option{w} and
  12437. @option{h} options:
  12438. @table @var
  12439. @item main_w
  12440. @item main_h
  12441. The main input video's width and height
  12442. @item main_a
  12443. The same as @var{main_w} / @var{main_h}
  12444. @item main_sar
  12445. The main input video's sample aspect ratio
  12446. @item main_dar, mdar
  12447. The main input video's display aspect ratio. Calculated from
  12448. @code{(main_w / main_h) * main_sar}.
  12449. @item main_hsub
  12450. @item main_vsub
  12451. The main input video's horizontal and vertical chroma subsample values.
  12452. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12453. is 1.
  12454. @end table
  12455. @subsection Examples
  12456. @itemize
  12457. @item
  12458. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12459. @example
  12460. 'scale2ref[b][a];[a][b]overlay'
  12461. @end example
  12462. @item
  12463. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12464. @example
  12465. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12466. @end example
  12467. @end itemize
  12468. @subsection Commands
  12469. This filter supports the following commands:
  12470. @table @option
  12471. @item width, w
  12472. @item height, h
  12473. Set the output video dimension expression.
  12474. The command accepts the same syntax of the corresponding option.
  12475. If the specified expression is not valid, it is kept at its current
  12476. value.
  12477. @end table
  12478. @section scroll
  12479. Scroll input video horizontally and/or vertically by constant speed.
  12480. The filter accepts the following options:
  12481. @table @option
  12482. @item horizontal, h
  12483. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12484. Negative values changes scrolling direction.
  12485. @item vertical, v
  12486. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12487. Negative values changes scrolling direction.
  12488. @item hpos
  12489. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12490. @item vpos
  12491. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12492. @end table
  12493. @subsection Commands
  12494. This filter supports the following @ref{commands}:
  12495. @table @option
  12496. @item horizontal, h
  12497. Set the horizontal scrolling speed.
  12498. @item vertical, v
  12499. Set the vertical scrolling speed.
  12500. @end table
  12501. @anchor{selectivecolor}
  12502. @section selectivecolor
  12503. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12504. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12505. by the "purity" of the color (that is, how saturated it already is).
  12506. This filter is similar to the Adobe Photoshop Selective Color tool.
  12507. The filter accepts the following options:
  12508. @table @option
  12509. @item correction_method
  12510. Select color correction method.
  12511. Available values are:
  12512. @table @samp
  12513. @item absolute
  12514. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12515. component value).
  12516. @item relative
  12517. Specified adjustments are relative to the original component value.
  12518. @end table
  12519. Default is @code{absolute}.
  12520. @item reds
  12521. Adjustments for red pixels (pixels where the red component is the maximum)
  12522. @item yellows
  12523. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12524. @item greens
  12525. Adjustments for green pixels (pixels where the green component is the maximum)
  12526. @item cyans
  12527. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12528. @item blues
  12529. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12530. @item magentas
  12531. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12532. @item whites
  12533. Adjustments for white pixels (pixels where all components are greater than 128)
  12534. @item neutrals
  12535. Adjustments for all pixels except pure black and pure white
  12536. @item blacks
  12537. Adjustments for black pixels (pixels where all components are lesser than 128)
  12538. @item psfile
  12539. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12540. @end table
  12541. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12542. 4 space separated floating point adjustment values in the [-1,1] range,
  12543. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12544. pixels of its range.
  12545. @subsection Examples
  12546. @itemize
  12547. @item
  12548. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12549. increase magenta by 27% in blue areas:
  12550. @example
  12551. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12552. @end example
  12553. @item
  12554. Use a Photoshop selective color preset:
  12555. @example
  12556. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12557. @end example
  12558. @end itemize
  12559. @anchor{separatefields}
  12560. @section separatefields
  12561. The @code{separatefields} takes a frame-based video input and splits
  12562. each frame into its components fields, producing a new half height clip
  12563. with twice the frame rate and twice the frame count.
  12564. This filter use field-dominance information in frame to decide which
  12565. of each pair of fields to place first in the output.
  12566. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12567. @section setdar, setsar
  12568. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12569. output video.
  12570. This is done by changing the specified Sample (aka Pixel) Aspect
  12571. Ratio, according to the following equation:
  12572. @example
  12573. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12574. @end example
  12575. Keep in mind that the @code{setdar} filter does not modify the pixel
  12576. dimensions of the video frame. Also, the display aspect ratio set by
  12577. this filter may be changed by later filters in the filterchain,
  12578. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12579. applied.
  12580. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12581. the filter output video.
  12582. Note that as a consequence of the application of this filter, the
  12583. output display aspect ratio will change according to the equation
  12584. above.
  12585. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12586. filter may be changed by later filters in the filterchain, e.g. if
  12587. another "setsar" or a "setdar" filter is applied.
  12588. It accepts the following parameters:
  12589. @table @option
  12590. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12591. Set the aspect ratio used by the filter.
  12592. The parameter can be a floating point number string, an expression, or
  12593. a string of the form @var{num}:@var{den}, where @var{num} and
  12594. @var{den} are the numerator and denominator of the aspect ratio. If
  12595. the parameter is not specified, it is assumed the value "0".
  12596. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12597. should be escaped.
  12598. @item max
  12599. Set the maximum integer value to use for expressing numerator and
  12600. denominator when reducing the expressed aspect ratio to a rational.
  12601. Default value is @code{100}.
  12602. @end table
  12603. The parameter @var{sar} is an expression containing
  12604. the following constants:
  12605. @table @option
  12606. @item E, PI, PHI
  12607. These are approximated values for the mathematical constants e
  12608. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12609. @item w, h
  12610. The input width and height.
  12611. @item a
  12612. These are the same as @var{w} / @var{h}.
  12613. @item sar
  12614. The input sample aspect ratio.
  12615. @item dar
  12616. The input display aspect ratio. It is the same as
  12617. (@var{w} / @var{h}) * @var{sar}.
  12618. @item hsub, vsub
  12619. Horizontal and vertical chroma subsample values. For example, for the
  12620. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12621. @end table
  12622. @subsection Examples
  12623. @itemize
  12624. @item
  12625. To change the display aspect ratio to 16:9, specify one of the following:
  12626. @example
  12627. setdar=dar=1.77777
  12628. setdar=dar=16/9
  12629. @end example
  12630. @item
  12631. To change the sample aspect ratio to 10:11, specify:
  12632. @example
  12633. setsar=sar=10/11
  12634. @end example
  12635. @item
  12636. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12637. 1000 in the aspect ratio reduction, use the command:
  12638. @example
  12639. setdar=ratio=16/9:max=1000
  12640. @end example
  12641. @end itemize
  12642. @anchor{setfield}
  12643. @section setfield
  12644. Force field for the output video frame.
  12645. The @code{setfield} filter marks the interlace type field for the
  12646. output frames. It does not change the input frame, but only sets the
  12647. corresponding property, which affects how the frame is treated by
  12648. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12649. The filter accepts the following options:
  12650. @table @option
  12651. @item mode
  12652. Available values are:
  12653. @table @samp
  12654. @item auto
  12655. Keep the same field property.
  12656. @item bff
  12657. Mark the frame as bottom-field-first.
  12658. @item tff
  12659. Mark the frame as top-field-first.
  12660. @item prog
  12661. Mark the frame as progressive.
  12662. @end table
  12663. @end table
  12664. @anchor{setparams}
  12665. @section setparams
  12666. Force frame parameter for the output video frame.
  12667. The @code{setparams} filter marks interlace and color range for the
  12668. output frames. It does not change the input frame, but only sets the
  12669. corresponding property, which affects how the frame is treated by
  12670. filters/encoders.
  12671. @table @option
  12672. @item field_mode
  12673. Available values are:
  12674. @table @samp
  12675. @item auto
  12676. Keep the same field property (default).
  12677. @item bff
  12678. Mark the frame as bottom-field-first.
  12679. @item tff
  12680. Mark the frame as top-field-first.
  12681. @item prog
  12682. Mark the frame as progressive.
  12683. @end table
  12684. @item range
  12685. Available values are:
  12686. @table @samp
  12687. @item auto
  12688. Keep the same color range property (default).
  12689. @item unspecified, unknown
  12690. Mark the frame as unspecified color range.
  12691. @item limited, tv, mpeg
  12692. Mark the frame as limited range.
  12693. @item full, pc, jpeg
  12694. Mark the frame as full range.
  12695. @end table
  12696. @item color_primaries
  12697. Set the color primaries.
  12698. Available values are:
  12699. @table @samp
  12700. @item auto
  12701. Keep the same color primaries property (default).
  12702. @item bt709
  12703. @item unknown
  12704. @item bt470m
  12705. @item bt470bg
  12706. @item smpte170m
  12707. @item smpte240m
  12708. @item film
  12709. @item bt2020
  12710. @item smpte428
  12711. @item smpte431
  12712. @item smpte432
  12713. @item jedec-p22
  12714. @end table
  12715. @item color_trc
  12716. Set the color transfer.
  12717. Available values are:
  12718. @table @samp
  12719. @item auto
  12720. Keep the same color trc property (default).
  12721. @item bt709
  12722. @item unknown
  12723. @item bt470m
  12724. @item bt470bg
  12725. @item smpte170m
  12726. @item smpte240m
  12727. @item linear
  12728. @item log100
  12729. @item log316
  12730. @item iec61966-2-4
  12731. @item bt1361e
  12732. @item iec61966-2-1
  12733. @item bt2020-10
  12734. @item bt2020-12
  12735. @item smpte2084
  12736. @item smpte428
  12737. @item arib-std-b67
  12738. @end table
  12739. @item colorspace
  12740. Set the colorspace.
  12741. Available values are:
  12742. @table @samp
  12743. @item auto
  12744. Keep the same colorspace property (default).
  12745. @item gbr
  12746. @item bt709
  12747. @item unknown
  12748. @item fcc
  12749. @item bt470bg
  12750. @item smpte170m
  12751. @item smpte240m
  12752. @item ycgco
  12753. @item bt2020nc
  12754. @item bt2020c
  12755. @item smpte2085
  12756. @item chroma-derived-nc
  12757. @item chroma-derived-c
  12758. @item ictcp
  12759. @end table
  12760. @end table
  12761. @section showinfo
  12762. Show a line containing various information for each input video frame.
  12763. The input video is not modified.
  12764. This filter supports the following options:
  12765. @table @option
  12766. @item checksum
  12767. Calculate checksums of each plane. By default enabled.
  12768. @end table
  12769. The shown line contains a sequence of key/value pairs of the form
  12770. @var{key}:@var{value}.
  12771. The following values are shown in the output:
  12772. @table @option
  12773. @item n
  12774. The (sequential) number of the input frame, starting from 0.
  12775. @item pts
  12776. The Presentation TimeStamp of the input frame, expressed as a number of
  12777. time base units. The time base unit depends on the filter input pad.
  12778. @item pts_time
  12779. The Presentation TimeStamp of the input frame, expressed as a number of
  12780. seconds.
  12781. @item pos
  12782. The position of the frame in the input stream, or -1 if this information is
  12783. unavailable and/or meaningless (for example in case of synthetic video).
  12784. @item fmt
  12785. The pixel format name.
  12786. @item sar
  12787. The sample aspect ratio of the input frame, expressed in the form
  12788. @var{num}/@var{den}.
  12789. @item s
  12790. The size of the input frame. For the syntax of this option, check the
  12791. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12792. @item i
  12793. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12794. for bottom field first).
  12795. @item iskey
  12796. This is 1 if the frame is a key frame, 0 otherwise.
  12797. @item type
  12798. The picture type of the input frame ("I" for an I-frame, "P" for a
  12799. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12800. Also refer to the documentation of the @code{AVPictureType} enum and of
  12801. the @code{av_get_picture_type_char} function defined in
  12802. @file{libavutil/avutil.h}.
  12803. @item checksum
  12804. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12805. @item plane_checksum
  12806. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12807. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12808. @item mean
  12809. The mean value of pixels in each plane of the input frame, expressed in the form
  12810. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  12811. @item stdev
  12812. The standard deviation of pixel values in each plane of the input frame, expressed
  12813. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  12814. @end table
  12815. @section showpalette
  12816. Displays the 256 colors palette of each frame. This filter is only relevant for
  12817. @var{pal8} pixel format frames.
  12818. It accepts the following option:
  12819. @table @option
  12820. @item s
  12821. Set the size of the box used to represent one palette color entry. Default is
  12822. @code{30} (for a @code{30x30} pixel box).
  12823. @end table
  12824. @section shuffleframes
  12825. Reorder and/or duplicate and/or drop video frames.
  12826. It accepts the following parameters:
  12827. @table @option
  12828. @item mapping
  12829. Set the destination indexes of input frames.
  12830. This is space or '|' separated list of indexes that maps input frames to output
  12831. frames. Number of indexes also sets maximal value that each index may have.
  12832. '-1' index have special meaning and that is to drop frame.
  12833. @end table
  12834. The first frame has the index 0. The default is to keep the input unchanged.
  12835. @subsection Examples
  12836. @itemize
  12837. @item
  12838. Swap second and third frame of every three frames of the input:
  12839. @example
  12840. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12841. @end example
  12842. @item
  12843. Swap 10th and 1st frame of every ten frames of the input:
  12844. @example
  12845. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12846. @end example
  12847. @end itemize
  12848. @section shuffleplanes
  12849. Reorder and/or duplicate video planes.
  12850. It accepts the following parameters:
  12851. @table @option
  12852. @item map0
  12853. The index of the input plane to be used as the first output plane.
  12854. @item map1
  12855. The index of the input plane to be used as the second output plane.
  12856. @item map2
  12857. The index of the input plane to be used as the third output plane.
  12858. @item map3
  12859. The index of the input plane to be used as the fourth output plane.
  12860. @end table
  12861. The first plane has the index 0. The default is to keep the input unchanged.
  12862. @subsection Examples
  12863. @itemize
  12864. @item
  12865. Swap the second and third planes of the input:
  12866. @example
  12867. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12868. @end example
  12869. @end itemize
  12870. @anchor{signalstats}
  12871. @section signalstats
  12872. Evaluate various visual metrics that assist in determining issues associated
  12873. with the digitization of analog video media.
  12874. By default the filter will log these metadata values:
  12875. @table @option
  12876. @item YMIN
  12877. Display the minimal Y value contained within the input frame. Expressed in
  12878. range of [0-255].
  12879. @item YLOW
  12880. Display the Y value at the 10% percentile within the input frame. Expressed in
  12881. range of [0-255].
  12882. @item YAVG
  12883. Display the average Y value within the input frame. Expressed in range of
  12884. [0-255].
  12885. @item YHIGH
  12886. Display the Y value at the 90% percentile within the input frame. Expressed in
  12887. range of [0-255].
  12888. @item YMAX
  12889. Display the maximum Y value contained within the input frame. Expressed in
  12890. range of [0-255].
  12891. @item UMIN
  12892. Display the minimal U value contained within the input frame. Expressed in
  12893. range of [0-255].
  12894. @item ULOW
  12895. Display the U value at the 10% percentile within the input frame. Expressed in
  12896. range of [0-255].
  12897. @item UAVG
  12898. Display the average U value within the input frame. Expressed in range of
  12899. [0-255].
  12900. @item UHIGH
  12901. Display the U value at the 90% percentile within the input frame. Expressed in
  12902. range of [0-255].
  12903. @item UMAX
  12904. Display the maximum U value contained within the input frame. Expressed in
  12905. range of [0-255].
  12906. @item VMIN
  12907. Display the minimal V value contained within the input frame. Expressed in
  12908. range of [0-255].
  12909. @item VLOW
  12910. Display the V value at the 10% percentile within the input frame. Expressed in
  12911. range of [0-255].
  12912. @item VAVG
  12913. Display the average V value within the input frame. Expressed in range of
  12914. [0-255].
  12915. @item VHIGH
  12916. Display the V value at the 90% percentile within the input frame. Expressed in
  12917. range of [0-255].
  12918. @item VMAX
  12919. Display the maximum V value contained within the input frame. Expressed in
  12920. range of [0-255].
  12921. @item SATMIN
  12922. Display the minimal saturation value contained within the input frame.
  12923. Expressed in range of [0-~181.02].
  12924. @item SATLOW
  12925. Display the saturation value at the 10% percentile within the input frame.
  12926. Expressed in range of [0-~181.02].
  12927. @item SATAVG
  12928. Display the average saturation value within the input frame. Expressed in range
  12929. of [0-~181.02].
  12930. @item SATHIGH
  12931. Display the saturation value at the 90% percentile within the input frame.
  12932. Expressed in range of [0-~181.02].
  12933. @item SATMAX
  12934. Display the maximum saturation value contained within the input frame.
  12935. Expressed in range of [0-~181.02].
  12936. @item HUEMED
  12937. Display the median value for hue within the input frame. Expressed in range of
  12938. [0-360].
  12939. @item HUEAVG
  12940. Display the average value for hue within the input frame. Expressed in range of
  12941. [0-360].
  12942. @item YDIF
  12943. Display the average of sample value difference between all values of the Y
  12944. plane in the current frame and corresponding values of the previous input frame.
  12945. Expressed in range of [0-255].
  12946. @item UDIF
  12947. Display the average of sample value difference between all values of the U
  12948. plane in the current frame and corresponding values of the previous input frame.
  12949. Expressed in range of [0-255].
  12950. @item VDIF
  12951. Display the average of sample value difference between all values of the V
  12952. plane in the current frame and corresponding values of the previous input frame.
  12953. Expressed in range of [0-255].
  12954. @item YBITDEPTH
  12955. Display bit depth of Y plane in current frame.
  12956. Expressed in range of [0-16].
  12957. @item UBITDEPTH
  12958. Display bit depth of U plane in current frame.
  12959. Expressed in range of [0-16].
  12960. @item VBITDEPTH
  12961. Display bit depth of V plane in current frame.
  12962. Expressed in range of [0-16].
  12963. @end table
  12964. The filter accepts the following options:
  12965. @table @option
  12966. @item stat
  12967. @item out
  12968. @option{stat} specify an additional form of image analysis.
  12969. @option{out} output video with the specified type of pixel highlighted.
  12970. Both options accept the following values:
  12971. @table @samp
  12972. @item tout
  12973. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12974. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12975. include the results of video dropouts, head clogs, or tape tracking issues.
  12976. @item vrep
  12977. Identify @var{vertical line repetition}. Vertical line repetition includes
  12978. similar rows of pixels within a frame. In born-digital video vertical line
  12979. repetition is common, but this pattern is uncommon in video digitized from an
  12980. analog source. When it occurs in video that results from the digitization of an
  12981. analog source it can indicate concealment from a dropout compensator.
  12982. @item brng
  12983. Identify pixels that fall outside of legal broadcast range.
  12984. @end table
  12985. @item color, c
  12986. Set the highlight color for the @option{out} option. The default color is
  12987. yellow.
  12988. @end table
  12989. @subsection Examples
  12990. @itemize
  12991. @item
  12992. Output data of various video metrics:
  12993. @example
  12994. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12995. @end example
  12996. @item
  12997. Output specific data about the minimum and maximum values of the Y plane per frame:
  12998. @example
  12999. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13000. @end example
  13001. @item
  13002. Playback video while highlighting pixels that are outside of broadcast range in red.
  13003. @example
  13004. ffplay example.mov -vf signalstats="out=brng:color=red"
  13005. @end example
  13006. @item
  13007. Playback video with signalstats metadata drawn over the frame.
  13008. @example
  13009. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13010. @end example
  13011. The contents of signalstat_drawtext.txt used in the command are:
  13012. @example
  13013. time %@{pts:hms@}
  13014. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13015. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13016. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13017. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13018. @end example
  13019. @end itemize
  13020. @anchor{signature}
  13021. @section signature
  13022. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13023. input. In this case the matching between the inputs can be calculated additionally.
  13024. The filter always passes through the first input. The signature of each stream can
  13025. be written into a file.
  13026. It accepts the following options:
  13027. @table @option
  13028. @item detectmode
  13029. Enable or disable the matching process.
  13030. Available values are:
  13031. @table @samp
  13032. @item off
  13033. Disable the calculation of a matching (default).
  13034. @item full
  13035. Calculate the matching for the whole video and output whether the whole video
  13036. matches or only parts.
  13037. @item fast
  13038. Calculate only until a matching is found or the video ends. Should be faster in
  13039. some cases.
  13040. @end table
  13041. @item nb_inputs
  13042. Set the number of inputs. The option value must be a non negative integer.
  13043. Default value is 1.
  13044. @item filename
  13045. Set the path to which the output is written. If there is more than one input,
  13046. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13047. integer), that will be replaced with the input number. If no filename is
  13048. specified, no output will be written. This is the default.
  13049. @item format
  13050. Choose the output format.
  13051. Available values are:
  13052. @table @samp
  13053. @item binary
  13054. Use the specified binary representation (default).
  13055. @item xml
  13056. Use the specified xml representation.
  13057. @end table
  13058. @item th_d
  13059. Set threshold to detect one word as similar. The option value must be an integer
  13060. greater than zero. The default value is 9000.
  13061. @item th_dc
  13062. Set threshold to detect all words as similar. The option value must be an integer
  13063. greater than zero. The default value is 60000.
  13064. @item th_xh
  13065. Set threshold to detect frames as similar. The option value must be an integer
  13066. greater than zero. The default value is 116.
  13067. @item th_di
  13068. Set the minimum length of a sequence in frames to recognize it as matching
  13069. sequence. The option value must be a non negative integer value.
  13070. The default value is 0.
  13071. @item th_it
  13072. Set the minimum relation, that matching frames to all frames must have.
  13073. The option value must be a double value between 0 and 1. The default value is 0.5.
  13074. @end table
  13075. @subsection Examples
  13076. @itemize
  13077. @item
  13078. To calculate the signature of an input video and store it in signature.bin:
  13079. @example
  13080. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13081. @end example
  13082. @item
  13083. To detect whether two videos match and store the signatures in XML format in
  13084. signature0.xml and signature1.xml:
  13085. @example
  13086. 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 -
  13087. @end example
  13088. @end itemize
  13089. @anchor{smartblur}
  13090. @section smartblur
  13091. Blur the input video without impacting the outlines.
  13092. It accepts the following options:
  13093. @table @option
  13094. @item luma_radius, lr
  13095. Set the luma radius. The option value must be a float number in
  13096. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13097. used to blur the image (slower if larger). Default value is 1.0.
  13098. @item luma_strength, ls
  13099. Set the luma strength. The option value must be a float number
  13100. in the range [-1.0,1.0] that configures the blurring. A value included
  13101. in [0.0,1.0] will blur the image whereas a value included in
  13102. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13103. @item luma_threshold, lt
  13104. Set the luma threshold used as a coefficient to determine
  13105. whether a pixel should be blurred or not. The option value must be an
  13106. integer in the range [-30,30]. A value of 0 will filter all the image,
  13107. a value included in [0,30] will filter flat areas and a value included
  13108. in [-30,0] will filter edges. Default value is 0.
  13109. @item chroma_radius, cr
  13110. Set the chroma radius. The option value must be a float number in
  13111. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13112. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13113. @item chroma_strength, cs
  13114. Set the chroma strength. The option value must be a float number
  13115. in the range [-1.0,1.0] that configures the blurring. A value included
  13116. in [0.0,1.0] will blur the image whereas a value included in
  13117. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13118. @item chroma_threshold, ct
  13119. Set the chroma threshold used as a coefficient to determine
  13120. whether a pixel should be blurred or not. The option value must be an
  13121. integer in the range [-30,30]. A value of 0 will filter all the image,
  13122. a value included in [0,30] will filter flat areas and a value included
  13123. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13124. @end table
  13125. If a chroma option is not explicitly set, the corresponding luma value
  13126. is set.
  13127. @section sobel
  13128. Apply sobel operator to input video stream.
  13129. The filter accepts the following option:
  13130. @table @option
  13131. @item planes
  13132. Set which planes will be processed, unprocessed planes will be copied.
  13133. By default value 0xf, all planes will be processed.
  13134. @item scale
  13135. Set value which will be multiplied with filtered result.
  13136. @item delta
  13137. Set value which will be added to filtered result.
  13138. @end table
  13139. @anchor{spp}
  13140. @section spp
  13141. Apply a simple postprocessing filter that compresses and decompresses the image
  13142. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13143. and average the results.
  13144. The filter accepts the following options:
  13145. @table @option
  13146. @item quality
  13147. Set quality. This option defines the number of levels for averaging. It accepts
  13148. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13149. effect. A value of @code{6} means the higher quality. For each increment of
  13150. that value the speed drops by a factor of approximately 2. Default value is
  13151. @code{3}.
  13152. @item qp
  13153. Force a constant quantization parameter. If not set, the filter will use the QP
  13154. from the video stream (if available).
  13155. @item mode
  13156. Set thresholding mode. Available modes are:
  13157. @table @samp
  13158. @item hard
  13159. Set hard thresholding (default).
  13160. @item soft
  13161. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13162. @end table
  13163. @item use_bframe_qp
  13164. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13165. option may cause flicker since the B-Frames have often larger QP. Default is
  13166. @code{0} (not enabled).
  13167. @end table
  13168. @section sr
  13169. Scale the input by applying one of the super-resolution methods based on
  13170. convolutional neural networks. Supported models:
  13171. @itemize
  13172. @item
  13173. Super-Resolution Convolutional Neural Network model (SRCNN).
  13174. See @url{https://arxiv.org/abs/1501.00092}.
  13175. @item
  13176. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13177. See @url{https://arxiv.org/abs/1609.05158}.
  13178. @end itemize
  13179. Training scripts as well as scripts for model file (.pb) saving can be found at
  13180. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13181. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13182. Native model files (.model) can be generated from TensorFlow model
  13183. files (.pb) by using tools/python/convert.py
  13184. The filter accepts the following options:
  13185. @table @option
  13186. @item dnn_backend
  13187. Specify which DNN backend to use for model loading and execution. This option accepts
  13188. the following values:
  13189. @table @samp
  13190. @item native
  13191. Native implementation of DNN loading and execution.
  13192. @item tensorflow
  13193. TensorFlow backend. To enable this backend you
  13194. need to install the TensorFlow for C library (see
  13195. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13196. @code{--enable-libtensorflow}
  13197. @end table
  13198. Default value is @samp{native}.
  13199. @item model
  13200. Set path to model file specifying network architecture and its parameters.
  13201. Note that different backends use different file formats. TensorFlow backend
  13202. can load files for both formats, while native backend can load files for only
  13203. its format.
  13204. @item scale_factor
  13205. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13206. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13207. input upscaled using bicubic upscaling with proper scale factor.
  13208. @end table
  13209. @section ssim
  13210. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13211. This filter takes in input two input videos, the first input is
  13212. considered the "main" source and is passed unchanged to the
  13213. output. The second input is used as a "reference" video for computing
  13214. the SSIM.
  13215. Both video inputs must have the same resolution and pixel format for
  13216. this filter to work correctly. Also it assumes that both inputs
  13217. have the same number of frames, which are compared one by one.
  13218. The filter stores the calculated SSIM of each frame.
  13219. The description of the accepted parameters follows.
  13220. @table @option
  13221. @item stats_file, f
  13222. If specified the filter will use the named file to save the SSIM of
  13223. each individual frame. When filename equals "-" the data is sent to
  13224. standard output.
  13225. @end table
  13226. The file printed if @var{stats_file} is selected, contains a sequence of
  13227. key/value pairs of the form @var{key}:@var{value} for each compared
  13228. couple of frames.
  13229. A description of each shown parameter follows:
  13230. @table @option
  13231. @item n
  13232. sequential number of the input frame, starting from 1
  13233. @item Y, U, V, R, G, B
  13234. SSIM of the compared frames for the component specified by the suffix.
  13235. @item All
  13236. SSIM of the compared frames for the whole frame.
  13237. @item dB
  13238. Same as above but in dB representation.
  13239. @end table
  13240. This filter also supports the @ref{framesync} options.
  13241. @subsection Examples
  13242. @itemize
  13243. @item
  13244. For example:
  13245. @example
  13246. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13247. [main][ref] ssim="stats_file=stats.log" [out]
  13248. @end example
  13249. On this example the input file being processed is compared with the
  13250. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13251. is stored in @file{stats.log}.
  13252. @item
  13253. Another example with both psnr and ssim at same time:
  13254. @example
  13255. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13256. @end example
  13257. @item
  13258. Another example with different containers:
  13259. @example
  13260. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]ssim" -f null -
  13261. @end example
  13262. @end itemize
  13263. @section stereo3d
  13264. Convert between different stereoscopic image formats.
  13265. The filters accept the following options:
  13266. @table @option
  13267. @item in
  13268. Set stereoscopic image format of input.
  13269. Available values for input image formats are:
  13270. @table @samp
  13271. @item sbsl
  13272. side by side parallel (left eye left, right eye right)
  13273. @item sbsr
  13274. side by side crosseye (right eye left, left eye right)
  13275. @item sbs2l
  13276. side by side parallel with half width resolution
  13277. (left eye left, right eye right)
  13278. @item sbs2r
  13279. side by side crosseye with half width resolution
  13280. (right eye left, left eye right)
  13281. @item abl
  13282. @item tbl
  13283. above-below (left eye above, right eye below)
  13284. @item abr
  13285. @item tbr
  13286. above-below (right eye above, left eye below)
  13287. @item ab2l
  13288. @item tb2l
  13289. above-below with half height resolution
  13290. (left eye above, right eye below)
  13291. @item ab2r
  13292. @item tb2r
  13293. above-below with half height resolution
  13294. (right eye above, left eye below)
  13295. @item al
  13296. alternating frames (left eye first, right eye second)
  13297. @item ar
  13298. alternating frames (right eye first, left eye second)
  13299. @item irl
  13300. interleaved rows (left eye has top row, right eye starts on next row)
  13301. @item irr
  13302. interleaved rows (right eye has top row, left eye starts on next row)
  13303. @item icl
  13304. interleaved columns, left eye first
  13305. @item icr
  13306. interleaved columns, right eye first
  13307. Default value is @samp{sbsl}.
  13308. @end table
  13309. @item out
  13310. Set stereoscopic image format of output.
  13311. @table @samp
  13312. @item sbsl
  13313. side by side parallel (left eye left, right eye right)
  13314. @item sbsr
  13315. side by side crosseye (right eye left, left eye right)
  13316. @item sbs2l
  13317. side by side parallel with half width resolution
  13318. (left eye left, right eye right)
  13319. @item sbs2r
  13320. side by side crosseye with half width resolution
  13321. (right eye left, left eye right)
  13322. @item abl
  13323. @item tbl
  13324. above-below (left eye above, right eye below)
  13325. @item abr
  13326. @item tbr
  13327. above-below (right eye above, left eye below)
  13328. @item ab2l
  13329. @item tb2l
  13330. above-below with half height resolution
  13331. (left eye above, right eye below)
  13332. @item ab2r
  13333. @item tb2r
  13334. above-below with half height resolution
  13335. (right eye above, left eye below)
  13336. @item al
  13337. alternating frames (left eye first, right eye second)
  13338. @item ar
  13339. alternating frames (right eye first, left eye second)
  13340. @item irl
  13341. interleaved rows (left eye has top row, right eye starts on next row)
  13342. @item irr
  13343. interleaved rows (right eye has top row, left eye starts on next row)
  13344. @item arbg
  13345. anaglyph red/blue gray
  13346. (red filter on left eye, blue filter on right eye)
  13347. @item argg
  13348. anaglyph red/green gray
  13349. (red filter on left eye, green filter on right eye)
  13350. @item arcg
  13351. anaglyph red/cyan gray
  13352. (red filter on left eye, cyan filter on right eye)
  13353. @item arch
  13354. anaglyph red/cyan half colored
  13355. (red filter on left eye, cyan filter on right eye)
  13356. @item arcc
  13357. anaglyph red/cyan color
  13358. (red filter on left eye, cyan filter on right eye)
  13359. @item arcd
  13360. anaglyph red/cyan color optimized with the least squares projection of dubois
  13361. (red filter on left eye, cyan filter on right eye)
  13362. @item agmg
  13363. anaglyph green/magenta gray
  13364. (green filter on left eye, magenta filter on right eye)
  13365. @item agmh
  13366. anaglyph green/magenta half colored
  13367. (green filter on left eye, magenta filter on right eye)
  13368. @item agmc
  13369. anaglyph green/magenta colored
  13370. (green filter on left eye, magenta filter on right eye)
  13371. @item agmd
  13372. anaglyph green/magenta color optimized with the least squares projection of dubois
  13373. (green filter on left eye, magenta filter on right eye)
  13374. @item aybg
  13375. anaglyph yellow/blue gray
  13376. (yellow filter on left eye, blue filter on right eye)
  13377. @item aybh
  13378. anaglyph yellow/blue half colored
  13379. (yellow filter on left eye, blue filter on right eye)
  13380. @item aybc
  13381. anaglyph yellow/blue colored
  13382. (yellow filter on left eye, blue filter on right eye)
  13383. @item aybd
  13384. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13385. (yellow filter on left eye, blue filter on right eye)
  13386. @item ml
  13387. mono output (left eye only)
  13388. @item mr
  13389. mono output (right eye only)
  13390. @item chl
  13391. checkerboard, left eye first
  13392. @item chr
  13393. checkerboard, right eye first
  13394. @item icl
  13395. interleaved columns, left eye first
  13396. @item icr
  13397. interleaved columns, right eye first
  13398. @item hdmi
  13399. HDMI frame pack
  13400. @end table
  13401. Default value is @samp{arcd}.
  13402. @end table
  13403. @subsection Examples
  13404. @itemize
  13405. @item
  13406. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13407. @example
  13408. stereo3d=sbsl:aybd
  13409. @end example
  13410. @item
  13411. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13412. @example
  13413. stereo3d=abl:sbsr
  13414. @end example
  13415. @end itemize
  13416. @section streamselect, astreamselect
  13417. Select video or audio streams.
  13418. The filter accepts the following options:
  13419. @table @option
  13420. @item inputs
  13421. Set number of inputs. Default is 2.
  13422. @item map
  13423. Set input indexes to remap to outputs.
  13424. @end table
  13425. @subsection Commands
  13426. The @code{streamselect} and @code{astreamselect} filter supports the following
  13427. commands:
  13428. @table @option
  13429. @item map
  13430. Set input indexes to remap to outputs.
  13431. @end table
  13432. @subsection Examples
  13433. @itemize
  13434. @item
  13435. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13436. @example
  13437. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13438. @end example
  13439. @item
  13440. Same as above, but for audio:
  13441. @example
  13442. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13443. @end example
  13444. @end itemize
  13445. @anchor{subtitles}
  13446. @section subtitles
  13447. Draw subtitles on top of input video using the libass library.
  13448. To enable compilation of this filter you need to configure FFmpeg with
  13449. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13450. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13451. Alpha) subtitles format.
  13452. The filter accepts the following options:
  13453. @table @option
  13454. @item filename, f
  13455. Set the filename of the subtitle file to read. It must be specified.
  13456. @item original_size
  13457. Specify the size of the original video, the video for which the ASS file
  13458. was composed. For the syntax of this option, check the
  13459. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13460. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13461. correctly scale the fonts if the aspect ratio has been changed.
  13462. @item fontsdir
  13463. Set a directory path containing fonts that can be used by the filter.
  13464. These fonts will be used in addition to whatever the font provider uses.
  13465. @item alpha
  13466. Process alpha channel, by default alpha channel is untouched.
  13467. @item charenc
  13468. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13469. useful if not UTF-8.
  13470. @item stream_index, si
  13471. Set subtitles stream index. @code{subtitles} filter only.
  13472. @item force_style
  13473. Override default style or script info parameters of the subtitles. It accepts a
  13474. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13475. @end table
  13476. If the first key is not specified, it is assumed that the first value
  13477. specifies the @option{filename}.
  13478. For example, to render the file @file{sub.srt} on top of the input
  13479. video, use the command:
  13480. @example
  13481. subtitles=sub.srt
  13482. @end example
  13483. which is equivalent to:
  13484. @example
  13485. subtitles=filename=sub.srt
  13486. @end example
  13487. To render the default subtitles stream from file @file{video.mkv}, use:
  13488. @example
  13489. subtitles=video.mkv
  13490. @end example
  13491. To render the second subtitles stream from that file, use:
  13492. @example
  13493. subtitles=video.mkv:si=1
  13494. @end example
  13495. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13496. @code{DejaVu Serif}, use:
  13497. @example
  13498. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13499. @end example
  13500. @section super2xsai
  13501. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13502. Interpolate) pixel art scaling algorithm.
  13503. Useful for enlarging pixel art images without reducing sharpness.
  13504. @section swaprect
  13505. Swap two rectangular objects in video.
  13506. This filter accepts the following options:
  13507. @table @option
  13508. @item w
  13509. Set object width.
  13510. @item h
  13511. Set object height.
  13512. @item x1
  13513. Set 1st rect x coordinate.
  13514. @item y1
  13515. Set 1st rect y coordinate.
  13516. @item x2
  13517. Set 2nd rect x coordinate.
  13518. @item y2
  13519. Set 2nd rect y coordinate.
  13520. All expressions are evaluated once for each frame.
  13521. @end table
  13522. The all options are expressions containing the following constants:
  13523. @table @option
  13524. @item w
  13525. @item h
  13526. The input width and height.
  13527. @item a
  13528. same as @var{w} / @var{h}
  13529. @item sar
  13530. input sample aspect ratio
  13531. @item dar
  13532. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13533. @item n
  13534. The number of the input frame, starting from 0.
  13535. @item t
  13536. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13537. @item pos
  13538. the position in the file of the input frame, NAN if unknown
  13539. @end table
  13540. @section swapuv
  13541. Swap U & V plane.
  13542. @section telecine
  13543. Apply telecine process to the video.
  13544. This filter accepts the following options:
  13545. @table @option
  13546. @item first_field
  13547. @table @samp
  13548. @item top, t
  13549. top field first
  13550. @item bottom, b
  13551. bottom field first
  13552. The default value is @code{top}.
  13553. @end table
  13554. @item pattern
  13555. A string of numbers representing the pulldown pattern you wish to apply.
  13556. The default value is @code{23}.
  13557. @end table
  13558. @example
  13559. Some typical patterns:
  13560. NTSC output (30i):
  13561. 27.5p: 32222
  13562. 24p: 23 (classic)
  13563. 24p: 2332 (preferred)
  13564. 20p: 33
  13565. 18p: 334
  13566. 16p: 3444
  13567. PAL output (25i):
  13568. 27.5p: 12222
  13569. 24p: 222222222223 ("Euro pulldown")
  13570. 16.67p: 33
  13571. 16p: 33333334
  13572. @end example
  13573. @section thistogram
  13574. Compute and draw a color distribution histogram for the input video across time.
  13575. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13576. at certain time, this filter shows also past histograms of number of frames defined
  13577. by @code{width} option.
  13578. The computed histogram is a representation of the color component
  13579. distribution in an image.
  13580. The filter accepts the following options:
  13581. @table @option
  13582. @item width, w
  13583. Set width of single color component output. Default value is @code{0}.
  13584. Value of @code{0} means width will be picked from input video.
  13585. This also set number of passed histograms to keep.
  13586. Allowed range is [0, 8192].
  13587. @item display_mode, d
  13588. Set display mode.
  13589. It accepts the following values:
  13590. @table @samp
  13591. @item stack
  13592. Per color component graphs are placed below each other.
  13593. @item parade
  13594. Per color component graphs are placed side by side.
  13595. @item overlay
  13596. Presents information identical to that in the @code{parade}, except
  13597. that the graphs representing color components are superimposed directly
  13598. over one another.
  13599. @end table
  13600. Default is @code{stack}.
  13601. @item levels_mode, m
  13602. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  13603. Default is @code{linear}.
  13604. @item components, c
  13605. Set what color components to display.
  13606. Default is @code{7}.
  13607. @item bgopacity, b
  13608. Set background opacity. Default is @code{0.9}.
  13609. @item envelope, e
  13610. Show envelope. Default is disabled.
  13611. @item ecolor, ec
  13612. Set envelope color. Default is @code{gold}.
  13613. @end table
  13614. @section threshold
  13615. Apply threshold effect to video stream.
  13616. This filter needs four video streams to perform thresholding.
  13617. First stream is stream we are filtering.
  13618. Second stream is holding threshold values, third stream is holding min values,
  13619. and last, fourth stream is holding max values.
  13620. The filter accepts the following option:
  13621. @table @option
  13622. @item planes
  13623. Set which planes will be processed, unprocessed planes will be copied.
  13624. By default value 0xf, all planes will be processed.
  13625. @end table
  13626. For example if first stream pixel's component value is less then threshold value
  13627. of pixel component from 2nd threshold stream, third stream value will picked,
  13628. otherwise fourth stream pixel component value will be picked.
  13629. Using color source filter one can perform various types of thresholding:
  13630. @subsection Examples
  13631. @itemize
  13632. @item
  13633. Binary threshold, using gray color as threshold:
  13634. @example
  13635. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13636. @end example
  13637. @item
  13638. Inverted binary threshold, using gray color as threshold:
  13639. @example
  13640. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13641. @end example
  13642. @item
  13643. Truncate binary threshold, using gray color as threshold:
  13644. @example
  13645. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13646. @end example
  13647. @item
  13648. Threshold to zero, using gray color as threshold:
  13649. @example
  13650. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13651. @end example
  13652. @item
  13653. Inverted threshold to zero, using gray color as threshold:
  13654. @example
  13655. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13656. @end example
  13657. @end itemize
  13658. @section thumbnail
  13659. Select the most representative frame in a given sequence of consecutive frames.
  13660. The filter accepts the following options:
  13661. @table @option
  13662. @item n
  13663. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13664. will pick one of them, and then handle the next batch of @var{n} frames until
  13665. the end. Default is @code{100}.
  13666. @end table
  13667. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13668. value will result in a higher memory usage, so a high value is not recommended.
  13669. @subsection Examples
  13670. @itemize
  13671. @item
  13672. Extract one picture each 50 frames:
  13673. @example
  13674. thumbnail=50
  13675. @end example
  13676. @item
  13677. Complete example of a thumbnail creation with @command{ffmpeg}:
  13678. @example
  13679. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13680. @end example
  13681. @end itemize
  13682. @section tile
  13683. Tile several successive frames together.
  13684. The filter accepts the following options:
  13685. @table @option
  13686. @item layout
  13687. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13688. this option, check the
  13689. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13690. @item nb_frames
  13691. Set the maximum number of frames to render in the given area. It must be less
  13692. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13693. the area will be used.
  13694. @item margin
  13695. Set the outer border margin in pixels.
  13696. @item padding
  13697. Set the inner border thickness (i.e. the number of pixels between frames). For
  13698. more advanced padding options (such as having different values for the edges),
  13699. refer to the pad video filter.
  13700. @item color
  13701. Specify the color of the unused area. For the syntax of this option, check the
  13702. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13703. The default value of @var{color} is "black".
  13704. @item overlap
  13705. Set the number of frames to overlap when tiling several successive frames together.
  13706. The value must be between @code{0} and @var{nb_frames - 1}.
  13707. @item init_padding
  13708. Set the number of frames to initially be empty before displaying first output frame.
  13709. This controls how soon will one get first output frame.
  13710. The value must be between @code{0} and @var{nb_frames - 1}.
  13711. @end table
  13712. @subsection Examples
  13713. @itemize
  13714. @item
  13715. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13716. @example
  13717. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13718. @end example
  13719. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13720. duplicating each output frame to accommodate the originally detected frame
  13721. rate.
  13722. @item
  13723. Display @code{5} pictures in an area of @code{3x2} frames,
  13724. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13725. mixed flat and named options:
  13726. @example
  13727. tile=3x2:nb_frames=5:padding=7:margin=2
  13728. @end example
  13729. @end itemize
  13730. @section tinterlace
  13731. Perform various types of temporal field interlacing.
  13732. Frames are counted starting from 1, so the first input frame is
  13733. considered odd.
  13734. The filter accepts the following options:
  13735. @table @option
  13736. @item mode
  13737. Specify the mode of the interlacing. This option can also be specified
  13738. as a value alone. See below for a list of values for this option.
  13739. Available values are:
  13740. @table @samp
  13741. @item merge, 0
  13742. Move odd frames into the upper field, even into the lower field,
  13743. generating a double height frame at half frame rate.
  13744. @example
  13745. ------> time
  13746. Input:
  13747. Frame 1 Frame 2 Frame 3 Frame 4
  13748. 11111 22222 33333 44444
  13749. 11111 22222 33333 44444
  13750. 11111 22222 33333 44444
  13751. 11111 22222 33333 44444
  13752. Output:
  13753. 11111 33333
  13754. 22222 44444
  13755. 11111 33333
  13756. 22222 44444
  13757. 11111 33333
  13758. 22222 44444
  13759. 11111 33333
  13760. 22222 44444
  13761. @end example
  13762. @item drop_even, 1
  13763. Only output odd frames, even frames are dropped, generating a frame with
  13764. unchanged height at half frame rate.
  13765. @example
  13766. ------> time
  13767. Input:
  13768. Frame 1 Frame 2 Frame 3 Frame 4
  13769. 11111 22222 33333 44444
  13770. 11111 22222 33333 44444
  13771. 11111 22222 33333 44444
  13772. 11111 22222 33333 44444
  13773. Output:
  13774. 11111 33333
  13775. 11111 33333
  13776. 11111 33333
  13777. 11111 33333
  13778. @end example
  13779. @item drop_odd, 2
  13780. Only output even frames, odd frames are dropped, generating a frame with
  13781. unchanged height at half frame rate.
  13782. @example
  13783. ------> time
  13784. Input:
  13785. Frame 1 Frame 2 Frame 3 Frame 4
  13786. 11111 22222 33333 44444
  13787. 11111 22222 33333 44444
  13788. 11111 22222 33333 44444
  13789. 11111 22222 33333 44444
  13790. Output:
  13791. 22222 44444
  13792. 22222 44444
  13793. 22222 44444
  13794. 22222 44444
  13795. @end example
  13796. @item pad, 3
  13797. Expand each frame to full height, but pad alternate lines with black,
  13798. generating a frame with double height at the same input frame rate.
  13799. @example
  13800. ------> time
  13801. Input:
  13802. Frame 1 Frame 2 Frame 3 Frame 4
  13803. 11111 22222 33333 44444
  13804. 11111 22222 33333 44444
  13805. 11111 22222 33333 44444
  13806. 11111 22222 33333 44444
  13807. Output:
  13808. 11111 ..... 33333 .....
  13809. ..... 22222 ..... 44444
  13810. 11111 ..... 33333 .....
  13811. ..... 22222 ..... 44444
  13812. 11111 ..... 33333 .....
  13813. ..... 22222 ..... 44444
  13814. 11111 ..... 33333 .....
  13815. ..... 22222 ..... 44444
  13816. @end example
  13817. @item interleave_top, 4
  13818. Interleave the upper field from odd frames with the lower field from
  13819. even frames, generating a frame with unchanged height at half frame rate.
  13820. @example
  13821. ------> time
  13822. Input:
  13823. Frame 1 Frame 2 Frame 3 Frame 4
  13824. 11111<- 22222 33333<- 44444
  13825. 11111 22222<- 33333 44444<-
  13826. 11111<- 22222 33333<- 44444
  13827. 11111 22222<- 33333 44444<-
  13828. Output:
  13829. 11111 33333
  13830. 22222 44444
  13831. 11111 33333
  13832. 22222 44444
  13833. @end example
  13834. @item interleave_bottom, 5
  13835. Interleave the lower field from odd frames with the upper field from
  13836. even frames, generating a frame with unchanged height at half frame rate.
  13837. @example
  13838. ------> time
  13839. Input:
  13840. Frame 1 Frame 2 Frame 3 Frame 4
  13841. 11111 22222<- 33333 44444<-
  13842. 11111<- 22222 33333<- 44444
  13843. 11111 22222<- 33333 44444<-
  13844. 11111<- 22222 33333<- 44444
  13845. Output:
  13846. 22222 44444
  13847. 11111 33333
  13848. 22222 44444
  13849. 11111 33333
  13850. @end example
  13851. @item interlacex2, 6
  13852. Double frame rate with unchanged height. Frames are inserted each
  13853. containing the second temporal field from the previous input frame and
  13854. the first temporal field from the next input frame. This mode relies on
  13855. the top_field_first flag. Useful for interlaced video displays with no
  13856. field synchronisation.
  13857. @example
  13858. ------> time
  13859. Input:
  13860. Frame 1 Frame 2 Frame 3 Frame 4
  13861. 11111 22222 33333 44444
  13862. 11111 22222 33333 44444
  13863. 11111 22222 33333 44444
  13864. 11111 22222 33333 44444
  13865. Output:
  13866. 11111 22222 22222 33333 33333 44444 44444
  13867. 11111 11111 22222 22222 33333 33333 44444
  13868. 11111 22222 22222 33333 33333 44444 44444
  13869. 11111 11111 22222 22222 33333 33333 44444
  13870. @end example
  13871. @item mergex2, 7
  13872. Move odd frames into the upper field, even into the lower field,
  13873. generating a double height frame at same frame rate.
  13874. @example
  13875. ------> time
  13876. Input:
  13877. Frame 1 Frame 2 Frame 3 Frame 4
  13878. 11111 22222 33333 44444
  13879. 11111 22222 33333 44444
  13880. 11111 22222 33333 44444
  13881. 11111 22222 33333 44444
  13882. Output:
  13883. 11111 33333 33333 55555
  13884. 22222 22222 44444 44444
  13885. 11111 33333 33333 55555
  13886. 22222 22222 44444 44444
  13887. 11111 33333 33333 55555
  13888. 22222 22222 44444 44444
  13889. 11111 33333 33333 55555
  13890. 22222 22222 44444 44444
  13891. @end example
  13892. @end table
  13893. Numeric values are deprecated but are accepted for backward
  13894. compatibility reasons.
  13895. Default mode is @code{merge}.
  13896. @item flags
  13897. Specify flags influencing the filter process.
  13898. Available value for @var{flags} is:
  13899. @table @option
  13900. @item low_pass_filter, vlpf
  13901. Enable linear vertical low-pass filtering in the filter.
  13902. Vertical low-pass filtering is required when creating an interlaced
  13903. destination from a progressive source which contains high-frequency
  13904. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13905. patterning.
  13906. @item complex_filter, cvlpf
  13907. Enable complex vertical low-pass filtering.
  13908. This will slightly less reduce interlace 'twitter' and Moire
  13909. patterning but better retain detail and subjective sharpness impression.
  13910. @item bypass_il
  13911. Bypass already interlaced frames, only adjust the frame rate.
  13912. @end table
  13913. Vertical low-pass filtering and bypassing already interlaced frames can only be
  13914. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  13915. @end table
  13916. @section tmix
  13917. Mix successive video frames.
  13918. A description of the accepted options follows.
  13919. @table @option
  13920. @item frames
  13921. The number of successive frames to mix. If unspecified, it defaults to 3.
  13922. @item weights
  13923. Specify weight of each input video frame.
  13924. Each weight is separated by space. If number of weights is smaller than
  13925. number of @var{frames} last specified weight will be used for all remaining
  13926. unset weights.
  13927. @item scale
  13928. Specify scale, if it is set it will be multiplied with sum
  13929. of each weight multiplied with pixel values to give final destination
  13930. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13931. @end table
  13932. @subsection Examples
  13933. @itemize
  13934. @item
  13935. Average 7 successive frames:
  13936. @example
  13937. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13938. @end example
  13939. @item
  13940. Apply simple temporal convolution:
  13941. @example
  13942. tmix=frames=3:weights="-1 3 -1"
  13943. @end example
  13944. @item
  13945. Similar as above but only showing temporal differences:
  13946. @example
  13947. tmix=frames=3:weights="-1 2 -1":scale=1
  13948. @end example
  13949. @end itemize
  13950. @anchor{tonemap}
  13951. @section tonemap
  13952. Tone map colors from different dynamic ranges.
  13953. This filter expects data in single precision floating point, as it needs to
  13954. operate on (and can output) out-of-range values. Another filter, such as
  13955. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13956. The tonemapping algorithms implemented only work on linear light, so input
  13957. data should be linearized beforehand (and possibly correctly tagged).
  13958. @example
  13959. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13960. @end example
  13961. @subsection Options
  13962. The filter accepts the following options.
  13963. @table @option
  13964. @item tonemap
  13965. Set the tone map algorithm to use.
  13966. Possible values are:
  13967. @table @var
  13968. @item none
  13969. Do not apply any tone map, only desaturate overbright pixels.
  13970. @item clip
  13971. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13972. in-range values, while distorting out-of-range values.
  13973. @item linear
  13974. Stretch the entire reference gamut to a linear multiple of the display.
  13975. @item gamma
  13976. Fit a logarithmic transfer between the tone curves.
  13977. @item reinhard
  13978. Preserve overall image brightness with a simple curve, using nonlinear
  13979. contrast, which results in flattening details and degrading color accuracy.
  13980. @item hable
  13981. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13982. of slightly darkening everything. Use it when detail preservation is more
  13983. important than color and brightness accuracy.
  13984. @item mobius
  13985. Smoothly map out-of-range values, while retaining contrast and colors for
  13986. in-range material as much as possible. Use it when color accuracy is more
  13987. important than detail preservation.
  13988. @end table
  13989. Default is none.
  13990. @item param
  13991. Tune the tone mapping algorithm.
  13992. This affects the following algorithms:
  13993. @table @var
  13994. @item none
  13995. Ignored.
  13996. @item linear
  13997. Specifies the scale factor to use while stretching.
  13998. Default to 1.0.
  13999. @item gamma
  14000. Specifies the exponent of the function.
  14001. Default to 1.8.
  14002. @item clip
  14003. Specify an extra linear coefficient to multiply into the signal before clipping.
  14004. Default to 1.0.
  14005. @item reinhard
  14006. Specify the local contrast coefficient at the display peak.
  14007. Default to 0.5, which means that in-gamut values will be about half as bright
  14008. as when clipping.
  14009. @item hable
  14010. Ignored.
  14011. @item mobius
  14012. Specify the transition point from linear to mobius transform. Every value
  14013. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14014. more accurate the result will be, at the cost of losing bright details.
  14015. Default to 0.3, which due to the steep initial slope still preserves in-range
  14016. colors fairly accurately.
  14017. @end table
  14018. @item desat
  14019. Apply desaturation for highlights that exceed this level of brightness. The
  14020. higher the parameter, the more color information will be preserved. This
  14021. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14022. (smoothly) turning into white instead. This makes images feel more natural,
  14023. at the cost of reducing information about out-of-range colors.
  14024. The default of 2.0 is somewhat conservative and will mostly just apply to
  14025. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14026. This option works only if the input frame has a supported color tag.
  14027. @item peak
  14028. Override signal/nominal/reference peak with this value. Useful when the
  14029. embedded peak information in display metadata is not reliable or when tone
  14030. mapping from a lower range to a higher range.
  14031. @end table
  14032. @section tpad
  14033. Temporarily pad video frames.
  14034. The filter accepts the following options:
  14035. @table @option
  14036. @item start
  14037. Specify number of delay frames before input video stream.
  14038. @item stop
  14039. Specify number of padding frames after input video stream.
  14040. Set to -1 to pad indefinitely.
  14041. @item start_mode
  14042. Set kind of frames added to beginning of stream.
  14043. Can be either @var{add} or @var{clone}.
  14044. With @var{add} frames of solid-color are added.
  14045. With @var{clone} frames are clones of first frame.
  14046. @item stop_mode
  14047. Set kind of frames added to end of stream.
  14048. Can be either @var{add} or @var{clone}.
  14049. With @var{add} frames of solid-color are added.
  14050. With @var{clone} frames are clones of last frame.
  14051. @item start_duration, stop_duration
  14052. Specify the duration of the start/stop delay. See
  14053. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14054. for the accepted syntax.
  14055. These options override @var{start} and @var{stop}.
  14056. @item color
  14057. Specify the color of the padded area. For the syntax of this option,
  14058. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14059. manual,ffmpeg-utils}.
  14060. The default value of @var{color} is "black".
  14061. @end table
  14062. @anchor{transpose}
  14063. @section transpose
  14064. Transpose rows with columns in the input video and optionally flip it.
  14065. It accepts the following parameters:
  14066. @table @option
  14067. @item dir
  14068. Specify the transposition direction.
  14069. Can assume the following values:
  14070. @table @samp
  14071. @item 0, 4, cclock_flip
  14072. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14073. @example
  14074. L.R L.l
  14075. . . -> . .
  14076. l.r R.r
  14077. @end example
  14078. @item 1, 5, clock
  14079. Rotate by 90 degrees clockwise, that is:
  14080. @example
  14081. L.R l.L
  14082. . . -> . .
  14083. l.r r.R
  14084. @end example
  14085. @item 2, 6, cclock
  14086. Rotate by 90 degrees counterclockwise, that is:
  14087. @example
  14088. L.R R.r
  14089. . . -> . .
  14090. l.r L.l
  14091. @end example
  14092. @item 3, 7, clock_flip
  14093. Rotate by 90 degrees clockwise and vertically flip, that is:
  14094. @example
  14095. L.R r.R
  14096. . . -> . .
  14097. l.r l.L
  14098. @end example
  14099. @end table
  14100. For values between 4-7, the transposition is only done if the input
  14101. video geometry is portrait and not landscape. These values are
  14102. deprecated, the @code{passthrough} option should be used instead.
  14103. Numerical values are deprecated, and should be dropped in favor of
  14104. symbolic constants.
  14105. @item passthrough
  14106. Do not apply the transposition if the input geometry matches the one
  14107. specified by the specified value. It accepts the following values:
  14108. @table @samp
  14109. @item none
  14110. Always apply transposition.
  14111. @item portrait
  14112. Preserve portrait geometry (when @var{height} >= @var{width}).
  14113. @item landscape
  14114. Preserve landscape geometry (when @var{width} >= @var{height}).
  14115. @end table
  14116. Default value is @code{none}.
  14117. @end table
  14118. For example to rotate by 90 degrees clockwise and preserve portrait
  14119. layout:
  14120. @example
  14121. transpose=dir=1:passthrough=portrait
  14122. @end example
  14123. The command above can also be specified as:
  14124. @example
  14125. transpose=1:portrait
  14126. @end example
  14127. @section transpose_npp
  14128. Transpose rows with columns in the input video and optionally flip it.
  14129. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14130. It accepts the following parameters:
  14131. @table @option
  14132. @item dir
  14133. Specify the transposition direction.
  14134. Can assume the following values:
  14135. @table @samp
  14136. @item cclock_flip
  14137. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14138. @item clock
  14139. Rotate by 90 degrees clockwise.
  14140. @item cclock
  14141. Rotate by 90 degrees counterclockwise.
  14142. @item clock_flip
  14143. Rotate by 90 degrees clockwise and vertically flip.
  14144. @end table
  14145. @item passthrough
  14146. Do not apply the transposition if the input geometry matches the one
  14147. specified by the specified value. It accepts the following values:
  14148. @table @samp
  14149. @item none
  14150. Always apply transposition. (default)
  14151. @item portrait
  14152. Preserve portrait geometry (when @var{height} >= @var{width}).
  14153. @item landscape
  14154. Preserve landscape geometry (when @var{width} >= @var{height}).
  14155. @end table
  14156. @end table
  14157. @section trim
  14158. Trim the input so that the output contains one continuous subpart of the input.
  14159. It accepts the following parameters:
  14160. @table @option
  14161. @item start
  14162. Specify the time of the start of the kept section, i.e. the frame with the
  14163. timestamp @var{start} will be the first frame in the output.
  14164. @item end
  14165. Specify the time of the first frame that will be dropped, i.e. the frame
  14166. immediately preceding the one with the timestamp @var{end} will be the last
  14167. frame in the output.
  14168. @item start_pts
  14169. This is the same as @var{start}, except this option sets the start timestamp
  14170. in timebase units instead of seconds.
  14171. @item end_pts
  14172. This is the same as @var{end}, except this option sets the end timestamp
  14173. in timebase units instead of seconds.
  14174. @item duration
  14175. The maximum duration of the output in seconds.
  14176. @item start_frame
  14177. The number of the first frame that should be passed to the output.
  14178. @item end_frame
  14179. The number of the first frame that should be dropped.
  14180. @end table
  14181. @option{start}, @option{end}, and @option{duration} are expressed as time
  14182. duration specifications; see
  14183. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14184. for the accepted syntax.
  14185. Note that the first two sets of the start/end options and the @option{duration}
  14186. option look at the frame timestamp, while the _frame variants simply count the
  14187. frames that pass through the filter. Also note that this filter does not modify
  14188. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14189. setpts filter after the trim filter.
  14190. If multiple start or end options are set, this filter tries to be greedy and
  14191. keep all the frames that match at least one of the specified constraints. To keep
  14192. only the part that matches all the constraints at once, chain multiple trim
  14193. filters.
  14194. The defaults are such that all the input is kept. So it is possible to set e.g.
  14195. just the end values to keep everything before the specified time.
  14196. Examples:
  14197. @itemize
  14198. @item
  14199. Drop everything except the second minute of input:
  14200. @example
  14201. ffmpeg -i INPUT -vf trim=60:120
  14202. @end example
  14203. @item
  14204. Keep only the first second:
  14205. @example
  14206. ffmpeg -i INPUT -vf trim=duration=1
  14207. @end example
  14208. @end itemize
  14209. @section unpremultiply
  14210. Apply alpha unpremultiply effect to input video stream using first plane
  14211. of second stream as alpha.
  14212. Both streams must have same dimensions and same pixel format.
  14213. The filter accepts the following option:
  14214. @table @option
  14215. @item planes
  14216. Set which planes will be processed, unprocessed planes will be copied.
  14217. By default value 0xf, all planes will be processed.
  14218. If the format has 1 or 2 components, then luma is bit 0.
  14219. If the format has 3 or 4 components:
  14220. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14221. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14222. If present, the alpha channel is always the last bit.
  14223. @item inplace
  14224. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14225. @end table
  14226. @anchor{unsharp}
  14227. @section unsharp
  14228. Sharpen or blur the input video.
  14229. It accepts the following parameters:
  14230. @table @option
  14231. @item luma_msize_x, lx
  14232. Set the luma matrix horizontal size. It must be an odd integer between
  14233. 3 and 23. The default value is 5.
  14234. @item luma_msize_y, ly
  14235. Set the luma matrix vertical size. It must be an odd integer between 3
  14236. and 23. The default value is 5.
  14237. @item luma_amount, la
  14238. Set the luma effect strength. It must be a floating point number, reasonable
  14239. values lay between -1.5 and 1.5.
  14240. Negative values will blur the input video, while positive values will
  14241. sharpen it, a value of zero will disable the effect.
  14242. Default value is 1.0.
  14243. @item chroma_msize_x, cx
  14244. Set the chroma matrix horizontal size. It must be an odd integer
  14245. between 3 and 23. The default value is 5.
  14246. @item chroma_msize_y, cy
  14247. Set the chroma matrix vertical size. It must be an odd integer
  14248. between 3 and 23. The default value is 5.
  14249. @item chroma_amount, ca
  14250. Set the chroma effect strength. It must be a floating point number, reasonable
  14251. values lay between -1.5 and 1.5.
  14252. Negative values will blur the input video, while positive values will
  14253. sharpen it, a value of zero will disable the effect.
  14254. Default value is 0.0.
  14255. @end table
  14256. All parameters are optional and default to the equivalent of the
  14257. string '5:5:1.0:5:5:0.0'.
  14258. @subsection Examples
  14259. @itemize
  14260. @item
  14261. Apply strong luma sharpen effect:
  14262. @example
  14263. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14264. @end example
  14265. @item
  14266. Apply a strong blur of both luma and chroma parameters:
  14267. @example
  14268. unsharp=7:7:-2:7:7:-2
  14269. @end example
  14270. @end itemize
  14271. @section uspp
  14272. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14273. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14274. shifts and average the results.
  14275. The way this differs from the behavior of spp is that uspp actually encodes &
  14276. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14277. DCT similar to MJPEG.
  14278. The filter accepts the following options:
  14279. @table @option
  14280. @item quality
  14281. Set quality. This option defines the number of levels for averaging. It accepts
  14282. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14283. effect. A value of @code{8} means the higher quality. For each increment of
  14284. that value the speed drops by a factor of approximately 2. Default value is
  14285. @code{3}.
  14286. @item qp
  14287. Force a constant quantization parameter. If not set, the filter will use the QP
  14288. from the video stream (if available).
  14289. @end table
  14290. @section v360
  14291. Convert 360 videos between various formats.
  14292. The filter accepts the following options:
  14293. @table @option
  14294. @item input
  14295. @item output
  14296. Set format of the input/output video.
  14297. Available formats:
  14298. @table @samp
  14299. @item e
  14300. @item equirect
  14301. Equirectangular projection.
  14302. @item c3x2
  14303. @item c6x1
  14304. @item c1x6
  14305. Cubemap with 3x2/6x1/1x6 layout.
  14306. Format specific options:
  14307. @table @option
  14308. @item in_pad
  14309. @item out_pad
  14310. Set padding proportion for the input/output cubemap. Values in decimals.
  14311. Example values:
  14312. @table @samp
  14313. @item 0
  14314. No padding.
  14315. @item 0.01
  14316. 1% of face is padding. For example, with 1920x1280 resolution face size would be 640x640 and padding would be 3 pixels from each side. (640 * 0.01 = 6 pixels)
  14317. @end table
  14318. Default value is @b{@samp{0}}.
  14319. @item fin_pad
  14320. @item fout_pad
  14321. Set fixed padding for the input/output cubemap. Values in pixels.
  14322. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14323. @item in_forder
  14324. @item out_forder
  14325. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14326. Designation of directions:
  14327. @table @samp
  14328. @item r
  14329. right
  14330. @item l
  14331. left
  14332. @item u
  14333. up
  14334. @item d
  14335. down
  14336. @item f
  14337. forward
  14338. @item b
  14339. back
  14340. @end table
  14341. Default value is @b{@samp{rludfb}}.
  14342. @item in_frot
  14343. @item out_frot
  14344. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14345. Designation of angles:
  14346. @table @samp
  14347. @item 0
  14348. 0 degrees clockwise
  14349. @item 1
  14350. 90 degrees clockwise
  14351. @item 2
  14352. 180 degrees clockwise
  14353. @item 3
  14354. 270 degrees clockwise
  14355. @end table
  14356. Default value is @b{@samp{000000}}.
  14357. @end table
  14358. @item eac
  14359. Equi-Angular Cubemap.
  14360. @item flat
  14361. @item gnomonic
  14362. @item rectilinear
  14363. Regular video. @i{(output only)}
  14364. Format specific options:
  14365. @table @option
  14366. @item h_fov
  14367. @item v_fov
  14368. @item d_fov
  14369. Set horizontal/vertical/diagonal field of view. Values in degrees.
  14370. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14371. @end table
  14372. @item dfisheye
  14373. Dual fisheye.
  14374. Format specific options:
  14375. @table @option
  14376. @item in_pad
  14377. @item out_pad
  14378. Set padding proportion. Values in decimals.
  14379. Example values:
  14380. @table @samp
  14381. @item 0
  14382. No padding.
  14383. @item 0.01
  14384. 1% padding.
  14385. @end table
  14386. Default value is @b{@samp{0}}.
  14387. @end table
  14388. @item barrel
  14389. @item fb
  14390. Facebook's 360 format.
  14391. @item sg
  14392. Stereographic format.
  14393. Format specific options:
  14394. @table @option
  14395. @item h_fov
  14396. @item v_fov
  14397. @item d_fov
  14398. Set horizontal/vertical/diagonal field of view. Values in degrees.
  14399. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14400. @end table
  14401. @item mercator
  14402. Mercator format.
  14403. @item ball
  14404. Ball format, gives significant distortion toward the back.
  14405. @item hammer
  14406. Hammer-Aitoff map projection format.
  14407. @item sinusoidal
  14408. Sinusoidal map projection format.
  14409. @end table
  14410. @item interp
  14411. Set interpolation method.@*
  14412. @i{Note: more complex interpolation methods require much more memory to run.}
  14413. Available methods:
  14414. @table @samp
  14415. @item near
  14416. @item nearest
  14417. Nearest neighbour.
  14418. @item line
  14419. @item linear
  14420. Bilinear interpolation.
  14421. @item cube
  14422. @item cubic
  14423. Bicubic interpolation.
  14424. @item lanc
  14425. @item lanczos
  14426. Lanczos interpolation.
  14427. @end table
  14428. Default value is @b{@samp{line}}.
  14429. @item w
  14430. @item h
  14431. Set the output video resolution.
  14432. Default resolution depends on formats.
  14433. @item in_stereo
  14434. @item out_stereo
  14435. Set the input/output stereo format.
  14436. @table @samp
  14437. @item 2d
  14438. 2D mono
  14439. @item sbs
  14440. Side by side
  14441. @item tb
  14442. Top bottom
  14443. @end table
  14444. Default value is @b{@samp{2d}} for input and output format.
  14445. @item yaw
  14446. @item pitch
  14447. @item roll
  14448. Set rotation for the output video. Values in degrees.
  14449. @item rorder
  14450. Set rotation order for the output video. Choose one item for each position.
  14451. @table @samp
  14452. @item y, Y
  14453. yaw
  14454. @item p, P
  14455. pitch
  14456. @item r, R
  14457. roll
  14458. @end table
  14459. Default value is @b{@samp{ypr}}.
  14460. @item h_flip
  14461. @item v_flip
  14462. @item d_flip
  14463. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14464. @item ih_flip
  14465. @item iv_flip
  14466. Set if input video is flipped horizontally/vertically. Boolean values.
  14467. @item in_trans
  14468. Set if input video is transposed. Boolean value, by default disabled.
  14469. @item out_trans
  14470. Set if output video needs to be transposed. Boolean value, by default disabled.
  14471. @end table
  14472. @subsection Examples
  14473. @itemize
  14474. @item
  14475. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14476. @example
  14477. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14478. @end example
  14479. @item
  14480. Extract back view of Equi-Angular Cubemap:
  14481. @example
  14482. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14483. @end example
  14484. @item
  14485. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14486. @example
  14487. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14488. @end example
  14489. @end itemize
  14490. @section vaguedenoiser
  14491. Apply a wavelet based denoiser.
  14492. It transforms each frame from the video input into the wavelet domain,
  14493. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14494. the obtained coefficients. It does an inverse wavelet transform after.
  14495. Due to wavelet properties, it should give a nice smoothed result, and
  14496. reduced noise, without blurring picture features.
  14497. This filter accepts the following options:
  14498. @table @option
  14499. @item threshold
  14500. The filtering strength. The higher, the more filtered the video will be.
  14501. Hard thresholding can use a higher threshold than soft thresholding
  14502. before the video looks overfiltered. Default value is 2.
  14503. @item method
  14504. The filtering method the filter will use.
  14505. It accepts the following values:
  14506. @table @samp
  14507. @item hard
  14508. All values under the threshold will be zeroed.
  14509. @item soft
  14510. All values under the threshold will be zeroed. All values above will be
  14511. reduced by the threshold.
  14512. @item garrote
  14513. Scales or nullifies coefficients - intermediary between (more) soft and
  14514. (less) hard thresholding.
  14515. @end table
  14516. Default is garrote.
  14517. @item nsteps
  14518. Number of times, the wavelet will decompose the picture. Picture can't
  14519. be decomposed beyond a particular point (typically, 8 for a 640x480
  14520. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14521. @item percent
  14522. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14523. @item planes
  14524. A list of the planes to process. By default all planes are processed.
  14525. @end table
  14526. @section vectorscope
  14527. Display 2 color component values in the two dimensional graph (which is called
  14528. a vectorscope).
  14529. This filter accepts the following options:
  14530. @table @option
  14531. @item mode, m
  14532. Set vectorscope mode.
  14533. It accepts the following values:
  14534. @table @samp
  14535. @item gray
  14536. @item tint
  14537. Gray values are displayed on graph, higher brightness means more pixels have
  14538. same component color value on location in graph. This is the default mode.
  14539. @item color
  14540. Gray values are displayed on graph. Surrounding pixels values which are not
  14541. present in video frame are drawn in gradient of 2 color components which are
  14542. set by option @code{x} and @code{y}. The 3rd color component is static.
  14543. @item color2
  14544. Actual color components values present in video frame are displayed on graph.
  14545. @item color3
  14546. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14547. on graph increases value of another color component, which is luminance by
  14548. default values of @code{x} and @code{y}.
  14549. @item color4
  14550. Actual colors present in video frame are displayed on graph. If two different
  14551. colors map to same position on graph then color with higher value of component
  14552. not present in graph is picked.
  14553. @item color5
  14554. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14555. component picked from radial gradient.
  14556. @end table
  14557. @item x
  14558. Set which color component will be represented on X-axis. Default is @code{1}.
  14559. @item y
  14560. Set which color component will be represented on Y-axis. Default is @code{2}.
  14561. @item intensity, i
  14562. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14563. of color component which represents frequency of (X, Y) location in graph.
  14564. @item envelope, e
  14565. @table @samp
  14566. @item none
  14567. No envelope, this is default.
  14568. @item instant
  14569. Instant envelope, even darkest single pixel will be clearly highlighted.
  14570. @item peak
  14571. Hold maximum and minimum values presented in graph over time. This way you
  14572. can still spot out of range values without constantly looking at vectorscope.
  14573. @item peak+instant
  14574. Peak and instant envelope combined together.
  14575. @end table
  14576. @item graticule, g
  14577. Set what kind of graticule to draw.
  14578. @table @samp
  14579. @item none
  14580. @item green
  14581. @item color
  14582. @item invert
  14583. @end table
  14584. @item opacity, o
  14585. Set graticule opacity.
  14586. @item flags, f
  14587. Set graticule flags.
  14588. @table @samp
  14589. @item white
  14590. Draw graticule for white point.
  14591. @item black
  14592. Draw graticule for black point.
  14593. @item name
  14594. Draw color points short names.
  14595. @end table
  14596. @item bgopacity, b
  14597. Set background opacity.
  14598. @item lthreshold, l
  14599. Set low threshold for color component not represented on X or Y axis.
  14600. Values lower than this value will be ignored. Default is 0.
  14601. Note this value is multiplied with actual max possible value one pixel component
  14602. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14603. is 0.1 * 255 = 25.
  14604. @item hthreshold, h
  14605. Set high threshold for color component not represented on X or Y axis.
  14606. Values higher than this value will be ignored. Default is 1.
  14607. Note this value is multiplied with actual max possible value one pixel component
  14608. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14609. is 0.9 * 255 = 230.
  14610. @item colorspace, c
  14611. Set what kind of colorspace to use when drawing graticule.
  14612. @table @samp
  14613. @item auto
  14614. @item 601
  14615. @item 709
  14616. @end table
  14617. Default is auto.
  14618. @item tint0, t0
  14619. @item tint1, t1
  14620. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  14621. This means no tint, and output will remain gray.
  14622. @end table
  14623. @anchor{vidstabdetect}
  14624. @section vidstabdetect
  14625. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14626. @ref{vidstabtransform} for pass 2.
  14627. This filter generates a file with relative translation and rotation
  14628. transform information about subsequent frames, which is then used by
  14629. the @ref{vidstabtransform} filter.
  14630. To enable compilation of this filter you need to configure FFmpeg with
  14631. @code{--enable-libvidstab}.
  14632. This filter accepts the following options:
  14633. @table @option
  14634. @item result
  14635. Set the path to the file used to write the transforms information.
  14636. Default value is @file{transforms.trf}.
  14637. @item shakiness
  14638. Set how shaky the video is and how quick the camera is. It accepts an
  14639. integer in the range 1-10, a value of 1 means little shakiness, a
  14640. value of 10 means strong shakiness. Default value is 5.
  14641. @item accuracy
  14642. Set the accuracy of the detection process. It must be a value in the
  14643. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14644. accuracy. Default value is 15.
  14645. @item stepsize
  14646. Set stepsize of the search process. The region around minimum is
  14647. scanned with 1 pixel resolution. Default value is 6.
  14648. @item mincontrast
  14649. Set minimum contrast. Below this value a local measurement field is
  14650. discarded. Must be a floating point value in the range 0-1. Default
  14651. value is 0.3.
  14652. @item tripod
  14653. Set reference frame number for tripod mode.
  14654. If enabled, the motion of the frames is compared to a reference frame
  14655. in the filtered stream, identified by the specified number. The idea
  14656. is to compensate all movements in a more-or-less static scene and keep
  14657. the camera view absolutely still.
  14658. If set to 0, it is disabled. The frames are counted starting from 1.
  14659. @item show
  14660. Show fields and transforms in the resulting frames. It accepts an
  14661. integer in the range 0-2. Default value is 0, which disables any
  14662. visualization.
  14663. @end table
  14664. @subsection Examples
  14665. @itemize
  14666. @item
  14667. Use default values:
  14668. @example
  14669. vidstabdetect
  14670. @end example
  14671. @item
  14672. Analyze strongly shaky movie and put the results in file
  14673. @file{mytransforms.trf}:
  14674. @example
  14675. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14676. @end example
  14677. @item
  14678. Visualize the result of internal transformations in the resulting
  14679. video:
  14680. @example
  14681. vidstabdetect=show=1
  14682. @end example
  14683. @item
  14684. Analyze a video with medium shakiness using @command{ffmpeg}:
  14685. @example
  14686. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14687. @end example
  14688. @end itemize
  14689. @anchor{vidstabtransform}
  14690. @section vidstabtransform
  14691. Video stabilization/deshaking: pass 2 of 2,
  14692. see @ref{vidstabdetect} for pass 1.
  14693. Read a file with transform information for each frame and
  14694. apply/compensate them. Together with the @ref{vidstabdetect}
  14695. filter this can be used to deshake videos. See also
  14696. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14697. the @ref{unsharp} filter, see below.
  14698. To enable compilation of this filter you need to configure FFmpeg with
  14699. @code{--enable-libvidstab}.
  14700. @subsection Options
  14701. @table @option
  14702. @item input
  14703. Set path to the file used to read the transforms. Default value is
  14704. @file{transforms.trf}.
  14705. @item smoothing
  14706. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14707. camera movements. Default value is 10.
  14708. For example a number of 10 means that 21 frames are used (10 in the
  14709. past and 10 in the future) to smoothen the motion in the video. A
  14710. larger value leads to a smoother video, but limits the acceleration of
  14711. the camera (pan/tilt movements). 0 is a special case where a static
  14712. camera is simulated.
  14713. @item optalgo
  14714. Set the camera path optimization algorithm.
  14715. Accepted values are:
  14716. @table @samp
  14717. @item gauss
  14718. gaussian kernel low-pass filter on camera motion (default)
  14719. @item avg
  14720. averaging on transformations
  14721. @end table
  14722. @item maxshift
  14723. Set maximal number of pixels to translate frames. Default value is -1,
  14724. meaning no limit.
  14725. @item maxangle
  14726. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14727. value is -1, meaning no limit.
  14728. @item crop
  14729. Specify how to deal with borders that may be visible due to movement
  14730. compensation.
  14731. Available values are:
  14732. @table @samp
  14733. @item keep
  14734. keep image information from previous frame (default)
  14735. @item black
  14736. fill the border black
  14737. @end table
  14738. @item invert
  14739. Invert transforms if set to 1. Default value is 0.
  14740. @item relative
  14741. Consider transforms as relative to previous frame if set to 1,
  14742. absolute if set to 0. Default value is 0.
  14743. @item zoom
  14744. Set percentage to zoom. A positive value will result in a zoom-in
  14745. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14746. zoom).
  14747. @item optzoom
  14748. Set optimal zooming to avoid borders.
  14749. Accepted values are:
  14750. @table @samp
  14751. @item 0
  14752. disabled
  14753. @item 1
  14754. optimal static zoom value is determined (only very strong movements
  14755. will lead to visible borders) (default)
  14756. @item 2
  14757. optimal adaptive zoom value is determined (no borders will be
  14758. visible), see @option{zoomspeed}
  14759. @end table
  14760. Note that the value given at zoom is added to the one calculated here.
  14761. @item zoomspeed
  14762. Set percent to zoom maximally each frame (enabled when
  14763. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14764. 0.25.
  14765. @item interpol
  14766. Specify type of interpolation.
  14767. Available values are:
  14768. @table @samp
  14769. @item no
  14770. no interpolation
  14771. @item linear
  14772. linear only horizontal
  14773. @item bilinear
  14774. linear in both directions (default)
  14775. @item bicubic
  14776. cubic in both directions (slow)
  14777. @end table
  14778. @item tripod
  14779. Enable virtual tripod mode if set to 1, which is equivalent to
  14780. @code{relative=0:smoothing=0}. Default value is 0.
  14781. Use also @code{tripod} option of @ref{vidstabdetect}.
  14782. @item debug
  14783. Increase log verbosity if set to 1. Also the detected global motions
  14784. are written to the temporary file @file{global_motions.trf}. Default
  14785. value is 0.
  14786. @end table
  14787. @subsection Examples
  14788. @itemize
  14789. @item
  14790. Use @command{ffmpeg} for a typical stabilization with default values:
  14791. @example
  14792. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14793. @end example
  14794. Note the use of the @ref{unsharp} filter which is always recommended.
  14795. @item
  14796. Zoom in a bit more and load transform data from a given file:
  14797. @example
  14798. vidstabtransform=zoom=5:input="mytransforms.trf"
  14799. @end example
  14800. @item
  14801. Smoothen the video even more:
  14802. @example
  14803. vidstabtransform=smoothing=30
  14804. @end example
  14805. @end itemize
  14806. @section vflip
  14807. Flip the input video vertically.
  14808. For example, to vertically flip a video with @command{ffmpeg}:
  14809. @example
  14810. ffmpeg -i in.avi -vf "vflip" out.avi
  14811. @end example
  14812. @section vfrdet
  14813. Detect variable frame rate video.
  14814. This filter tries to detect if the input is variable or constant frame rate.
  14815. At end it will output number of frames detected as having variable delta pts,
  14816. and ones with constant delta pts.
  14817. If there was frames with variable delta, than it will also show min, max and
  14818. average delta encountered.
  14819. @section vibrance
  14820. Boost or alter saturation.
  14821. The filter accepts the following options:
  14822. @table @option
  14823. @item intensity
  14824. Set strength of boost if positive value or strength of alter if negative value.
  14825. Default is 0. Allowed range is from -2 to 2.
  14826. @item rbal
  14827. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14828. @item gbal
  14829. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14830. @item bbal
  14831. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14832. @item rlum
  14833. Set the red luma coefficient.
  14834. @item glum
  14835. Set the green luma coefficient.
  14836. @item blum
  14837. Set the blue luma coefficient.
  14838. @item alternate
  14839. If @code{intensity} is negative and this is set to 1, colors will change,
  14840. otherwise colors will be less saturated, more towards gray.
  14841. @end table
  14842. @subsection Commands
  14843. This filter supports the all above options as @ref{commands}.
  14844. @anchor{vignette}
  14845. @section vignette
  14846. Make or reverse a natural vignetting effect.
  14847. The filter accepts the following options:
  14848. @table @option
  14849. @item angle, a
  14850. Set lens angle expression as a number of radians.
  14851. The value is clipped in the @code{[0,PI/2]} range.
  14852. Default value: @code{"PI/5"}
  14853. @item x0
  14854. @item y0
  14855. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14856. by default.
  14857. @item mode
  14858. Set forward/backward mode.
  14859. Available modes are:
  14860. @table @samp
  14861. @item forward
  14862. The larger the distance from the central point, the darker the image becomes.
  14863. @item backward
  14864. The larger the distance from the central point, the brighter the image becomes.
  14865. This can be used to reverse a vignette effect, though there is no automatic
  14866. detection to extract the lens @option{angle} and other settings (yet). It can
  14867. also be used to create a burning effect.
  14868. @end table
  14869. Default value is @samp{forward}.
  14870. @item eval
  14871. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14872. It accepts the following values:
  14873. @table @samp
  14874. @item init
  14875. Evaluate expressions only once during the filter initialization.
  14876. @item frame
  14877. Evaluate expressions for each incoming frame. This is way slower than the
  14878. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14879. allows advanced dynamic expressions.
  14880. @end table
  14881. Default value is @samp{init}.
  14882. @item dither
  14883. Set dithering to reduce the circular banding effects. Default is @code{1}
  14884. (enabled).
  14885. @item aspect
  14886. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14887. Setting this value to the SAR of the input will make a rectangular vignetting
  14888. following the dimensions of the video.
  14889. Default is @code{1/1}.
  14890. @end table
  14891. @subsection Expressions
  14892. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14893. following parameters.
  14894. @table @option
  14895. @item w
  14896. @item h
  14897. input width and height
  14898. @item n
  14899. the number of input frame, starting from 0
  14900. @item pts
  14901. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14902. @var{TB} units, NAN if undefined
  14903. @item r
  14904. frame rate of the input video, NAN if the input frame rate is unknown
  14905. @item t
  14906. the PTS (Presentation TimeStamp) of the filtered video frame,
  14907. expressed in seconds, NAN if undefined
  14908. @item tb
  14909. time base of the input video
  14910. @end table
  14911. @subsection Examples
  14912. @itemize
  14913. @item
  14914. Apply simple strong vignetting effect:
  14915. @example
  14916. vignette=PI/4
  14917. @end example
  14918. @item
  14919. Make a flickering vignetting:
  14920. @example
  14921. vignette='PI/4+random(1)*PI/50':eval=frame
  14922. @end example
  14923. @end itemize
  14924. @section vmafmotion
  14925. Obtain the average VMAF motion score of a video.
  14926. It is one of the component metrics of VMAF.
  14927. The obtained average motion score is printed through the logging system.
  14928. The filter accepts the following options:
  14929. @table @option
  14930. @item stats_file
  14931. If specified, the filter will use the named file to save the motion score of
  14932. each frame with respect to the previous frame.
  14933. When filename equals "-" the data is sent to standard output.
  14934. @end table
  14935. Example:
  14936. @example
  14937. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  14938. @end example
  14939. @section vstack
  14940. Stack input videos vertically.
  14941. All streams must be of same pixel format and of same width.
  14942. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14943. to create same output.
  14944. The filter accepts the following options:
  14945. @table @option
  14946. @item inputs
  14947. Set number of input streams. Default is 2.
  14948. @item shortest
  14949. If set to 1, force the output to terminate when the shortest input
  14950. terminates. Default value is 0.
  14951. @end table
  14952. @section w3fdif
  14953. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14954. Deinterlacing Filter").
  14955. Based on the process described by Martin Weston for BBC R&D, and
  14956. implemented based on the de-interlace algorithm written by Jim
  14957. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14958. uses filter coefficients calculated by BBC R&D.
  14959. This filter uses field-dominance information in frame to decide which
  14960. of each pair of fields to place first in the output.
  14961. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14962. There are two sets of filter coefficients, so called "simple"
  14963. and "complex". Which set of filter coefficients is used can
  14964. be set by passing an optional parameter:
  14965. @table @option
  14966. @item filter
  14967. Set the interlacing filter coefficients. Accepts one of the following values:
  14968. @table @samp
  14969. @item simple
  14970. Simple filter coefficient set.
  14971. @item complex
  14972. More-complex filter coefficient set.
  14973. @end table
  14974. Default value is @samp{complex}.
  14975. @item deint
  14976. Specify which frames to deinterlace. Accepts one of the following values:
  14977. @table @samp
  14978. @item all
  14979. Deinterlace all frames,
  14980. @item interlaced
  14981. Only deinterlace frames marked as interlaced.
  14982. @end table
  14983. Default value is @samp{all}.
  14984. @end table
  14985. @section waveform
  14986. Video waveform monitor.
  14987. The waveform monitor plots color component intensity. By default luminance
  14988. only. Each column of the waveform corresponds to a column of pixels in the
  14989. source video.
  14990. It accepts the following options:
  14991. @table @option
  14992. @item mode, m
  14993. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14994. In row mode, the graph on the left side represents color component value 0 and
  14995. the right side represents value = 255. In column mode, the top side represents
  14996. color component value = 0 and bottom side represents value = 255.
  14997. @item intensity, i
  14998. Set intensity. Smaller values are useful to find out how many values of the same
  14999. luminance are distributed across input rows/columns.
  15000. Default value is @code{0.04}. Allowed range is [0, 1].
  15001. @item mirror, r
  15002. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15003. In mirrored mode, higher values will be represented on the left
  15004. side for @code{row} mode and at the top for @code{column} mode. Default is
  15005. @code{1} (mirrored).
  15006. @item display, d
  15007. Set display mode.
  15008. It accepts the following values:
  15009. @table @samp
  15010. @item overlay
  15011. Presents information identical to that in the @code{parade}, except
  15012. that the graphs representing color components are superimposed directly
  15013. over one another.
  15014. This display mode makes it easier to spot relative differences or similarities
  15015. in overlapping areas of the color components that are supposed to be identical,
  15016. such as neutral whites, grays, or blacks.
  15017. @item stack
  15018. Display separate graph for the color components side by side in
  15019. @code{row} mode or one below the other in @code{column} mode.
  15020. @item parade
  15021. Display separate graph for the color components side by side in
  15022. @code{column} mode or one below the other in @code{row} mode.
  15023. Using this display mode makes it easy to spot color casts in the highlights
  15024. and shadows of an image, by comparing the contours of the top and the bottom
  15025. graphs of each waveform. Since whites, grays, and blacks are characterized
  15026. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15027. should display three waveforms of roughly equal width/height. If not, the
  15028. correction is easy to perform by making level adjustments the three waveforms.
  15029. @end table
  15030. Default is @code{stack}.
  15031. @item components, c
  15032. Set which color components to display. Default is 1, which means only luminance
  15033. or red color component if input is in RGB colorspace. If is set for example to
  15034. 7 it will display all 3 (if) available color components.
  15035. @item envelope, e
  15036. @table @samp
  15037. @item none
  15038. No envelope, this is default.
  15039. @item instant
  15040. Instant envelope, minimum and maximum values presented in graph will be easily
  15041. visible even with small @code{step} value.
  15042. @item peak
  15043. Hold minimum and maximum values presented in graph across time. This way you
  15044. can still spot out of range values without constantly looking at waveforms.
  15045. @item peak+instant
  15046. Peak and instant envelope combined together.
  15047. @end table
  15048. @item filter, f
  15049. @table @samp
  15050. @item lowpass
  15051. No filtering, this is default.
  15052. @item flat
  15053. Luma and chroma combined together.
  15054. @item aflat
  15055. Similar as above, but shows difference between blue and red chroma.
  15056. @item xflat
  15057. Similar as above, but use different colors.
  15058. @item yflat
  15059. Similar as above, but again with different colors.
  15060. @item chroma
  15061. Displays only chroma.
  15062. @item color
  15063. Displays actual color value on waveform.
  15064. @item acolor
  15065. Similar as above, but with luma showing frequency of chroma values.
  15066. @end table
  15067. @item graticule, g
  15068. Set which graticule to display.
  15069. @table @samp
  15070. @item none
  15071. Do not display graticule.
  15072. @item green
  15073. Display green graticule showing legal broadcast ranges.
  15074. @item orange
  15075. Display orange graticule showing legal broadcast ranges.
  15076. @item invert
  15077. Display invert graticule showing legal broadcast ranges.
  15078. @end table
  15079. @item opacity, o
  15080. Set graticule opacity.
  15081. @item flags, fl
  15082. Set graticule flags.
  15083. @table @samp
  15084. @item numbers
  15085. Draw numbers above lines. By default enabled.
  15086. @item dots
  15087. Draw dots instead of lines.
  15088. @end table
  15089. @item scale, s
  15090. Set scale used for displaying graticule.
  15091. @table @samp
  15092. @item digital
  15093. @item millivolts
  15094. @item ire
  15095. @end table
  15096. Default is digital.
  15097. @item bgopacity, b
  15098. Set background opacity.
  15099. @item tint0, t0
  15100. @item tint1, t1
  15101. Set tint for output.
  15102. Only used with lowpass filter and when display is not overlay and input
  15103. pixel formats are not RGB.
  15104. @end table
  15105. @section weave, doubleweave
  15106. The @code{weave} takes a field-based video input and join
  15107. each two sequential fields into single frame, producing a new double
  15108. height clip with half the frame rate and half the frame count.
  15109. The @code{doubleweave} works same as @code{weave} but without
  15110. halving frame rate and frame count.
  15111. It accepts the following option:
  15112. @table @option
  15113. @item first_field
  15114. Set first field. Available values are:
  15115. @table @samp
  15116. @item top, t
  15117. Set the frame as top-field-first.
  15118. @item bottom, b
  15119. Set the frame as bottom-field-first.
  15120. @end table
  15121. @end table
  15122. @subsection Examples
  15123. @itemize
  15124. @item
  15125. Interlace video using @ref{select} and @ref{separatefields} filter:
  15126. @example
  15127. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15128. @end example
  15129. @end itemize
  15130. @section xbr
  15131. Apply the xBR high-quality magnification filter which is designed for pixel
  15132. art. It follows a set of edge-detection rules, see
  15133. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15134. It accepts the following option:
  15135. @table @option
  15136. @item n
  15137. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15138. @code{3xBR} and @code{4} for @code{4xBR}.
  15139. Default is @code{3}.
  15140. @end table
  15141. @section xmedian
  15142. Pick median pixels from several input videos.
  15143. The filter accepts the following options:
  15144. @table @option
  15145. @item inputs
  15146. Set number of inputs.
  15147. Default is 3. Allowed range is from 3 to 255.
  15148. If number of inputs is even number, than result will be mean value between two median values.
  15149. @item planes
  15150. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15151. @end table
  15152. @section xstack
  15153. Stack video inputs into custom layout.
  15154. All streams must be of same pixel format.
  15155. The filter accepts the following options:
  15156. @table @option
  15157. @item inputs
  15158. Set number of input streams. Default is 2.
  15159. @item layout
  15160. Specify layout of inputs.
  15161. This option requires the desired layout configuration to be explicitly set by the user.
  15162. This sets position of each video input in output. Each input
  15163. is separated by '|'.
  15164. The first number represents the column, and the second number represents the row.
  15165. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15166. where X is video input from which to take width or height.
  15167. Multiple values can be used when separated by '+'. In such
  15168. case values are summed together.
  15169. Note that if inputs are of different sizes gaps may appear, as not all of
  15170. the output video frame will be filled. Similarly, videos can overlap each
  15171. other if their position doesn't leave enough space for the full frame of
  15172. adjoining videos.
  15173. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15174. a layout must be set by the user.
  15175. @item shortest
  15176. If set to 1, force the output to terminate when the shortest input
  15177. terminates. Default value is 0.
  15178. @end table
  15179. @subsection Examples
  15180. @itemize
  15181. @item
  15182. Display 4 inputs into 2x2 grid.
  15183. Layout:
  15184. @example
  15185. input1(0, 0) | input3(w0, 0)
  15186. input2(0, h0) | input4(w0, h0)
  15187. @end example
  15188. @example
  15189. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15190. @end example
  15191. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15192. @item
  15193. Display 4 inputs into 1x4 grid.
  15194. Layout:
  15195. @example
  15196. input1(0, 0)
  15197. input2(0, h0)
  15198. input3(0, h0+h1)
  15199. input4(0, h0+h1+h2)
  15200. @end example
  15201. @example
  15202. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15203. @end example
  15204. Note that if inputs are of different widths, unused space will appear.
  15205. @item
  15206. Display 9 inputs into 3x3 grid.
  15207. Layout:
  15208. @example
  15209. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15210. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15211. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15212. @end example
  15213. @example
  15214. xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w3_0|w0+w3_h0|w0+w3_h0+h1
  15215. @end example
  15216. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15217. @item
  15218. Display 16 inputs into 4x4 grid.
  15219. Layout:
  15220. @example
  15221. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15222. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15223. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15224. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15225. @end example
  15226. @example
  15227. xstack=inputs=16:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2|w0_0|w0_h0|w0_h0+h1|w0_h0+h1+h2|w0+w4_0|
  15228. w0+w4_h0|w0+w4_h0+h1|w0+w4_h0+h1+h2|w0+w4+w8_0|w0+w4+w8_h0|w0+w4+w8_h0+h1|w0+w4+w8_h0+h1+h2
  15229. @end example
  15230. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15231. @end itemize
  15232. @anchor{yadif}
  15233. @section yadif
  15234. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15235. filter").
  15236. It accepts the following parameters:
  15237. @table @option
  15238. @item mode
  15239. The interlacing mode to adopt. It accepts one of the following values:
  15240. @table @option
  15241. @item 0, send_frame
  15242. Output one frame for each frame.
  15243. @item 1, send_field
  15244. Output one frame for each field.
  15245. @item 2, send_frame_nospatial
  15246. Like @code{send_frame}, but it skips the spatial interlacing check.
  15247. @item 3, send_field_nospatial
  15248. Like @code{send_field}, but it skips the spatial interlacing check.
  15249. @end table
  15250. The default value is @code{send_frame}.
  15251. @item parity
  15252. The picture field parity assumed for the input interlaced video. It accepts one
  15253. of the following values:
  15254. @table @option
  15255. @item 0, tff
  15256. Assume the top field is first.
  15257. @item 1, bff
  15258. Assume the bottom field is first.
  15259. @item -1, auto
  15260. Enable automatic detection of field parity.
  15261. @end table
  15262. The default value is @code{auto}.
  15263. If the interlacing is unknown or the decoder does not export this information,
  15264. top field first will be assumed.
  15265. @item deint
  15266. Specify which frames to deinterlace. Accepts one of the following
  15267. values:
  15268. @table @option
  15269. @item 0, all
  15270. Deinterlace all frames.
  15271. @item 1, interlaced
  15272. Only deinterlace frames marked as interlaced.
  15273. @end table
  15274. The default value is @code{all}.
  15275. @end table
  15276. @section yadif_cuda
  15277. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15278. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15279. and/or nvenc.
  15280. It accepts the following parameters:
  15281. @table @option
  15282. @item mode
  15283. The interlacing mode to adopt. It accepts one of the following values:
  15284. @table @option
  15285. @item 0, send_frame
  15286. Output one frame for each frame.
  15287. @item 1, send_field
  15288. Output one frame for each field.
  15289. @item 2, send_frame_nospatial
  15290. Like @code{send_frame}, but it skips the spatial interlacing check.
  15291. @item 3, send_field_nospatial
  15292. Like @code{send_field}, but it skips the spatial interlacing check.
  15293. @end table
  15294. The default value is @code{send_frame}.
  15295. @item parity
  15296. The picture field parity assumed for the input interlaced video. It accepts one
  15297. of the following values:
  15298. @table @option
  15299. @item 0, tff
  15300. Assume the top field is first.
  15301. @item 1, bff
  15302. Assume the bottom field is first.
  15303. @item -1, auto
  15304. Enable automatic detection of field parity.
  15305. @end table
  15306. The default value is @code{auto}.
  15307. If the interlacing is unknown or the decoder does not export this information,
  15308. top field first will be assumed.
  15309. @item deint
  15310. Specify which frames to deinterlace. Accepts one of the following
  15311. values:
  15312. @table @option
  15313. @item 0, all
  15314. Deinterlace all frames.
  15315. @item 1, interlaced
  15316. Only deinterlace frames marked as interlaced.
  15317. @end table
  15318. The default value is @code{all}.
  15319. @end table
  15320. @section yaepblur
  15321. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15322. The algorithm is described in
  15323. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15324. It accepts the following parameters:
  15325. @table @option
  15326. @item radius, r
  15327. Set the window radius. Default value is 3.
  15328. @item planes, p
  15329. Set which planes to filter. Default is only the first plane.
  15330. @item sigma, s
  15331. Set blur strength. Default value is 128.
  15332. @end table
  15333. @subsection Commands
  15334. This filter supports same @ref{commands} as options.
  15335. @section zoompan
  15336. Apply Zoom & Pan effect.
  15337. This filter accepts the following options:
  15338. @table @option
  15339. @item zoom, z
  15340. Set the zoom expression. Range is 1-10. Default is 1.
  15341. @item x
  15342. @item y
  15343. Set the x and y expression. Default is 0.
  15344. @item d
  15345. Set the duration expression in number of frames.
  15346. This sets for how many number of frames effect will last for
  15347. single input image.
  15348. @item s
  15349. Set the output image size, default is 'hd720'.
  15350. @item fps
  15351. Set the output frame rate, default is '25'.
  15352. @end table
  15353. Each expression can contain the following constants:
  15354. @table @option
  15355. @item in_w, iw
  15356. Input width.
  15357. @item in_h, ih
  15358. Input height.
  15359. @item out_w, ow
  15360. Output width.
  15361. @item out_h, oh
  15362. Output height.
  15363. @item in
  15364. Input frame count.
  15365. @item on
  15366. Output frame count.
  15367. @item x
  15368. @item y
  15369. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15370. for current input frame.
  15371. @item px
  15372. @item py
  15373. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15374. not yet such frame (first input frame).
  15375. @item zoom
  15376. Last calculated zoom from 'z' expression for current input frame.
  15377. @item pzoom
  15378. Last calculated zoom of last output frame of previous input frame.
  15379. @item duration
  15380. Number of output frames for current input frame. Calculated from 'd' expression
  15381. for each input frame.
  15382. @item pduration
  15383. number of output frames created for previous input frame
  15384. @item a
  15385. Rational number: input width / input height
  15386. @item sar
  15387. sample aspect ratio
  15388. @item dar
  15389. display aspect ratio
  15390. @end table
  15391. @subsection Examples
  15392. @itemize
  15393. @item
  15394. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  15395. @example
  15396. 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
  15397. @end example
  15398. @item
  15399. Zoom-in up to 1.5 and pan always at center of picture:
  15400. @example
  15401. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15402. @end example
  15403. @item
  15404. Same as above but without pausing:
  15405. @example
  15406. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15407. @end example
  15408. @end itemize
  15409. @anchor{zscale}
  15410. @section zscale
  15411. Scale (resize) the input video, using the z.lib library:
  15412. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  15413. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  15414. The zscale filter forces the output display aspect ratio to be the same
  15415. as the input, by changing the output sample aspect ratio.
  15416. If the input image format is different from the format requested by
  15417. the next filter, the zscale filter will convert the input to the
  15418. requested format.
  15419. @subsection Options
  15420. The filter accepts the following options.
  15421. @table @option
  15422. @item width, w
  15423. @item height, h
  15424. Set the output video dimension expression. Default value is the input
  15425. dimension.
  15426. If the @var{width} or @var{w} value is 0, the input width is used for
  15427. the output. If the @var{height} or @var{h} value is 0, the input height
  15428. is used for the output.
  15429. If one and only one of the values is -n with n >= 1, the zscale filter
  15430. will use a value that maintains the aspect ratio of the input image,
  15431. calculated from the other specified dimension. After that it will,
  15432. however, make sure that the calculated dimension is divisible by n and
  15433. adjust the value if necessary.
  15434. If both values are -n with n >= 1, the behavior will be identical to
  15435. both values being set to 0 as previously detailed.
  15436. See below for the list of accepted constants for use in the dimension
  15437. expression.
  15438. @item size, s
  15439. Set the video size. For the syntax of this option, check the
  15440. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15441. @item dither, d
  15442. Set the dither type.
  15443. Possible values are:
  15444. @table @var
  15445. @item none
  15446. @item ordered
  15447. @item random
  15448. @item error_diffusion
  15449. @end table
  15450. Default is none.
  15451. @item filter, f
  15452. Set the resize filter type.
  15453. Possible values are:
  15454. @table @var
  15455. @item point
  15456. @item bilinear
  15457. @item bicubic
  15458. @item spline16
  15459. @item spline36
  15460. @item lanczos
  15461. @end table
  15462. Default is bilinear.
  15463. @item range, r
  15464. Set the color range.
  15465. Possible values are:
  15466. @table @var
  15467. @item input
  15468. @item limited
  15469. @item full
  15470. @end table
  15471. Default is same as input.
  15472. @item primaries, p
  15473. Set the color primaries.
  15474. Possible values are:
  15475. @table @var
  15476. @item input
  15477. @item 709
  15478. @item unspecified
  15479. @item 170m
  15480. @item 240m
  15481. @item 2020
  15482. @end table
  15483. Default is same as input.
  15484. @item transfer, t
  15485. Set the transfer characteristics.
  15486. Possible values are:
  15487. @table @var
  15488. @item input
  15489. @item 709
  15490. @item unspecified
  15491. @item 601
  15492. @item linear
  15493. @item 2020_10
  15494. @item 2020_12
  15495. @item smpte2084
  15496. @item iec61966-2-1
  15497. @item arib-std-b67
  15498. @end table
  15499. Default is same as input.
  15500. @item matrix, m
  15501. Set the colorspace matrix.
  15502. Possible value are:
  15503. @table @var
  15504. @item input
  15505. @item 709
  15506. @item unspecified
  15507. @item 470bg
  15508. @item 170m
  15509. @item 2020_ncl
  15510. @item 2020_cl
  15511. @end table
  15512. Default is same as input.
  15513. @item rangein, rin
  15514. Set the input color range.
  15515. Possible values are:
  15516. @table @var
  15517. @item input
  15518. @item limited
  15519. @item full
  15520. @end table
  15521. Default is same as input.
  15522. @item primariesin, pin
  15523. Set the input color primaries.
  15524. Possible values are:
  15525. @table @var
  15526. @item input
  15527. @item 709
  15528. @item unspecified
  15529. @item 170m
  15530. @item 240m
  15531. @item 2020
  15532. @end table
  15533. Default is same as input.
  15534. @item transferin, tin
  15535. Set the input transfer characteristics.
  15536. Possible values are:
  15537. @table @var
  15538. @item input
  15539. @item 709
  15540. @item unspecified
  15541. @item 601
  15542. @item linear
  15543. @item 2020_10
  15544. @item 2020_12
  15545. @end table
  15546. Default is same as input.
  15547. @item matrixin, min
  15548. Set the input colorspace matrix.
  15549. Possible value are:
  15550. @table @var
  15551. @item input
  15552. @item 709
  15553. @item unspecified
  15554. @item 470bg
  15555. @item 170m
  15556. @item 2020_ncl
  15557. @item 2020_cl
  15558. @end table
  15559. @item chromal, c
  15560. Set the output chroma location.
  15561. Possible values are:
  15562. @table @var
  15563. @item input
  15564. @item left
  15565. @item center
  15566. @item topleft
  15567. @item top
  15568. @item bottomleft
  15569. @item bottom
  15570. @end table
  15571. @item chromalin, cin
  15572. Set the input chroma location.
  15573. Possible values are:
  15574. @table @var
  15575. @item input
  15576. @item left
  15577. @item center
  15578. @item topleft
  15579. @item top
  15580. @item bottomleft
  15581. @item bottom
  15582. @end table
  15583. @item npl
  15584. Set the nominal peak luminance.
  15585. @end table
  15586. The values of the @option{w} and @option{h} options are expressions
  15587. containing the following constants:
  15588. @table @var
  15589. @item in_w
  15590. @item in_h
  15591. The input width and height
  15592. @item iw
  15593. @item ih
  15594. These are the same as @var{in_w} and @var{in_h}.
  15595. @item out_w
  15596. @item out_h
  15597. The output (scaled) width and height
  15598. @item ow
  15599. @item oh
  15600. These are the same as @var{out_w} and @var{out_h}
  15601. @item a
  15602. The same as @var{iw} / @var{ih}
  15603. @item sar
  15604. input sample aspect ratio
  15605. @item dar
  15606. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15607. @item hsub
  15608. @item vsub
  15609. horizontal and vertical input chroma subsample values. For example for the
  15610. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15611. @item ohsub
  15612. @item ovsub
  15613. horizontal and vertical output chroma subsample values. For example for the
  15614. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15615. @end table
  15616. @subsection Commands
  15617. This filter supports the following commands:
  15618. @table @option
  15619. @item width, w
  15620. @item height, h
  15621. Set the output video dimension expression.
  15622. The command accepts the same syntax of the corresponding option.
  15623. If the specified expression is not valid, it is kept at its current
  15624. value.
  15625. @end table
  15626. @c man end VIDEO FILTERS
  15627. @chapter OpenCL Video Filters
  15628. @c man begin OPENCL VIDEO FILTERS
  15629. Below is a description of the currently available OpenCL video filters.
  15630. To enable compilation of these filters you need to configure FFmpeg with
  15631. @code{--enable-opencl}.
  15632. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15633. @table @option
  15634. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15635. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15636. given device parameters.
  15637. @item -filter_hw_device @var{name}
  15638. Pass the hardware device called @var{name} to all filters in any filter graph.
  15639. @end table
  15640. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15641. @itemize
  15642. @item
  15643. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15644. @example
  15645. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15646. @end example
  15647. @end itemize
  15648. 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.
  15649. @section avgblur_opencl
  15650. Apply average blur filter.
  15651. The filter accepts the following options:
  15652. @table @option
  15653. @item sizeX
  15654. Set horizontal radius size.
  15655. Range is @code{[1, 1024]} and default value is @code{1}.
  15656. @item planes
  15657. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15658. @item sizeY
  15659. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15660. @end table
  15661. @subsection Example
  15662. @itemize
  15663. @item
  15664. 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.
  15665. @example
  15666. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15667. @end example
  15668. @end itemize
  15669. @section boxblur_opencl
  15670. Apply a boxblur algorithm to the input video.
  15671. It accepts the following parameters:
  15672. @table @option
  15673. @item luma_radius, lr
  15674. @item luma_power, lp
  15675. @item chroma_radius, cr
  15676. @item chroma_power, cp
  15677. @item alpha_radius, ar
  15678. @item alpha_power, ap
  15679. @end table
  15680. A description of the accepted options follows.
  15681. @table @option
  15682. @item luma_radius, lr
  15683. @item chroma_radius, cr
  15684. @item alpha_radius, ar
  15685. Set an expression for the box radius in pixels used for blurring the
  15686. corresponding input plane.
  15687. The radius value must be a non-negative number, and must not be
  15688. greater than the value of the expression @code{min(w,h)/2} for the
  15689. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15690. planes.
  15691. Default value for @option{luma_radius} is "2". If not specified,
  15692. @option{chroma_radius} and @option{alpha_radius} default to the
  15693. corresponding value set for @option{luma_radius}.
  15694. The expressions can contain the following constants:
  15695. @table @option
  15696. @item w
  15697. @item h
  15698. The input width and height in pixels.
  15699. @item cw
  15700. @item ch
  15701. The input chroma image width and height in pixels.
  15702. @item hsub
  15703. @item vsub
  15704. The horizontal and vertical chroma subsample values. For example, for the
  15705. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15706. @end table
  15707. @item luma_power, lp
  15708. @item chroma_power, cp
  15709. @item alpha_power, ap
  15710. Specify how many times the boxblur filter is applied to the
  15711. corresponding plane.
  15712. Default value for @option{luma_power} is 2. If not specified,
  15713. @option{chroma_power} and @option{alpha_power} default to the
  15714. corresponding value set for @option{luma_power}.
  15715. A value of 0 will disable the effect.
  15716. @end table
  15717. @subsection Examples
  15718. 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.
  15719. @itemize
  15720. @item
  15721. Apply a boxblur filter with the luma, chroma, and alpha radius
  15722. 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.
  15723. @example
  15724. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15725. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15726. @end example
  15727. @item
  15728. 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.
  15729. For the luma plane, a 2x2 box radius will be run once.
  15730. For the chroma plane, a 4x4 box radius will be run 5 times.
  15731. For the alpha plane, a 3x3 box radius will be run 7 times.
  15732. @example
  15733. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15734. @end example
  15735. @end itemize
  15736. @section convolution_opencl
  15737. Apply convolution of 3x3, 5x5, 7x7 matrix.
  15738. The filter accepts the following options:
  15739. @table @option
  15740. @item 0m
  15741. @item 1m
  15742. @item 2m
  15743. @item 3m
  15744. Set matrix for each plane.
  15745. Matrix is sequence of 9, 25 or 49 signed numbers.
  15746. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  15747. @item 0rdiv
  15748. @item 1rdiv
  15749. @item 2rdiv
  15750. @item 3rdiv
  15751. Set multiplier for calculated value for each plane.
  15752. If unset or 0, it will be sum of all matrix elements.
  15753. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  15754. @item 0bias
  15755. @item 1bias
  15756. @item 2bias
  15757. @item 3bias
  15758. Set bias for each plane. This value is added to the result of the multiplication.
  15759. Useful for making the overall image brighter or darker.
  15760. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15761. @end table
  15762. @subsection Examples
  15763. @itemize
  15764. @item
  15765. Apply sharpen:
  15766. @example
  15767. -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
  15768. @end example
  15769. @item
  15770. Apply blur:
  15771. @example
  15772. -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
  15773. @end example
  15774. @item
  15775. Apply edge enhance:
  15776. @example
  15777. -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
  15778. @end example
  15779. @item
  15780. Apply edge detect:
  15781. @example
  15782. -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
  15783. @end example
  15784. @item
  15785. Apply laplacian edge detector which includes diagonals:
  15786. @example
  15787. -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
  15788. @end example
  15789. @item
  15790. Apply emboss:
  15791. @example
  15792. -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
  15793. @end example
  15794. @end itemize
  15795. @section dilation_opencl
  15796. Apply dilation effect to the video.
  15797. This filter replaces the pixel by the local(3x3) maximum.
  15798. It accepts the following options:
  15799. @table @option
  15800. @item threshold0
  15801. @item threshold1
  15802. @item threshold2
  15803. @item threshold3
  15804. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15805. If @code{0}, plane will remain unchanged.
  15806. @item coordinates
  15807. Flag which specifies the pixel to refer to.
  15808. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15809. Flags to local 3x3 coordinates region centered on @code{x}:
  15810. 1 2 3
  15811. 4 x 5
  15812. 6 7 8
  15813. @end table
  15814. @subsection Example
  15815. @itemize
  15816. @item
  15817. 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.
  15818. @example
  15819. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15820. @end example
  15821. @end itemize
  15822. @section erosion_opencl
  15823. Apply erosion effect to the video.
  15824. This filter replaces the pixel by the local(3x3) minimum.
  15825. It accepts the following options:
  15826. @table @option
  15827. @item threshold0
  15828. @item threshold1
  15829. @item threshold2
  15830. @item threshold3
  15831. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15832. If @code{0}, plane will remain unchanged.
  15833. @item coordinates
  15834. Flag which specifies the pixel to refer to.
  15835. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15836. Flags to local 3x3 coordinates region centered on @code{x}:
  15837. 1 2 3
  15838. 4 x 5
  15839. 6 7 8
  15840. @end table
  15841. @subsection Example
  15842. @itemize
  15843. @item
  15844. 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.
  15845. @example
  15846. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15847. @end example
  15848. @end itemize
  15849. @section colorkey_opencl
  15850. RGB colorspace color keying.
  15851. The filter accepts the following options:
  15852. @table @option
  15853. @item color
  15854. The color which will be replaced with transparency.
  15855. @item similarity
  15856. Similarity percentage with the key color.
  15857. 0.01 matches only the exact key color, while 1.0 matches everything.
  15858. @item blend
  15859. Blend percentage.
  15860. 0.0 makes pixels either fully transparent, or not transparent at all.
  15861. Higher values result in semi-transparent pixels, with a higher transparency
  15862. the more similar the pixels color is to the key color.
  15863. @end table
  15864. @subsection Examples
  15865. @itemize
  15866. @item
  15867. Make every semi-green pixel in the input transparent with some slight blending:
  15868. @example
  15869. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15870. @end example
  15871. @end itemize
  15872. @section deshake_opencl
  15873. Feature-point based video stabilization filter.
  15874. The filter accepts the following options:
  15875. @table @option
  15876. @item tripod
  15877. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15878. @item debug
  15879. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15880. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15881. Viewing point matches in the output video is only supported for RGB input.
  15882. Defaults to @code{0}.
  15883. @item adaptive_crop
  15884. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15885. Defaults to @code{1}.
  15886. @item refine_features
  15887. Whether or not feature points should be refined at a sub-pixel level.
  15888. This can be turned off for a slight performance gain at the cost of precision.
  15889. Defaults to @code{1}.
  15890. @item smooth_strength
  15891. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15892. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15893. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15894. Defaults to @code{0.0}.
  15895. @item smooth_window_multiplier
  15896. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15897. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15898. Acceptable values range from @code{0.1} to @code{10.0}.
  15899. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15900. potentially improving smoothness, but also increase latency and memory usage.
  15901. Defaults to @code{2.0}.
  15902. @end table
  15903. @subsection Examples
  15904. @itemize
  15905. @item
  15906. Stabilize a video with a fixed, medium smoothing strength:
  15907. @example
  15908. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15909. @end example
  15910. @item
  15911. Stabilize a video with debugging (both in console and in rendered video):
  15912. @example
  15913. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15914. @end example
  15915. @end itemize
  15916. @section nlmeans_opencl
  15917. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15918. @section overlay_opencl
  15919. Overlay one video on top of another.
  15920. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15921. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15922. The filter accepts the following options:
  15923. @table @option
  15924. @item x
  15925. Set the x coordinate of the overlaid video on the main video.
  15926. Default value is @code{0}.
  15927. @item y
  15928. Set the y coordinate of the overlaid video on the main video.
  15929. Default value is @code{0}.
  15930. @end table
  15931. @subsection Examples
  15932. @itemize
  15933. @item
  15934. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15935. @example
  15936. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15937. @end example
  15938. @item
  15939. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15940. @example
  15941. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15942. @end example
  15943. @end itemize
  15944. @section prewitt_opencl
  15945. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15946. The filter accepts the following option:
  15947. @table @option
  15948. @item planes
  15949. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15950. @item scale
  15951. Set value which will be multiplied with filtered result.
  15952. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15953. @item delta
  15954. Set value which will be added to filtered result.
  15955. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15956. @end table
  15957. @subsection Example
  15958. @itemize
  15959. @item
  15960. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15961. @example
  15962. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15963. @end example
  15964. @end itemize
  15965. @section roberts_opencl
  15966. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15967. The filter accepts the following option:
  15968. @table @option
  15969. @item planes
  15970. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15971. @item scale
  15972. Set value which will be multiplied with filtered result.
  15973. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15974. @item delta
  15975. Set value which will be added to filtered result.
  15976. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15977. @end table
  15978. @subsection Example
  15979. @itemize
  15980. @item
  15981. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15982. @example
  15983. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15984. @end example
  15985. @end itemize
  15986. @section sobel_opencl
  15987. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15988. The filter accepts the following option:
  15989. @table @option
  15990. @item planes
  15991. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15992. @item scale
  15993. Set value which will be multiplied with filtered result.
  15994. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15995. @item delta
  15996. Set value which will be added to filtered result.
  15997. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15998. @end table
  15999. @subsection Example
  16000. @itemize
  16001. @item
  16002. Apply sobel operator with scale set to 2 and delta set to 10
  16003. @example
  16004. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16005. @end example
  16006. @end itemize
  16007. @section tonemap_opencl
  16008. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16009. It accepts the following parameters:
  16010. @table @option
  16011. @item tonemap
  16012. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16013. @item param
  16014. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16015. @item desat
  16016. Apply desaturation for highlights that exceed this level of brightness. The
  16017. higher the parameter, the more color information will be preserved. This
  16018. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16019. (smoothly) turning into white instead. This makes images feel more natural,
  16020. at the cost of reducing information about out-of-range colors.
  16021. The default value is 0.5, and the algorithm here is a little different from
  16022. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16023. @item threshold
  16024. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16025. is used to detect whether the scene has changed or not. If the distance between
  16026. the current frame average brightness and the current running average exceeds
  16027. a threshold value, we would re-calculate scene average and peak brightness.
  16028. The default value is 0.2.
  16029. @item format
  16030. Specify the output pixel format.
  16031. Currently supported formats are:
  16032. @table @var
  16033. @item p010
  16034. @item nv12
  16035. @end table
  16036. @item range, r
  16037. Set the output color range.
  16038. Possible values are:
  16039. @table @var
  16040. @item tv/mpeg
  16041. @item pc/jpeg
  16042. @end table
  16043. Default is same as input.
  16044. @item primaries, p
  16045. Set the output color primaries.
  16046. Possible values are:
  16047. @table @var
  16048. @item bt709
  16049. @item bt2020
  16050. @end table
  16051. Default is same as input.
  16052. @item transfer, t
  16053. Set the output transfer characteristics.
  16054. Possible values are:
  16055. @table @var
  16056. @item bt709
  16057. @item bt2020
  16058. @end table
  16059. Default is bt709.
  16060. @item matrix, m
  16061. Set the output colorspace matrix.
  16062. Possible value are:
  16063. @table @var
  16064. @item bt709
  16065. @item bt2020
  16066. @end table
  16067. Default is same as input.
  16068. @end table
  16069. @subsection Example
  16070. @itemize
  16071. @item
  16072. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16073. @example
  16074. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16075. @end example
  16076. @end itemize
  16077. @section unsharp_opencl
  16078. Sharpen or blur the input video.
  16079. It accepts the following parameters:
  16080. @table @option
  16081. @item luma_msize_x, lx
  16082. Set the luma matrix horizontal size.
  16083. Range is @code{[1, 23]} and default value is @code{5}.
  16084. @item luma_msize_y, ly
  16085. Set the luma matrix vertical size.
  16086. Range is @code{[1, 23]} and default value is @code{5}.
  16087. @item luma_amount, la
  16088. Set the luma effect strength.
  16089. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16090. Negative values will blur the input video, while positive values will
  16091. sharpen it, a value of zero will disable the effect.
  16092. @item chroma_msize_x, cx
  16093. Set the chroma matrix horizontal size.
  16094. Range is @code{[1, 23]} and default value is @code{5}.
  16095. @item chroma_msize_y, cy
  16096. Set the chroma matrix vertical size.
  16097. Range is @code{[1, 23]} and default value is @code{5}.
  16098. @item chroma_amount, ca
  16099. Set the chroma effect strength.
  16100. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16101. Negative values will blur the input video, while positive values will
  16102. sharpen it, a value of zero will disable the effect.
  16103. @end table
  16104. All parameters are optional and default to the equivalent of the
  16105. string '5:5:1.0:5:5:0.0'.
  16106. @subsection Examples
  16107. @itemize
  16108. @item
  16109. Apply strong luma sharpen effect:
  16110. @example
  16111. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16112. @end example
  16113. @item
  16114. Apply a strong blur of both luma and chroma parameters:
  16115. @example
  16116. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16117. @end example
  16118. @end itemize
  16119. @c man end OPENCL VIDEO FILTERS
  16120. @chapter VAAPI Video Filters
  16121. @c man begin VAAPI VIDEO FILTERS
  16122. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  16123. To enable compilation of these filters you need to configure FFmpeg with
  16124. @code{--enable-vaapi}.
  16125. To use vaapi filters, you need to setup the vaapi device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
  16126. @section tonemap_vappi
  16127. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  16128. It maps the dynamic range of HDR10 content to the SDR content.
  16129. It currently only accepts HDR10 as input.
  16130. It accepts the following parameters:
  16131. @table @option
  16132. @item format
  16133. Specify the output pixel format.
  16134. Currently supported formats are:
  16135. @table @var
  16136. @item p010
  16137. @item nv12
  16138. @end table
  16139. Default is nv12.
  16140. @item primaries, p
  16141. Set the output color primaries.
  16142. Default is same as input.
  16143. @item transfer, t
  16144. Set the output transfer characteristics.
  16145. Default is bt709.
  16146. @item matrix, m
  16147. Set the output colorspace matrix.
  16148. Default is same as input.
  16149. @end table
  16150. @subsection Example
  16151. @itemize
  16152. @item
  16153. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  16154. @example
  16155. tonemap_vaapi=format=p010:t=bt2020-10
  16156. @end example
  16157. @end itemize
  16158. @c man end VAAPI VIDEO FILTERS
  16159. @chapter Video Sources
  16160. @c man begin VIDEO SOURCES
  16161. Below is a description of the currently available video sources.
  16162. @section buffer
  16163. Buffer video frames, and make them available to the filter chain.
  16164. This source is mainly intended for a programmatic use, in particular
  16165. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  16166. It accepts the following parameters:
  16167. @table @option
  16168. @item video_size
  16169. Specify the size (width and height) of the buffered video frames. For the
  16170. syntax of this option, check the
  16171. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16172. @item width
  16173. The input video width.
  16174. @item height
  16175. The input video height.
  16176. @item pix_fmt
  16177. A string representing the pixel format of the buffered video frames.
  16178. It may be a number corresponding to a pixel format, or a pixel format
  16179. name.
  16180. @item time_base
  16181. Specify the timebase assumed by the timestamps of the buffered frames.
  16182. @item frame_rate
  16183. Specify the frame rate expected for the video stream.
  16184. @item pixel_aspect, sar
  16185. The sample (pixel) aspect ratio of the input video.
  16186. @item sws_param
  16187. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  16188. to the filtergraph description to specify swscale flags for automatically
  16189. inserted scalers. See @ref{Filtergraph syntax}.
  16190. @item hw_frames_ctx
  16191. When using a hardware pixel format, this should be a reference to an
  16192. AVHWFramesContext describing input frames.
  16193. @end table
  16194. For example:
  16195. @example
  16196. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  16197. @end example
  16198. will instruct the source to accept video frames with size 320x240 and
  16199. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  16200. square pixels (1:1 sample aspect ratio).
  16201. Since the pixel format with name "yuv410p" corresponds to the number 6
  16202. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  16203. this example corresponds to:
  16204. @example
  16205. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  16206. @end example
  16207. Alternatively, the options can be specified as a flat string, but this
  16208. syntax is deprecated:
  16209. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  16210. @section cellauto
  16211. Create a pattern generated by an elementary cellular automaton.
  16212. The initial state of the cellular automaton can be defined through the
  16213. @option{filename} and @option{pattern} options. If such options are
  16214. not specified an initial state is created randomly.
  16215. At each new frame a new row in the video is filled with the result of
  16216. the cellular automaton next generation. The behavior when the whole
  16217. frame is filled is defined by the @option{scroll} option.
  16218. This source accepts the following options:
  16219. @table @option
  16220. @item filename, f
  16221. Read the initial cellular automaton state, i.e. the starting row, from
  16222. the specified file.
  16223. In the file, each non-whitespace character is considered an alive
  16224. cell, a newline will terminate the row, and further characters in the
  16225. file will be ignored.
  16226. @item pattern, p
  16227. Read the initial cellular automaton state, i.e. the starting row, from
  16228. the specified string.
  16229. Each non-whitespace character in the string is considered an alive
  16230. cell, a newline will terminate the row, and further characters in the
  16231. string will be ignored.
  16232. @item rate, r
  16233. Set the video rate, that is the number of frames generated per second.
  16234. Default is 25.
  16235. @item random_fill_ratio, ratio
  16236. Set the random fill ratio for the initial cellular automaton row. It
  16237. is a floating point number value ranging from 0 to 1, defaults to
  16238. 1/PHI.
  16239. This option is ignored when a file or a pattern is specified.
  16240. @item random_seed, seed
  16241. Set the seed for filling randomly the initial row, must be an integer
  16242. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16243. set to -1, the filter will try to use a good random seed on a best
  16244. effort basis.
  16245. @item rule
  16246. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  16247. Default value is 110.
  16248. @item size, s
  16249. Set the size of the output video. For the syntax of this option, check the
  16250. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16251. If @option{filename} or @option{pattern} is specified, the size is set
  16252. by default to the width of the specified initial state row, and the
  16253. height is set to @var{width} * PHI.
  16254. If @option{size} is set, it must contain the width of the specified
  16255. pattern string, and the specified pattern will be centered in the
  16256. larger row.
  16257. If a filename or a pattern string is not specified, the size value
  16258. defaults to "320x518" (used for a randomly generated initial state).
  16259. @item scroll
  16260. If set to 1, scroll the output upward when all the rows in the output
  16261. have been already filled. If set to 0, the new generated row will be
  16262. written over the top row just after the bottom row is filled.
  16263. Defaults to 1.
  16264. @item start_full, full
  16265. If set to 1, completely fill the output with generated rows before
  16266. outputting the first frame.
  16267. This is the default behavior, for disabling set the value to 0.
  16268. @item stitch
  16269. If set to 1, stitch the left and right row edges together.
  16270. This is the default behavior, for disabling set the value to 0.
  16271. @end table
  16272. @subsection Examples
  16273. @itemize
  16274. @item
  16275. Read the initial state from @file{pattern}, and specify an output of
  16276. size 200x400.
  16277. @example
  16278. cellauto=f=pattern:s=200x400
  16279. @end example
  16280. @item
  16281. Generate a random initial row with a width of 200 cells, with a fill
  16282. ratio of 2/3:
  16283. @example
  16284. cellauto=ratio=2/3:s=200x200
  16285. @end example
  16286. @item
  16287. Create a pattern generated by rule 18 starting by a single alive cell
  16288. centered on an initial row with width 100:
  16289. @example
  16290. cellauto=p=@@:s=100x400:full=0:rule=18
  16291. @end example
  16292. @item
  16293. Specify a more elaborated initial pattern:
  16294. @example
  16295. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  16296. @end example
  16297. @end itemize
  16298. @anchor{coreimagesrc}
  16299. @section coreimagesrc
  16300. Video source generated on GPU using Apple's CoreImage API on OSX.
  16301. This video source is a specialized version of the @ref{coreimage} video filter.
  16302. Use a core image generator at the beginning of the applied filterchain to
  16303. generate the content.
  16304. The coreimagesrc video source accepts the following options:
  16305. @table @option
  16306. @item list_generators
  16307. List all available generators along with all their respective options as well as
  16308. possible minimum and maximum values along with the default values.
  16309. @example
  16310. list_generators=true
  16311. @end example
  16312. @item size, s
  16313. Specify the size of the sourced video. For the syntax of this option, check the
  16314. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16315. The default value is @code{320x240}.
  16316. @item rate, r
  16317. Specify the frame rate of the sourced video, as the number of frames
  16318. generated per second. It has to be a string in the format
  16319. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16320. number or a valid video frame rate abbreviation. The default value is
  16321. "25".
  16322. @item sar
  16323. Set the sample aspect ratio of the sourced video.
  16324. @item duration, d
  16325. Set the duration of the sourced video. See
  16326. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16327. for the accepted syntax.
  16328. If not specified, or the expressed duration is negative, the video is
  16329. supposed to be generated forever.
  16330. @end table
  16331. Additionally, all options of the @ref{coreimage} video filter are accepted.
  16332. A complete filterchain can be used for further processing of the
  16333. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  16334. and examples for details.
  16335. @subsection Examples
  16336. @itemize
  16337. @item
  16338. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  16339. given as complete and escaped command-line for Apple's standard bash shell:
  16340. @example
  16341. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  16342. @end example
  16343. This example is equivalent to the QRCode example of @ref{coreimage} without the
  16344. need for a nullsrc video source.
  16345. @end itemize
  16346. @section mandelbrot
  16347. Generate a Mandelbrot set fractal, and progressively zoom towards the
  16348. point specified with @var{start_x} and @var{start_y}.
  16349. This source accepts the following options:
  16350. @table @option
  16351. @item end_pts
  16352. Set the terminal pts value. Default value is 400.
  16353. @item end_scale
  16354. Set the terminal scale value.
  16355. Must be a floating point value. Default value is 0.3.
  16356. @item inner
  16357. Set the inner coloring mode, that is the algorithm used to draw the
  16358. Mandelbrot fractal internal region.
  16359. It shall assume one of the following values:
  16360. @table @option
  16361. @item black
  16362. Set black mode.
  16363. @item convergence
  16364. Show time until convergence.
  16365. @item mincol
  16366. Set color based on point closest to the origin of the iterations.
  16367. @item period
  16368. Set period mode.
  16369. @end table
  16370. Default value is @var{mincol}.
  16371. @item bailout
  16372. Set the bailout value. Default value is 10.0.
  16373. @item maxiter
  16374. Set the maximum of iterations performed by the rendering
  16375. algorithm. Default value is 7189.
  16376. @item outer
  16377. Set outer coloring mode.
  16378. It shall assume one of following values:
  16379. @table @option
  16380. @item iteration_count
  16381. Set iteration count mode.
  16382. @item normalized_iteration_count
  16383. set normalized iteration count mode.
  16384. @end table
  16385. Default value is @var{normalized_iteration_count}.
  16386. @item rate, r
  16387. Set frame rate, expressed as number of frames per second. Default
  16388. value is "25".
  16389. @item size, s
  16390. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16391. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16392. @item start_scale
  16393. Set the initial scale value. Default value is 3.0.
  16394. @item start_x
  16395. Set the initial x position. Must be a floating point value between
  16396. -100 and 100. Default value is -0.743643887037158704752191506114774.
  16397. @item start_y
  16398. Set the initial y position. Must be a floating point value between
  16399. -100 and 100. Default value is -0.131825904205311970493132056385139.
  16400. @end table
  16401. @section mptestsrc
  16402. Generate various test patterns, as generated by the MPlayer test filter.
  16403. The size of the generated video is fixed, and is 256x256.
  16404. This source is useful in particular for testing encoding features.
  16405. This source accepts the following options:
  16406. @table @option
  16407. @item rate, r
  16408. Specify the frame rate of the sourced video, as the number of frames
  16409. generated per second. It has to be a string in the format
  16410. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16411. number or a valid video frame rate abbreviation. The default value is
  16412. "25".
  16413. @item duration, d
  16414. Set the duration of the sourced video. See
  16415. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16416. for the accepted syntax.
  16417. If not specified, or the expressed duration is negative, the video is
  16418. supposed to be generated forever.
  16419. @item test, t
  16420. Set the number or the name of the test to perform. Supported tests are:
  16421. @table @option
  16422. @item dc_luma
  16423. @item dc_chroma
  16424. @item freq_luma
  16425. @item freq_chroma
  16426. @item amp_luma
  16427. @item amp_chroma
  16428. @item cbp
  16429. @item mv
  16430. @item ring1
  16431. @item ring2
  16432. @item all
  16433. @item max_frames, m
  16434. Set the maximum number of frames generated for each test, default value is 30.
  16435. @end table
  16436. Default value is "all", which will cycle through the list of all tests.
  16437. @end table
  16438. Some examples:
  16439. @example
  16440. mptestsrc=t=dc_luma
  16441. @end example
  16442. will generate a "dc_luma" test pattern.
  16443. @section frei0r_src
  16444. Provide a frei0r source.
  16445. To enable compilation of this filter you need to install the frei0r
  16446. header and configure FFmpeg with @code{--enable-frei0r}.
  16447. This source accepts the following parameters:
  16448. @table @option
  16449. @item size
  16450. The size of the video to generate. For the syntax of this option, check the
  16451. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16452. @item framerate
  16453. The framerate of the generated video. It may be a string of the form
  16454. @var{num}/@var{den} or a frame rate abbreviation.
  16455. @item filter_name
  16456. The name to the frei0r source to load. For more information regarding frei0r and
  16457. how to set the parameters, read the @ref{frei0r} section in the video filters
  16458. documentation.
  16459. @item filter_params
  16460. A '|'-separated list of parameters to pass to the frei0r source.
  16461. @end table
  16462. For example, to generate a frei0r partik0l source with size 200x200
  16463. and frame rate 10 which is overlaid on the overlay filter main input:
  16464. @example
  16465. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  16466. @end example
  16467. @section life
  16468. Generate a life pattern.
  16469. This source is based on a generalization of John Conway's life game.
  16470. The sourced input represents a life grid, each pixel represents a cell
  16471. which can be in one of two possible states, alive or dead. Every cell
  16472. interacts with its eight neighbours, which are the cells that are
  16473. horizontally, vertically, or diagonally adjacent.
  16474. At each interaction the grid evolves according to the adopted rule,
  16475. which specifies the number of neighbor alive cells which will make a
  16476. cell stay alive or born. The @option{rule} option allows one to specify
  16477. the rule to adopt.
  16478. This source accepts the following options:
  16479. @table @option
  16480. @item filename, f
  16481. Set the file from which to read the initial grid state. In the file,
  16482. each non-whitespace character is considered an alive cell, and newline
  16483. is used to delimit the end of each row.
  16484. If this option is not specified, the initial grid is generated
  16485. randomly.
  16486. @item rate, r
  16487. Set the video rate, that is the number of frames generated per second.
  16488. Default is 25.
  16489. @item random_fill_ratio, ratio
  16490. Set the random fill ratio for the initial random grid. It is a
  16491. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  16492. It is ignored when a file is specified.
  16493. @item random_seed, seed
  16494. Set the seed for filling the initial random grid, must be an integer
  16495. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16496. set to -1, the filter will try to use a good random seed on a best
  16497. effort basis.
  16498. @item rule
  16499. Set the life rule.
  16500. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  16501. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  16502. @var{NS} specifies the number of alive neighbor cells which make a
  16503. live cell stay alive, and @var{NB} the number of alive neighbor cells
  16504. which make a dead cell to become alive (i.e. to "born").
  16505. "s" and "b" can be used in place of "S" and "B", respectively.
  16506. Alternatively a rule can be specified by an 18-bits integer. The 9
  16507. high order bits are used to encode the next cell state if it is alive
  16508. for each number of neighbor alive cells, the low order bits specify
  16509. the rule for "borning" new cells. Higher order bits encode for an
  16510. higher number of neighbor cells.
  16511. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  16512. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  16513. Default value is "S23/B3", which is the original Conway's game of life
  16514. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  16515. cells, and will born a new cell if there are three alive cells around
  16516. a dead cell.
  16517. @item size, s
  16518. Set the size of the output video. For the syntax of this option, check the
  16519. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16520. If @option{filename} is specified, the size is set by default to the
  16521. same size of the input file. If @option{size} is set, it must contain
  16522. the size specified in the input file, and the initial grid defined in
  16523. that file is centered in the larger resulting area.
  16524. If a filename is not specified, the size value defaults to "320x240"
  16525. (used for a randomly generated initial grid).
  16526. @item stitch
  16527. If set to 1, stitch the left and right grid edges together, and the
  16528. top and bottom edges also. Defaults to 1.
  16529. @item mold
  16530. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  16531. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  16532. value from 0 to 255.
  16533. @item life_color
  16534. Set the color of living (or new born) cells.
  16535. @item death_color
  16536. Set the color of dead cells. If @option{mold} is set, this is the first color
  16537. used to represent a dead cell.
  16538. @item mold_color
  16539. Set mold color, for definitely dead and moldy cells.
  16540. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  16541. ffmpeg-utils manual,ffmpeg-utils}.
  16542. @end table
  16543. @subsection Examples
  16544. @itemize
  16545. @item
  16546. Read a grid from @file{pattern}, and center it on a grid of size
  16547. 300x300 pixels:
  16548. @example
  16549. life=f=pattern:s=300x300
  16550. @end example
  16551. @item
  16552. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  16553. @example
  16554. life=ratio=2/3:s=200x200
  16555. @end example
  16556. @item
  16557. Specify a custom rule for evolving a randomly generated grid:
  16558. @example
  16559. life=rule=S14/B34
  16560. @end example
  16561. @item
  16562. Full example with slow death effect (mold) using @command{ffplay}:
  16563. @example
  16564. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  16565. @end example
  16566. @end itemize
  16567. @anchor{allrgb}
  16568. @anchor{allyuv}
  16569. @anchor{color}
  16570. @anchor{haldclutsrc}
  16571. @anchor{nullsrc}
  16572. @anchor{pal75bars}
  16573. @anchor{pal100bars}
  16574. @anchor{rgbtestsrc}
  16575. @anchor{smptebars}
  16576. @anchor{smptehdbars}
  16577. @anchor{testsrc}
  16578. @anchor{testsrc2}
  16579. @anchor{yuvtestsrc}
  16580. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  16581. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  16582. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  16583. The @code{color} source provides an uniformly colored input.
  16584. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  16585. @ref{haldclut} filter.
  16586. The @code{nullsrc} source returns unprocessed video frames. It is
  16587. mainly useful to be employed in analysis / debugging tools, or as the
  16588. source for filters which ignore the input data.
  16589. The @code{pal75bars} source generates a color bars pattern, based on
  16590. EBU PAL recommendations with 75% color levels.
  16591. The @code{pal100bars} source generates a color bars pattern, based on
  16592. EBU PAL recommendations with 100% color levels.
  16593. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  16594. detecting RGB vs BGR issues. You should see a red, green and blue
  16595. stripe from top to bottom.
  16596. The @code{smptebars} source generates a color bars pattern, based on
  16597. the SMPTE Engineering Guideline EG 1-1990.
  16598. The @code{smptehdbars} source generates a color bars pattern, based on
  16599. the SMPTE RP 219-2002.
  16600. The @code{testsrc} source generates a test video pattern, showing a
  16601. color pattern, a scrolling gradient and a timestamp. This is mainly
  16602. intended for testing purposes.
  16603. The @code{testsrc2} source is similar to testsrc, but supports more
  16604. pixel formats instead of just @code{rgb24}. This allows using it as an
  16605. input for other tests without requiring a format conversion.
  16606. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  16607. see a y, cb and cr stripe from top to bottom.
  16608. The sources accept the following parameters:
  16609. @table @option
  16610. @item level
  16611. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  16612. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  16613. pixels to be used as identity matrix for 3D lookup tables. Each component is
  16614. coded on a @code{1/(N*N)} scale.
  16615. @item color, c
  16616. Specify the color of the source, only available in the @code{color}
  16617. source. For the syntax of this option, check the
  16618. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16619. @item size, s
  16620. Specify the size of the sourced video. For the syntax of this option, check the
  16621. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16622. The default value is @code{320x240}.
  16623. This option is not available with the @code{allrgb}, @code{allyuv}, and
  16624. @code{haldclutsrc} filters.
  16625. @item rate, r
  16626. Specify the frame rate of the sourced video, as the number of frames
  16627. generated per second. It has to be a string in the format
  16628. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16629. number or a valid video frame rate abbreviation. The default value is
  16630. "25".
  16631. @item duration, d
  16632. Set the duration of the sourced video. See
  16633. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16634. for the accepted syntax.
  16635. If not specified, or the expressed duration is negative, the video is
  16636. supposed to be generated forever.
  16637. @item sar
  16638. Set the sample aspect ratio of the sourced video.
  16639. @item alpha
  16640. Specify the alpha (opacity) of the background, only available in the
  16641. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  16642. 255 (fully opaque, the default).
  16643. @item decimals, n
  16644. Set the number of decimals to show in the timestamp, only available in the
  16645. @code{testsrc} source.
  16646. The displayed timestamp value will correspond to the original
  16647. timestamp value multiplied by the power of 10 of the specified
  16648. value. Default value is 0.
  16649. @end table
  16650. @subsection Examples
  16651. @itemize
  16652. @item
  16653. Generate a video with a duration of 5.3 seconds, with size
  16654. 176x144 and a frame rate of 10 frames per second:
  16655. @example
  16656. testsrc=duration=5.3:size=qcif:rate=10
  16657. @end example
  16658. @item
  16659. The following graph description will generate a red source
  16660. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  16661. frames per second:
  16662. @example
  16663. color=c=red@@0.2:s=qcif:r=10
  16664. @end example
  16665. @item
  16666. If the input content is to be ignored, @code{nullsrc} can be used. The
  16667. following command generates noise in the luminance plane by employing
  16668. the @code{geq} filter:
  16669. @example
  16670. nullsrc=s=256x256, geq=random(1)*255:128:128
  16671. @end example
  16672. @end itemize
  16673. @subsection Commands
  16674. The @code{color} source supports the following commands:
  16675. @table @option
  16676. @item c, color
  16677. Set the color of the created image. Accepts the same syntax of the
  16678. corresponding @option{color} option.
  16679. @end table
  16680. @section openclsrc
  16681. Generate video using an OpenCL program.
  16682. @table @option
  16683. @item source
  16684. OpenCL program source file.
  16685. @item kernel
  16686. Kernel name in program.
  16687. @item size, s
  16688. Size of frames to generate. This must be set.
  16689. @item format
  16690. Pixel format to use for the generated frames. This must be set.
  16691. @item rate, r
  16692. Number of frames generated every second. Default value is '25'.
  16693. @end table
  16694. For details of how the program loading works, see the @ref{program_opencl}
  16695. filter.
  16696. Example programs:
  16697. @itemize
  16698. @item
  16699. Generate a colour ramp by setting pixel values from the position of the pixel
  16700. in the output image. (Note that this will work with all pixel formats, but
  16701. the generated output will not be the same.)
  16702. @verbatim
  16703. __kernel void ramp(__write_only image2d_t dst,
  16704. unsigned int index)
  16705. {
  16706. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16707. float4 val;
  16708. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  16709. write_imagef(dst, loc, val);
  16710. }
  16711. @end verbatim
  16712. @item
  16713. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  16714. @verbatim
  16715. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  16716. unsigned int index)
  16717. {
  16718. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16719. float4 value = 0.0f;
  16720. int x = loc.x + index;
  16721. int y = loc.y + index;
  16722. while (x > 0 || y > 0) {
  16723. if (x % 3 == 1 && y % 3 == 1) {
  16724. value = 1.0f;
  16725. break;
  16726. }
  16727. x /= 3;
  16728. y /= 3;
  16729. }
  16730. write_imagef(dst, loc, value);
  16731. }
  16732. @end verbatim
  16733. @end itemize
  16734. @section sierpinski
  16735. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  16736. This source accepts the following options:
  16737. @table @option
  16738. @item size, s
  16739. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16740. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16741. @item rate, r
  16742. Set frame rate, expressed as number of frames per second. Default
  16743. value is "25".
  16744. @item seed
  16745. Set seed which is used for random panning.
  16746. @item jump
  16747. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  16748. @item type
  16749. Set fractal type, can be default @code{carpet} or @code{triangle}.
  16750. @end table
  16751. @c man end VIDEO SOURCES
  16752. @chapter Video Sinks
  16753. @c man begin VIDEO SINKS
  16754. Below is a description of the currently available video sinks.
  16755. @section buffersink
  16756. Buffer video frames, and make them available to the end of the filter
  16757. graph.
  16758. This sink is mainly intended for programmatic use, in particular
  16759. through the interface defined in @file{libavfilter/buffersink.h}
  16760. or the options system.
  16761. It accepts a pointer to an AVBufferSinkContext structure, which
  16762. defines the incoming buffers' formats, to be passed as the opaque
  16763. parameter to @code{avfilter_init_filter} for initialization.
  16764. @section nullsink
  16765. Null video sink: do absolutely nothing with the input video. It is
  16766. mainly useful as a template and for use in analysis / debugging
  16767. tools.
  16768. @c man end VIDEO SINKS
  16769. @chapter Multimedia Filters
  16770. @c man begin MULTIMEDIA FILTERS
  16771. Below is a description of the currently available multimedia filters.
  16772. @section abitscope
  16773. Convert input audio to a video output, displaying the audio bit scope.
  16774. The filter accepts the following options:
  16775. @table @option
  16776. @item rate, r
  16777. Set frame rate, expressed as number of frames per second. Default
  16778. value is "25".
  16779. @item size, s
  16780. Specify the video size for the output. For the syntax of this option, check the
  16781. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16782. Default value is @code{1024x256}.
  16783. @item colors
  16784. Specify list of colors separated by space or by '|' which will be used to
  16785. draw channels. Unrecognized or missing colors will be replaced
  16786. by white color.
  16787. @end table
  16788. @section adrawgraph
  16789. Draw a graph using input audio metadata.
  16790. See @ref{drawgraph}
  16791. @section agraphmonitor
  16792. See @ref{graphmonitor}.
  16793. @section ahistogram
  16794. Convert input audio to a video output, displaying the volume histogram.
  16795. The filter accepts the following options:
  16796. @table @option
  16797. @item dmode
  16798. Specify how histogram is calculated.
  16799. It accepts the following values:
  16800. @table @samp
  16801. @item single
  16802. Use single histogram for all channels.
  16803. @item separate
  16804. Use separate histogram for each channel.
  16805. @end table
  16806. Default is @code{single}.
  16807. @item rate, r
  16808. Set frame rate, expressed as number of frames per second. Default
  16809. value is "25".
  16810. @item size, s
  16811. Specify the video size for the output. For the syntax of this option, check the
  16812. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16813. Default value is @code{hd720}.
  16814. @item scale
  16815. Set display scale.
  16816. It accepts the following values:
  16817. @table @samp
  16818. @item log
  16819. logarithmic
  16820. @item sqrt
  16821. square root
  16822. @item cbrt
  16823. cubic root
  16824. @item lin
  16825. linear
  16826. @item rlog
  16827. reverse logarithmic
  16828. @end table
  16829. Default is @code{log}.
  16830. @item ascale
  16831. Set amplitude scale.
  16832. It accepts the following values:
  16833. @table @samp
  16834. @item log
  16835. logarithmic
  16836. @item lin
  16837. linear
  16838. @end table
  16839. Default is @code{log}.
  16840. @item acount
  16841. Set how much frames to accumulate in histogram.
  16842. Default is 1. Setting this to -1 accumulates all frames.
  16843. @item rheight
  16844. Set histogram ratio of window height.
  16845. @item slide
  16846. Set sonogram sliding.
  16847. It accepts the following values:
  16848. @table @samp
  16849. @item replace
  16850. replace old rows with new ones.
  16851. @item scroll
  16852. scroll from top to bottom.
  16853. @end table
  16854. Default is @code{replace}.
  16855. @end table
  16856. @section aphasemeter
  16857. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16858. representing mean phase of current audio frame. A video output can also be produced and is
  16859. enabled by default. The audio is passed through as first output.
  16860. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16861. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16862. and @code{1} means channels are in phase.
  16863. The filter accepts the following options, all related to its video output:
  16864. @table @option
  16865. @item rate, r
  16866. Set the output frame rate. Default value is @code{25}.
  16867. @item size, s
  16868. Set the video size for the output. For the syntax of this option, check the
  16869. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16870. Default value is @code{800x400}.
  16871. @item rc
  16872. @item gc
  16873. @item bc
  16874. Specify the red, green, blue contrast. Default values are @code{2},
  16875. @code{7} and @code{1}.
  16876. Allowed range is @code{[0, 255]}.
  16877. @item mpc
  16878. Set color which will be used for drawing median phase. If color is
  16879. @code{none} which is default, no median phase value will be drawn.
  16880. @item video
  16881. Enable video output. Default is enabled.
  16882. @end table
  16883. @section avectorscope
  16884. Convert input audio to a video output, representing the audio vector
  16885. scope.
  16886. The filter is used to measure the difference between channels of stereo
  16887. audio stream. A monaural signal, consisting of identical left and right
  16888. signal, results in straight vertical line. Any stereo separation is visible
  16889. as a deviation from this line, creating a Lissajous figure.
  16890. If the straight (or deviation from it) but horizontal line appears this
  16891. indicates that the left and right channels are out of phase.
  16892. The filter accepts the following options:
  16893. @table @option
  16894. @item mode, m
  16895. Set the vectorscope mode.
  16896. Available values are:
  16897. @table @samp
  16898. @item lissajous
  16899. Lissajous rotated by 45 degrees.
  16900. @item lissajous_xy
  16901. Same as above but not rotated.
  16902. @item polar
  16903. Shape resembling half of circle.
  16904. @end table
  16905. Default value is @samp{lissajous}.
  16906. @item size, s
  16907. Set the video size for the output. For the syntax of this option, check the
  16908. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16909. Default value is @code{400x400}.
  16910. @item rate, r
  16911. Set the output frame rate. Default value is @code{25}.
  16912. @item rc
  16913. @item gc
  16914. @item bc
  16915. @item ac
  16916. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16917. @code{160}, @code{80} and @code{255}.
  16918. Allowed range is @code{[0, 255]}.
  16919. @item rf
  16920. @item gf
  16921. @item bf
  16922. @item af
  16923. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16924. @code{10}, @code{5} and @code{5}.
  16925. Allowed range is @code{[0, 255]}.
  16926. @item zoom
  16927. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16928. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16929. @item draw
  16930. Set the vectorscope drawing mode.
  16931. Available values are:
  16932. @table @samp
  16933. @item dot
  16934. Draw dot for each sample.
  16935. @item line
  16936. Draw line between previous and current sample.
  16937. @end table
  16938. Default value is @samp{dot}.
  16939. @item scale
  16940. Specify amplitude scale of audio samples.
  16941. Available values are:
  16942. @table @samp
  16943. @item lin
  16944. Linear.
  16945. @item sqrt
  16946. Square root.
  16947. @item cbrt
  16948. Cubic root.
  16949. @item log
  16950. Logarithmic.
  16951. @end table
  16952. @item swap
  16953. Swap left channel axis with right channel axis.
  16954. @item mirror
  16955. Mirror axis.
  16956. @table @samp
  16957. @item none
  16958. No mirror.
  16959. @item x
  16960. Mirror only x axis.
  16961. @item y
  16962. Mirror only y axis.
  16963. @item xy
  16964. Mirror both axis.
  16965. @end table
  16966. @end table
  16967. @subsection Examples
  16968. @itemize
  16969. @item
  16970. Complete example using @command{ffplay}:
  16971. @example
  16972. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16973. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16974. @end example
  16975. @end itemize
  16976. @section bench, abench
  16977. Benchmark part of a filtergraph.
  16978. The filter accepts the following options:
  16979. @table @option
  16980. @item action
  16981. Start or stop a timer.
  16982. Available values are:
  16983. @table @samp
  16984. @item start
  16985. Get the current time, set it as frame metadata (using the key
  16986. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16987. @item stop
  16988. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16989. the input frame metadata to get the time difference. Time difference, average,
  16990. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16991. @code{min}) are then printed. The timestamps are expressed in seconds.
  16992. @end table
  16993. @end table
  16994. @subsection Examples
  16995. @itemize
  16996. @item
  16997. Benchmark @ref{selectivecolor} filter:
  16998. @example
  16999. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17000. @end example
  17001. @end itemize
  17002. @section concat
  17003. Concatenate audio and video streams, joining them together one after the
  17004. other.
  17005. The filter works on segments of synchronized video and audio streams. All
  17006. segments must have the same number of streams of each type, and that will
  17007. also be the number of streams at output.
  17008. The filter accepts the following options:
  17009. @table @option
  17010. @item n
  17011. Set the number of segments. Default is 2.
  17012. @item v
  17013. Set the number of output video streams, that is also the number of video
  17014. streams in each segment. Default is 1.
  17015. @item a
  17016. Set the number of output audio streams, that is also the number of audio
  17017. streams in each segment. Default is 0.
  17018. @item unsafe
  17019. Activate unsafe mode: do not fail if segments have a different format.
  17020. @end table
  17021. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  17022. @var{a} audio outputs.
  17023. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  17024. segment, in the same order as the outputs, then the inputs for the second
  17025. segment, etc.
  17026. Related streams do not always have exactly the same duration, for various
  17027. reasons including codec frame size or sloppy authoring. For that reason,
  17028. related synchronized streams (e.g. a video and its audio track) should be
  17029. concatenated at once. The concat filter will use the duration of the longest
  17030. stream in each segment (except the last one), and if necessary pad shorter
  17031. audio streams with silence.
  17032. For this filter to work correctly, all segments must start at timestamp 0.
  17033. All corresponding streams must have the same parameters in all segments; the
  17034. filtering system will automatically select a common pixel format for video
  17035. streams, and a common sample format, sample rate and channel layout for
  17036. audio streams, but other settings, such as resolution, must be converted
  17037. explicitly by the user.
  17038. Different frame rates are acceptable but will result in variable frame rate
  17039. at output; be sure to configure the output file to handle it.
  17040. @subsection Examples
  17041. @itemize
  17042. @item
  17043. Concatenate an opening, an episode and an ending, all in bilingual version
  17044. (video in stream 0, audio in streams 1 and 2):
  17045. @example
  17046. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  17047. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  17048. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  17049. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  17050. @end example
  17051. @item
  17052. Concatenate two parts, handling audio and video separately, using the
  17053. (a)movie sources, and adjusting the resolution:
  17054. @example
  17055. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  17056. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  17057. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  17058. @end example
  17059. Note that a desync will happen at the stitch if the audio and video streams
  17060. do not have exactly the same duration in the first file.
  17061. @end itemize
  17062. @subsection Commands
  17063. This filter supports the following commands:
  17064. @table @option
  17065. @item next
  17066. Close the current segment and step to the next one
  17067. @end table
  17068. @anchor{ebur128}
  17069. @section ebur128
  17070. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  17071. level. By default, it logs a message at a frequency of 10Hz with the
  17072. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  17073. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  17074. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  17075. sample format is double-precision floating point. The input stream will be converted to
  17076. this specification, if needed. Users may need to insert aformat and/or aresample filters
  17077. after this filter to obtain the original parameters.
  17078. The filter also has a video output (see the @var{video} option) with a real
  17079. time graph to observe the loudness evolution. The graphic contains the logged
  17080. message mentioned above, so it is not printed anymore when this option is set,
  17081. unless the verbose logging is set. The main graphing area contains the
  17082. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  17083. the momentary loudness (400 milliseconds), but can optionally be configured
  17084. to instead display short-term loudness (see @var{gauge}).
  17085. The green area marks a +/- 1LU target range around the target loudness
  17086. (-23LUFS by default, unless modified through @var{target}).
  17087. More information about the Loudness Recommendation EBU R128 on
  17088. @url{http://tech.ebu.ch/loudness}.
  17089. The filter accepts the following options:
  17090. @table @option
  17091. @item video
  17092. Activate the video output. The audio stream is passed unchanged whether this
  17093. option is set or no. The video stream will be the first output stream if
  17094. activated. Default is @code{0}.
  17095. @item size
  17096. Set the video size. This option is for video only. For the syntax of this
  17097. option, check the
  17098. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17099. Default and minimum resolution is @code{640x480}.
  17100. @item meter
  17101. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  17102. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  17103. other integer value between this range is allowed.
  17104. @item metadata
  17105. Set metadata injection. If set to @code{1}, the audio input will be segmented
  17106. into 100ms output frames, each of them containing various loudness information
  17107. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  17108. Default is @code{0}.
  17109. @item framelog
  17110. Force the frame logging level.
  17111. Available values are:
  17112. @table @samp
  17113. @item info
  17114. information logging level
  17115. @item verbose
  17116. verbose logging level
  17117. @end table
  17118. By default, the logging level is set to @var{info}. If the @option{video} or
  17119. the @option{metadata} options are set, it switches to @var{verbose}.
  17120. @item peak
  17121. Set peak mode(s).
  17122. Available modes can be cumulated (the option is a @code{flag} type). Possible
  17123. values are:
  17124. @table @samp
  17125. @item none
  17126. Disable any peak mode (default).
  17127. @item sample
  17128. Enable sample-peak mode.
  17129. Simple peak mode looking for the higher sample value. It logs a message
  17130. for sample-peak (identified by @code{SPK}).
  17131. @item true
  17132. Enable true-peak mode.
  17133. If enabled, the peak lookup is done on an over-sampled version of the input
  17134. stream for better peak accuracy. It logs a message for true-peak.
  17135. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  17136. This mode requires a build with @code{libswresample}.
  17137. @end table
  17138. @item dualmono
  17139. Treat mono input files as "dual mono". If a mono file is intended for playback
  17140. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  17141. If set to @code{true}, this option will compensate for this effect.
  17142. Multi-channel input files are not affected by this option.
  17143. @item panlaw
  17144. Set a specific pan law to be used for the measurement of dual mono files.
  17145. This parameter is optional, and has a default value of -3.01dB.
  17146. @item target
  17147. Set a specific target level (in LUFS) used as relative zero in the visualization.
  17148. This parameter is optional and has a default value of -23LUFS as specified
  17149. by EBU R128. However, material published online may prefer a level of -16LUFS
  17150. (e.g. for use with podcasts or video platforms).
  17151. @item gauge
  17152. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  17153. @code{shortterm}. By default the momentary value will be used, but in certain
  17154. scenarios it may be more useful to observe the short term value instead (e.g.
  17155. live mixing).
  17156. @item scale
  17157. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  17158. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  17159. video output, not the summary or continuous log output.
  17160. @end table
  17161. @subsection Examples
  17162. @itemize
  17163. @item
  17164. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  17165. @example
  17166. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  17167. @end example
  17168. @item
  17169. Run an analysis with @command{ffmpeg}:
  17170. @example
  17171. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  17172. @end example
  17173. @end itemize
  17174. @section interleave, ainterleave
  17175. Temporally interleave frames from several inputs.
  17176. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  17177. These filters read frames from several inputs and send the oldest
  17178. queued frame to the output.
  17179. Input streams must have well defined, monotonically increasing frame
  17180. timestamp values.
  17181. In order to submit one frame to output, these filters need to enqueue
  17182. at least one frame for each input, so they cannot work in case one
  17183. input is not yet terminated and will not receive incoming frames.
  17184. For example consider the case when one input is a @code{select} filter
  17185. which always drops input frames. The @code{interleave} filter will keep
  17186. reading from that input, but it will never be able to send new frames
  17187. to output until the input sends an end-of-stream signal.
  17188. Also, depending on inputs synchronization, the filters will drop
  17189. frames in case one input receives more frames than the other ones, and
  17190. the queue is already filled.
  17191. These filters accept the following options:
  17192. @table @option
  17193. @item nb_inputs, n
  17194. Set the number of different inputs, it is 2 by default.
  17195. @end table
  17196. @subsection Examples
  17197. @itemize
  17198. @item
  17199. Interleave frames belonging to different streams using @command{ffmpeg}:
  17200. @example
  17201. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  17202. @end example
  17203. @item
  17204. Add flickering blur effect:
  17205. @example
  17206. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  17207. @end example
  17208. @end itemize
  17209. @section metadata, ametadata
  17210. Manipulate frame metadata.
  17211. This filter accepts the following options:
  17212. @table @option
  17213. @item mode
  17214. Set mode of operation of the filter.
  17215. Can be one of the following:
  17216. @table @samp
  17217. @item select
  17218. If both @code{value} and @code{key} is set, select frames
  17219. which have such metadata. If only @code{key} is set, select
  17220. every frame that has such key in metadata.
  17221. @item add
  17222. Add new metadata @code{key} and @code{value}. If key is already available
  17223. do nothing.
  17224. @item modify
  17225. Modify value of already present key.
  17226. @item delete
  17227. If @code{value} is set, delete only keys that have such value.
  17228. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  17229. the frame.
  17230. @item print
  17231. Print key and its value if metadata was found. If @code{key} is not set print all
  17232. metadata values available in frame.
  17233. @end table
  17234. @item key
  17235. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  17236. @item value
  17237. Set metadata value which will be used. This option is mandatory for
  17238. @code{modify} and @code{add} mode.
  17239. @item function
  17240. Which function to use when comparing metadata value and @code{value}.
  17241. Can be one of following:
  17242. @table @samp
  17243. @item same_str
  17244. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  17245. @item starts_with
  17246. Values are interpreted as strings, returns true if metadata value starts with
  17247. the @code{value} option string.
  17248. @item less
  17249. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  17250. @item equal
  17251. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  17252. @item greater
  17253. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  17254. @item expr
  17255. Values are interpreted as floats, returns true if expression from option @code{expr}
  17256. evaluates to true.
  17257. @item ends_with
  17258. Values are interpreted as strings, returns true if metadata value ends with
  17259. the @code{value} option string.
  17260. @end table
  17261. @item expr
  17262. Set expression which is used when @code{function} is set to @code{expr}.
  17263. The expression is evaluated through the eval API and can contain the following
  17264. constants:
  17265. @table @option
  17266. @item VALUE1
  17267. Float representation of @code{value} from metadata key.
  17268. @item VALUE2
  17269. Float representation of @code{value} as supplied by user in @code{value} option.
  17270. @end table
  17271. @item file
  17272. If specified in @code{print} mode, output is written to the named file. Instead of
  17273. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  17274. for standard output. If @code{file} option is not set, output is written to the log
  17275. with AV_LOG_INFO loglevel.
  17276. @item direct
  17277. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  17278. @end table
  17279. @subsection Examples
  17280. @itemize
  17281. @item
  17282. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  17283. between 0 and 1.
  17284. @example
  17285. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  17286. @end example
  17287. @item
  17288. Print silencedetect output to file @file{metadata.txt}.
  17289. @example
  17290. silencedetect,ametadata=mode=print:file=metadata.txt
  17291. @end example
  17292. @item
  17293. Direct all metadata to a pipe with file descriptor 4.
  17294. @example
  17295. metadata=mode=print:file='pipe\:4'
  17296. @end example
  17297. @end itemize
  17298. @section perms, aperms
  17299. Set read/write permissions for the output frames.
  17300. These filters are mainly aimed at developers to test direct path in the
  17301. following filter in the filtergraph.
  17302. The filters accept the following options:
  17303. @table @option
  17304. @item mode
  17305. Select the permissions mode.
  17306. It accepts the following values:
  17307. @table @samp
  17308. @item none
  17309. Do nothing. This is the default.
  17310. @item ro
  17311. Set all the output frames read-only.
  17312. @item rw
  17313. Set all the output frames directly writable.
  17314. @item toggle
  17315. Make the frame read-only if writable, and writable if read-only.
  17316. @item random
  17317. Set each output frame read-only or writable randomly.
  17318. @end table
  17319. @item seed
  17320. Set the seed for the @var{random} mode, must be an integer included between
  17321. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  17322. @code{-1}, the filter will try to use a good random seed on a best effort
  17323. basis.
  17324. @end table
  17325. Note: in case of auto-inserted filter between the permission filter and the
  17326. following one, the permission might not be received as expected in that
  17327. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  17328. perms/aperms filter can avoid this problem.
  17329. @section realtime, arealtime
  17330. Slow down filtering to match real time approximately.
  17331. These filters will pause the filtering for a variable amount of time to
  17332. match the output rate with the input timestamps.
  17333. They are similar to the @option{re} option to @code{ffmpeg}.
  17334. They accept the following options:
  17335. @table @option
  17336. @item limit
  17337. Time limit for the pauses. Any pause longer than that will be considered
  17338. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  17339. @item speed
  17340. Speed factor for processing. The value must be a float larger than zero.
  17341. Values larger than 1.0 will result in faster than realtime processing,
  17342. smaller will slow processing down. The @var{limit} is automatically adapted
  17343. accordingly. Default is 1.0.
  17344. A processing speed faster than what is possible without these filters cannot
  17345. be achieved.
  17346. @end table
  17347. @anchor{select}
  17348. @section select, aselect
  17349. Select frames to pass in output.
  17350. This filter accepts the following options:
  17351. @table @option
  17352. @item expr, e
  17353. Set expression, which is evaluated for each input frame.
  17354. If the expression is evaluated to zero, the frame is discarded.
  17355. If the evaluation result is negative or NaN, the frame is sent to the
  17356. first output; otherwise it is sent to the output with index
  17357. @code{ceil(val)-1}, assuming that the input index starts from 0.
  17358. For example a value of @code{1.2} corresponds to the output with index
  17359. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  17360. @item outputs, n
  17361. Set the number of outputs. The output to which to send the selected
  17362. frame is based on the result of the evaluation. Default value is 1.
  17363. @end table
  17364. The expression can contain the following constants:
  17365. @table @option
  17366. @item n
  17367. The (sequential) number of the filtered frame, starting from 0.
  17368. @item selected_n
  17369. The (sequential) number of the selected frame, starting from 0.
  17370. @item prev_selected_n
  17371. The sequential number of the last selected frame. It's NAN if undefined.
  17372. @item TB
  17373. The timebase of the input timestamps.
  17374. @item pts
  17375. The PTS (Presentation TimeStamp) of the filtered video frame,
  17376. expressed in @var{TB} units. It's NAN if undefined.
  17377. @item t
  17378. The PTS of the filtered video frame,
  17379. expressed in seconds. It's NAN if undefined.
  17380. @item prev_pts
  17381. The PTS of the previously filtered video frame. It's NAN if undefined.
  17382. @item prev_selected_pts
  17383. The PTS of the last previously filtered video frame. It's NAN if undefined.
  17384. @item prev_selected_t
  17385. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  17386. @item start_pts
  17387. The PTS of the first video frame in the video. It's NAN if undefined.
  17388. @item start_t
  17389. The time of the first video frame in the video. It's NAN if undefined.
  17390. @item pict_type @emph{(video only)}
  17391. The type of the filtered frame. It can assume one of the following
  17392. values:
  17393. @table @option
  17394. @item I
  17395. @item P
  17396. @item B
  17397. @item S
  17398. @item SI
  17399. @item SP
  17400. @item BI
  17401. @end table
  17402. @item interlace_type @emph{(video only)}
  17403. The frame interlace type. It can assume one of the following values:
  17404. @table @option
  17405. @item PROGRESSIVE
  17406. The frame is progressive (not interlaced).
  17407. @item TOPFIRST
  17408. The frame is top-field-first.
  17409. @item BOTTOMFIRST
  17410. The frame is bottom-field-first.
  17411. @end table
  17412. @item consumed_sample_n @emph{(audio only)}
  17413. the number of selected samples before the current frame
  17414. @item samples_n @emph{(audio only)}
  17415. the number of samples in the current frame
  17416. @item sample_rate @emph{(audio only)}
  17417. the input sample rate
  17418. @item key
  17419. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  17420. @item pos
  17421. the position in the file of the filtered frame, -1 if the information
  17422. is not available (e.g. for synthetic video)
  17423. @item scene @emph{(video only)}
  17424. value between 0 and 1 to indicate a new scene; a low value reflects a low
  17425. probability for the current frame to introduce a new scene, while a higher
  17426. value means the current frame is more likely to be one (see the example below)
  17427. @item concatdec_select
  17428. The concat demuxer can select only part of a concat input file by setting an
  17429. inpoint and an outpoint, but the output packets may not be entirely contained
  17430. in the selected interval. By using this variable, it is possible to skip frames
  17431. generated by the concat demuxer which are not exactly contained in the selected
  17432. interval.
  17433. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  17434. and the @var{lavf.concat.duration} packet metadata values which are also
  17435. present in the decoded frames.
  17436. The @var{concatdec_select} variable is -1 if the frame pts is at least
  17437. start_time and either the duration metadata is missing or the frame pts is less
  17438. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  17439. missing.
  17440. That basically means that an input frame is selected if its pts is within the
  17441. interval set by the concat demuxer.
  17442. @end table
  17443. The default value of the select expression is "1".
  17444. @subsection Examples
  17445. @itemize
  17446. @item
  17447. Select all frames in input:
  17448. @example
  17449. select
  17450. @end example
  17451. The example above is the same as:
  17452. @example
  17453. select=1
  17454. @end example
  17455. @item
  17456. Skip all frames:
  17457. @example
  17458. select=0
  17459. @end example
  17460. @item
  17461. Select only I-frames:
  17462. @example
  17463. select='eq(pict_type\,I)'
  17464. @end example
  17465. @item
  17466. Select one frame every 100:
  17467. @example
  17468. select='not(mod(n\,100))'
  17469. @end example
  17470. @item
  17471. Select only frames contained in the 10-20 time interval:
  17472. @example
  17473. select=between(t\,10\,20)
  17474. @end example
  17475. @item
  17476. Select only I-frames contained in the 10-20 time interval:
  17477. @example
  17478. select=between(t\,10\,20)*eq(pict_type\,I)
  17479. @end example
  17480. @item
  17481. Select frames with a minimum distance of 10 seconds:
  17482. @example
  17483. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  17484. @end example
  17485. @item
  17486. Use aselect to select only audio frames with samples number > 100:
  17487. @example
  17488. aselect='gt(samples_n\,100)'
  17489. @end example
  17490. @item
  17491. Create a mosaic of the first scenes:
  17492. @example
  17493. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  17494. @end example
  17495. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  17496. choice.
  17497. @item
  17498. Send even and odd frames to separate outputs, and compose them:
  17499. @example
  17500. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  17501. @end example
  17502. @item
  17503. Select useful frames from an ffconcat file which is using inpoints and
  17504. outpoints but where the source files are not intra frame only.
  17505. @example
  17506. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  17507. @end example
  17508. @end itemize
  17509. @section sendcmd, asendcmd
  17510. Send commands to filters in the filtergraph.
  17511. These filters read commands to be sent to other filters in the
  17512. filtergraph.
  17513. @code{sendcmd} must be inserted between two video filters,
  17514. @code{asendcmd} must be inserted between two audio filters, but apart
  17515. from that they act the same way.
  17516. The specification of commands can be provided in the filter arguments
  17517. with the @var{commands} option, or in a file specified by the
  17518. @var{filename} option.
  17519. These filters accept the following options:
  17520. @table @option
  17521. @item commands, c
  17522. Set the commands to be read and sent to the other filters.
  17523. @item filename, f
  17524. Set the filename of the commands to be read and sent to the other
  17525. filters.
  17526. @end table
  17527. @subsection Commands syntax
  17528. A commands description consists of a sequence of interval
  17529. specifications, comprising a list of commands to be executed when a
  17530. particular event related to that interval occurs. The occurring event
  17531. is typically the current frame time entering or leaving a given time
  17532. interval.
  17533. An interval is specified by the following syntax:
  17534. @example
  17535. @var{START}[-@var{END}] @var{COMMANDS};
  17536. @end example
  17537. The time interval is specified by the @var{START} and @var{END} times.
  17538. @var{END} is optional and defaults to the maximum time.
  17539. The current frame time is considered within the specified interval if
  17540. it is included in the interval [@var{START}, @var{END}), that is when
  17541. the time is greater or equal to @var{START} and is lesser than
  17542. @var{END}.
  17543. @var{COMMANDS} consists of a sequence of one or more command
  17544. specifications, separated by ",", relating to that interval. The
  17545. syntax of a command specification is given by:
  17546. @example
  17547. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  17548. @end example
  17549. @var{FLAGS} is optional and specifies the type of events relating to
  17550. the time interval which enable sending the specified command, and must
  17551. be a non-null sequence of identifier flags separated by "+" or "|" and
  17552. enclosed between "[" and "]".
  17553. The following flags are recognized:
  17554. @table @option
  17555. @item enter
  17556. The command is sent when the current frame timestamp enters the
  17557. specified interval. In other words, the command is sent when the
  17558. previous frame timestamp was not in the given interval, and the
  17559. current is.
  17560. @item leave
  17561. The command is sent when the current frame timestamp leaves the
  17562. specified interval. In other words, the command is sent when the
  17563. previous frame timestamp was in the given interval, and the
  17564. current is not.
  17565. @end table
  17566. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  17567. assumed.
  17568. @var{TARGET} specifies the target of the command, usually the name of
  17569. the filter class or a specific filter instance name.
  17570. @var{COMMAND} specifies the name of the command for the target filter.
  17571. @var{ARG} is optional and specifies the optional list of argument for
  17572. the given @var{COMMAND}.
  17573. Between one interval specification and another, whitespaces, or
  17574. sequences of characters starting with @code{#} until the end of line,
  17575. are ignored and can be used to annotate comments.
  17576. A simplified BNF description of the commands specification syntax
  17577. follows:
  17578. @example
  17579. @var{COMMAND_FLAG} ::= "enter" | "leave"
  17580. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  17581. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  17582. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  17583. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  17584. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  17585. @end example
  17586. @subsection Examples
  17587. @itemize
  17588. @item
  17589. Specify audio tempo change at second 4:
  17590. @example
  17591. asendcmd=c='4.0 atempo tempo 1.5',atempo
  17592. @end example
  17593. @item
  17594. Target a specific filter instance:
  17595. @example
  17596. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  17597. @end example
  17598. @item
  17599. Specify a list of drawtext and hue commands in a file.
  17600. @example
  17601. # show text in the interval 5-10
  17602. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  17603. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  17604. # desaturate the image in the interval 15-20
  17605. 15.0-20.0 [enter] hue s 0,
  17606. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  17607. [leave] hue s 1,
  17608. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  17609. # apply an exponential saturation fade-out effect, starting from time 25
  17610. 25 [enter] hue s exp(25-t)
  17611. @end example
  17612. A filtergraph allowing to read and process the above command list
  17613. stored in a file @file{test.cmd}, can be specified with:
  17614. @example
  17615. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  17616. @end example
  17617. @end itemize
  17618. @anchor{setpts}
  17619. @section setpts, asetpts
  17620. Change the PTS (presentation timestamp) of the input frames.
  17621. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  17622. This filter accepts the following options:
  17623. @table @option
  17624. @item expr
  17625. The expression which is evaluated for each frame to construct its timestamp.
  17626. @end table
  17627. The expression is evaluated through the eval API and can contain the following
  17628. constants:
  17629. @table @option
  17630. @item FRAME_RATE, FR
  17631. frame rate, only defined for constant frame-rate video
  17632. @item PTS
  17633. The presentation timestamp in input
  17634. @item N
  17635. The count of the input frame for video or the number of consumed samples,
  17636. not including the current frame for audio, starting from 0.
  17637. @item NB_CONSUMED_SAMPLES
  17638. The number of consumed samples, not including the current frame (only
  17639. audio)
  17640. @item NB_SAMPLES, S
  17641. The number of samples in the current frame (only audio)
  17642. @item SAMPLE_RATE, SR
  17643. The audio sample rate.
  17644. @item STARTPTS
  17645. The PTS of the first frame.
  17646. @item STARTT
  17647. the time in seconds of the first frame
  17648. @item INTERLACED
  17649. State whether the current frame is interlaced.
  17650. @item T
  17651. the time in seconds of the current frame
  17652. @item POS
  17653. original position in the file of the frame, or undefined if undefined
  17654. for the current frame
  17655. @item PREV_INPTS
  17656. The previous input PTS.
  17657. @item PREV_INT
  17658. previous input time in seconds
  17659. @item PREV_OUTPTS
  17660. The previous output PTS.
  17661. @item PREV_OUTT
  17662. previous output time in seconds
  17663. @item RTCTIME
  17664. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  17665. instead.
  17666. @item RTCSTART
  17667. The wallclock (RTC) time at the start of the movie in microseconds.
  17668. @item TB
  17669. The timebase of the input timestamps.
  17670. @end table
  17671. @subsection Examples
  17672. @itemize
  17673. @item
  17674. Start counting PTS from zero
  17675. @example
  17676. setpts=PTS-STARTPTS
  17677. @end example
  17678. @item
  17679. Apply fast motion effect:
  17680. @example
  17681. setpts=0.5*PTS
  17682. @end example
  17683. @item
  17684. Apply slow motion effect:
  17685. @example
  17686. setpts=2.0*PTS
  17687. @end example
  17688. @item
  17689. Set fixed rate of 25 frames per second:
  17690. @example
  17691. setpts=N/(25*TB)
  17692. @end example
  17693. @item
  17694. Set fixed rate 25 fps with some jitter:
  17695. @example
  17696. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  17697. @end example
  17698. @item
  17699. Apply an offset of 10 seconds to the input PTS:
  17700. @example
  17701. setpts=PTS+10/TB
  17702. @end example
  17703. @item
  17704. Generate timestamps from a "live source" and rebase onto the current timebase:
  17705. @example
  17706. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  17707. @end example
  17708. @item
  17709. Generate timestamps by counting samples:
  17710. @example
  17711. asetpts=N/SR/TB
  17712. @end example
  17713. @end itemize
  17714. @section setrange
  17715. Force color range for the output video frame.
  17716. The @code{setrange} filter marks the color range property for the
  17717. output frames. It does not change the input frame, but only sets the
  17718. corresponding property, which affects how the frame is treated by
  17719. following filters.
  17720. The filter accepts the following options:
  17721. @table @option
  17722. @item range
  17723. Available values are:
  17724. @table @samp
  17725. @item auto
  17726. Keep the same color range property.
  17727. @item unspecified, unknown
  17728. Set the color range as unspecified.
  17729. @item limited, tv, mpeg
  17730. Set the color range as limited.
  17731. @item full, pc, jpeg
  17732. Set the color range as full.
  17733. @end table
  17734. @end table
  17735. @section settb, asettb
  17736. Set the timebase to use for the output frames timestamps.
  17737. It is mainly useful for testing timebase configuration.
  17738. It accepts the following parameters:
  17739. @table @option
  17740. @item expr, tb
  17741. The expression which is evaluated into the output timebase.
  17742. @end table
  17743. The value for @option{tb} is an arithmetic expression representing a
  17744. rational. The expression can contain the constants "AVTB" (the default
  17745. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  17746. audio only). Default value is "intb".
  17747. @subsection Examples
  17748. @itemize
  17749. @item
  17750. Set the timebase to 1/25:
  17751. @example
  17752. settb=expr=1/25
  17753. @end example
  17754. @item
  17755. Set the timebase to 1/10:
  17756. @example
  17757. settb=expr=0.1
  17758. @end example
  17759. @item
  17760. Set the timebase to 1001/1000:
  17761. @example
  17762. settb=1+0.001
  17763. @end example
  17764. @item
  17765. Set the timebase to 2*intb:
  17766. @example
  17767. settb=2*intb
  17768. @end example
  17769. @item
  17770. Set the default timebase value:
  17771. @example
  17772. settb=AVTB
  17773. @end example
  17774. @end itemize
  17775. @section showcqt
  17776. Convert input audio to a video output representing frequency spectrum
  17777. logarithmically using Brown-Puckette constant Q transform algorithm with
  17778. direct frequency domain coefficient calculation (but the transform itself
  17779. is not really constant Q, instead the Q factor is actually variable/clamped),
  17780. with musical tone scale, from E0 to D#10.
  17781. The filter accepts the following options:
  17782. @table @option
  17783. @item size, s
  17784. Specify the video size for the output. It must be even. For the syntax of this option,
  17785. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17786. Default value is @code{1920x1080}.
  17787. @item fps, rate, r
  17788. Set the output frame rate. Default value is @code{25}.
  17789. @item bar_h
  17790. Set the bargraph height. It must be even. Default value is @code{-1} which
  17791. computes the bargraph height automatically.
  17792. @item axis_h
  17793. Set the axis height. It must be even. Default value is @code{-1} which computes
  17794. the axis height automatically.
  17795. @item sono_h
  17796. Set the sonogram height. It must be even. Default value is @code{-1} which
  17797. computes the sonogram height automatically.
  17798. @item fullhd
  17799. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17800. instead. Default value is @code{1}.
  17801. @item sono_v, volume
  17802. Specify the sonogram volume expression. It can contain variables:
  17803. @table @option
  17804. @item bar_v
  17805. the @var{bar_v} evaluated expression
  17806. @item frequency, freq, f
  17807. the frequency where it is evaluated
  17808. @item timeclamp, tc
  17809. the value of @var{timeclamp} option
  17810. @end table
  17811. and functions:
  17812. @table @option
  17813. @item a_weighting(f)
  17814. A-weighting of equal loudness
  17815. @item b_weighting(f)
  17816. B-weighting of equal loudness
  17817. @item c_weighting(f)
  17818. C-weighting of equal loudness.
  17819. @end table
  17820. Default value is @code{16}.
  17821. @item bar_v, volume2
  17822. Specify the bargraph volume expression. It can contain variables:
  17823. @table @option
  17824. @item sono_v
  17825. the @var{sono_v} evaluated expression
  17826. @item frequency, freq, f
  17827. the frequency where it is evaluated
  17828. @item timeclamp, tc
  17829. the value of @var{timeclamp} option
  17830. @end table
  17831. and functions:
  17832. @table @option
  17833. @item a_weighting(f)
  17834. A-weighting of equal loudness
  17835. @item b_weighting(f)
  17836. B-weighting of equal loudness
  17837. @item c_weighting(f)
  17838. C-weighting of equal loudness.
  17839. @end table
  17840. Default value is @code{sono_v}.
  17841. @item sono_g, gamma
  17842. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17843. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17844. Acceptable range is @code{[1, 7]}.
  17845. @item bar_g, gamma2
  17846. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17847. @code{[1, 7]}.
  17848. @item bar_t
  17849. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17850. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17851. @item timeclamp, tc
  17852. Specify the transform timeclamp. At low frequency, there is trade-off between
  17853. accuracy in time domain and frequency domain. If timeclamp is lower,
  17854. event in time domain is represented more accurately (such as fast bass drum),
  17855. otherwise event in frequency domain is represented more accurately
  17856. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17857. @item attack
  17858. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17859. limits future samples by applying asymmetric windowing in time domain, useful
  17860. when low latency is required. Accepted range is @code{[0, 1]}.
  17861. @item basefreq
  17862. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17863. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17864. @item endfreq
  17865. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17866. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17867. @item coeffclamp
  17868. This option is deprecated and ignored.
  17869. @item tlength
  17870. Specify the transform length in time domain. Use this option to control accuracy
  17871. trade-off between time domain and frequency domain at every frequency sample.
  17872. It can contain variables:
  17873. @table @option
  17874. @item frequency, freq, f
  17875. the frequency where it is evaluated
  17876. @item timeclamp, tc
  17877. the value of @var{timeclamp} option.
  17878. @end table
  17879. Default value is @code{384*tc/(384+tc*f)}.
  17880. @item count
  17881. Specify the transform count for every video frame. Default value is @code{6}.
  17882. Acceptable range is @code{[1, 30]}.
  17883. @item fcount
  17884. Specify the transform count for every single pixel. Default value is @code{0},
  17885. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17886. @item fontfile
  17887. Specify font file for use with freetype to draw the axis. If not specified,
  17888. use embedded font. Note that drawing with font file or embedded font is not
  17889. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17890. option instead.
  17891. @item font
  17892. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  17893. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  17894. escaping.
  17895. @item fontcolor
  17896. Specify font color expression. This is arithmetic expression that should return
  17897. integer value 0xRRGGBB. It can contain variables:
  17898. @table @option
  17899. @item frequency, freq, f
  17900. the frequency where it is evaluated
  17901. @item timeclamp, tc
  17902. the value of @var{timeclamp} option
  17903. @end table
  17904. and functions:
  17905. @table @option
  17906. @item midi(f)
  17907. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17908. @item r(x), g(x), b(x)
  17909. red, green, and blue value of intensity x.
  17910. @end table
  17911. Default value is @code{st(0, (midi(f)-59.5)/12);
  17912. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17913. r(1-ld(1)) + b(ld(1))}.
  17914. @item axisfile
  17915. Specify image file to draw the axis. This option override @var{fontfile} and
  17916. @var{fontcolor} option.
  17917. @item axis, text
  17918. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17919. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17920. Default value is @code{1}.
  17921. @item csp
  17922. Set colorspace. The accepted values are:
  17923. @table @samp
  17924. @item unspecified
  17925. Unspecified (default)
  17926. @item bt709
  17927. BT.709
  17928. @item fcc
  17929. FCC
  17930. @item bt470bg
  17931. BT.470BG or BT.601-6 625
  17932. @item smpte170m
  17933. SMPTE-170M or BT.601-6 525
  17934. @item smpte240m
  17935. SMPTE-240M
  17936. @item bt2020ncl
  17937. BT.2020 with non-constant luminance
  17938. @end table
  17939. @item cscheme
  17940. Set spectrogram color scheme. This is list of floating point values with format
  17941. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17942. The default is @code{1|0.5|0|0|0.5|1}.
  17943. @end table
  17944. @subsection Examples
  17945. @itemize
  17946. @item
  17947. Playing audio while showing the spectrum:
  17948. @example
  17949. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17950. @end example
  17951. @item
  17952. Same as above, but with frame rate 30 fps:
  17953. @example
  17954. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17955. @end example
  17956. @item
  17957. Playing at 1280x720:
  17958. @example
  17959. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17960. @end example
  17961. @item
  17962. Disable sonogram display:
  17963. @example
  17964. sono_h=0
  17965. @end example
  17966. @item
  17967. A1 and its harmonics: A1, A2, (near)E3, A3:
  17968. @example
  17969. 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),
  17970. asplit[a][out1]; [a] showcqt [out0]'
  17971. @end example
  17972. @item
  17973. Same as above, but with more accuracy in frequency domain:
  17974. @example
  17975. 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),
  17976. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17977. @end example
  17978. @item
  17979. Custom volume:
  17980. @example
  17981. bar_v=10:sono_v=bar_v*a_weighting(f)
  17982. @end example
  17983. @item
  17984. Custom gamma, now spectrum is linear to the amplitude.
  17985. @example
  17986. bar_g=2:sono_g=2
  17987. @end example
  17988. @item
  17989. Custom tlength equation:
  17990. @example
  17991. 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)))'
  17992. @end example
  17993. @item
  17994. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17995. @example
  17996. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17997. @end example
  17998. @item
  17999. Custom font using fontconfig:
  18000. @example
  18001. font='Courier New,Monospace,mono|bold'
  18002. @end example
  18003. @item
  18004. Custom frequency range with custom axis using image file:
  18005. @example
  18006. axisfile=myaxis.png:basefreq=40:endfreq=10000
  18007. @end example
  18008. @end itemize
  18009. @section showfreqs
  18010. Convert input audio to video output representing the audio power spectrum.
  18011. Audio amplitude is on Y-axis while frequency is on X-axis.
  18012. The filter accepts the following options:
  18013. @table @option
  18014. @item size, s
  18015. Specify size of video. For the syntax of this option, check the
  18016. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18017. Default is @code{1024x512}.
  18018. @item mode
  18019. Set display mode.
  18020. This set how each frequency bin will be represented.
  18021. It accepts the following values:
  18022. @table @samp
  18023. @item line
  18024. @item bar
  18025. @item dot
  18026. @end table
  18027. Default is @code{bar}.
  18028. @item ascale
  18029. Set amplitude scale.
  18030. It accepts the following values:
  18031. @table @samp
  18032. @item lin
  18033. Linear scale.
  18034. @item sqrt
  18035. Square root scale.
  18036. @item cbrt
  18037. Cubic root scale.
  18038. @item log
  18039. Logarithmic scale.
  18040. @end table
  18041. Default is @code{log}.
  18042. @item fscale
  18043. Set frequency scale.
  18044. It accepts the following values:
  18045. @table @samp
  18046. @item lin
  18047. Linear scale.
  18048. @item log
  18049. Logarithmic scale.
  18050. @item rlog
  18051. Reverse logarithmic scale.
  18052. @end table
  18053. Default is @code{lin}.
  18054. @item win_size
  18055. Set window size. Allowed range is from 16 to 65536.
  18056. Default is @code{2048}
  18057. @item win_func
  18058. Set windowing function.
  18059. It accepts the following values:
  18060. @table @samp
  18061. @item rect
  18062. @item bartlett
  18063. @item hanning
  18064. @item hamming
  18065. @item blackman
  18066. @item welch
  18067. @item flattop
  18068. @item bharris
  18069. @item bnuttall
  18070. @item bhann
  18071. @item sine
  18072. @item nuttall
  18073. @item lanczos
  18074. @item gauss
  18075. @item tukey
  18076. @item dolph
  18077. @item cauchy
  18078. @item parzen
  18079. @item poisson
  18080. @item bohman
  18081. @end table
  18082. Default is @code{hanning}.
  18083. @item overlap
  18084. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18085. which means optimal overlap for selected window function will be picked.
  18086. @item averaging
  18087. Set time averaging. Setting this to 0 will display current maximal peaks.
  18088. Default is @code{1}, which means time averaging is disabled.
  18089. @item colors
  18090. Specify list of colors separated by space or by '|' which will be used to
  18091. draw channel frequencies. Unrecognized or missing colors will be replaced
  18092. by white color.
  18093. @item cmode
  18094. Set channel display mode.
  18095. It accepts the following values:
  18096. @table @samp
  18097. @item combined
  18098. @item separate
  18099. @end table
  18100. Default is @code{combined}.
  18101. @item minamp
  18102. Set minimum amplitude used in @code{log} amplitude scaler.
  18103. @end table
  18104. @section showspatial
  18105. Convert stereo input audio to a video output, representing the spatial relationship
  18106. between two channels.
  18107. The filter accepts the following options:
  18108. @table @option
  18109. @item size, s
  18110. Specify the video size for the output. For the syntax of this option, check the
  18111. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18112. Default value is @code{512x512}.
  18113. @item win_size
  18114. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  18115. @item win_func
  18116. Set window function.
  18117. It accepts the following values:
  18118. @table @samp
  18119. @item rect
  18120. @item bartlett
  18121. @item hann
  18122. @item hanning
  18123. @item hamming
  18124. @item blackman
  18125. @item welch
  18126. @item flattop
  18127. @item bharris
  18128. @item bnuttall
  18129. @item bhann
  18130. @item sine
  18131. @item nuttall
  18132. @item lanczos
  18133. @item gauss
  18134. @item tukey
  18135. @item dolph
  18136. @item cauchy
  18137. @item parzen
  18138. @item poisson
  18139. @item bohman
  18140. @end table
  18141. Default value is @code{hann}.
  18142. @item overlap
  18143. Set ratio of overlap window. Default value is @code{0.5}.
  18144. When value is @code{1} overlap is set to recommended size for specific
  18145. window function currently used.
  18146. @end table
  18147. @anchor{showspectrum}
  18148. @section showspectrum
  18149. Convert input audio to a video output, representing the audio frequency
  18150. spectrum.
  18151. The filter accepts the following options:
  18152. @table @option
  18153. @item size, s
  18154. Specify the video size for the output. For the syntax of this option, check the
  18155. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18156. Default value is @code{640x512}.
  18157. @item slide
  18158. Specify how the spectrum should slide along the window.
  18159. It accepts the following values:
  18160. @table @samp
  18161. @item replace
  18162. the samples start again on the left when they reach the right
  18163. @item scroll
  18164. the samples scroll from right to left
  18165. @item fullframe
  18166. frames are only produced when the samples reach the right
  18167. @item rscroll
  18168. the samples scroll from left to right
  18169. @end table
  18170. Default value is @code{replace}.
  18171. @item mode
  18172. Specify display mode.
  18173. It accepts the following values:
  18174. @table @samp
  18175. @item combined
  18176. all channels are displayed in the same row
  18177. @item separate
  18178. all channels are displayed in separate rows
  18179. @end table
  18180. Default value is @samp{combined}.
  18181. @item color
  18182. Specify display color mode.
  18183. It accepts the following values:
  18184. @table @samp
  18185. @item channel
  18186. each channel is displayed in a separate color
  18187. @item intensity
  18188. each channel is displayed using the same color scheme
  18189. @item rainbow
  18190. each channel is displayed using the rainbow color scheme
  18191. @item moreland
  18192. each channel is displayed using the moreland color scheme
  18193. @item nebulae
  18194. each channel is displayed using the nebulae color scheme
  18195. @item fire
  18196. each channel is displayed using the fire color scheme
  18197. @item fiery
  18198. each channel is displayed using the fiery color scheme
  18199. @item fruit
  18200. each channel is displayed using the fruit color scheme
  18201. @item cool
  18202. each channel is displayed using the cool color scheme
  18203. @item magma
  18204. each channel is displayed using the magma color scheme
  18205. @item green
  18206. each channel is displayed using the green color scheme
  18207. @item viridis
  18208. each channel is displayed using the viridis color scheme
  18209. @item plasma
  18210. each channel is displayed using the plasma color scheme
  18211. @item cividis
  18212. each channel is displayed using the cividis color scheme
  18213. @item terrain
  18214. each channel is displayed using the terrain color scheme
  18215. @end table
  18216. Default value is @samp{channel}.
  18217. @item scale
  18218. Specify scale used for calculating intensity color values.
  18219. It accepts the following values:
  18220. @table @samp
  18221. @item lin
  18222. linear
  18223. @item sqrt
  18224. square root, default
  18225. @item cbrt
  18226. cubic root
  18227. @item log
  18228. logarithmic
  18229. @item 4thrt
  18230. 4th root
  18231. @item 5thrt
  18232. 5th root
  18233. @end table
  18234. Default value is @samp{sqrt}.
  18235. @item fscale
  18236. Specify frequency scale.
  18237. It accepts the following values:
  18238. @table @samp
  18239. @item lin
  18240. linear
  18241. @item log
  18242. logarithmic
  18243. @end table
  18244. Default value is @samp{lin}.
  18245. @item saturation
  18246. Set saturation modifier for displayed colors. Negative values provide
  18247. alternative color scheme. @code{0} is no saturation at all.
  18248. Saturation must be in [-10.0, 10.0] range.
  18249. Default value is @code{1}.
  18250. @item win_func
  18251. Set window function.
  18252. It accepts the following values:
  18253. @table @samp
  18254. @item rect
  18255. @item bartlett
  18256. @item hann
  18257. @item hanning
  18258. @item hamming
  18259. @item blackman
  18260. @item welch
  18261. @item flattop
  18262. @item bharris
  18263. @item bnuttall
  18264. @item bhann
  18265. @item sine
  18266. @item nuttall
  18267. @item lanczos
  18268. @item gauss
  18269. @item tukey
  18270. @item dolph
  18271. @item cauchy
  18272. @item parzen
  18273. @item poisson
  18274. @item bohman
  18275. @end table
  18276. Default value is @code{hann}.
  18277. @item orientation
  18278. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18279. @code{horizontal}. Default is @code{vertical}.
  18280. @item overlap
  18281. Set ratio of overlap window. Default value is @code{0}.
  18282. When value is @code{1} overlap is set to recommended size for specific
  18283. window function currently used.
  18284. @item gain
  18285. Set scale gain for calculating intensity color values.
  18286. Default value is @code{1}.
  18287. @item data
  18288. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  18289. @item rotation
  18290. Set color rotation, must be in [-1.0, 1.0] range.
  18291. Default value is @code{0}.
  18292. @item start
  18293. Set start frequency from which to display spectrogram. Default is @code{0}.
  18294. @item stop
  18295. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18296. @item fps
  18297. Set upper frame rate limit. Default is @code{auto}, unlimited.
  18298. @item legend
  18299. Draw time and frequency axes and legends. Default is disabled.
  18300. @end table
  18301. The usage is very similar to the showwaves filter; see the examples in that
  18302. section.
  18303. @subsection Examples
  18304. @itemize
  18305. @item
  18306. Large window with logarithmic color scaling:
  18307. @example
  18308. showspectrum=s=1280x480:scale=log
  18309. @end example
  18310. @item
  18311. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  18312. @example
  18313. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18314. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  18315. @end example
  18316. @end itemize
  18317. @section showspectrumpic
  18318. Convert input audio to a single video frame, representing the audio frequency
  18319. spectrum.
  18320. The filter accepts the following options:
  18321. @table @option
  18322. @item size, s
  18323. Specify the video size for the output. For the syntax of this option, check the
  18324. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18325. Default value is @code{4096x2048}.
  18326. @item mode
  18327. Specify display mode.
  18328. It accepts the following values:
  18329. @table @samp
  18330. @item combined
  18331. all channels are displayed in the same row
  18332. @item separate
  18333. all channels are displayed in separate rows
  18334. @end table
  18335. Default value is @samp{combined}.
  18336. @item color
  18337. Specify display color mode.
  18338. It accepts the following values:
  18339. @table @samp
  18340. @item channel
  18341. each channel is displayed in a separate color
  18342. @item intensity
  18343. each channel is displayed using the same color scheme
  18344. @item rainbow
  18345. each channel is displayed using the rainbow color scheme
  18346. @item moreland
  18347. each channel is displayed using the moreland color scheme
  18348. @item nebulae
  18349. each channel is displayed using the nebulae color scheme
  18350. @item fire
  18351. each channel is displayed using the fire color scheme
  18352. @item fiery
  18353. each channel is displayed using the fiery color scheme
  18354. @item fruit
  18355. each channel is displayed using the fruit color scheme
  18356. @item cool
  18357. each channel is displayed using the cool color scheme
  18358. @item magma
  18359. each channel is displayed using the magma color scheme
  18360. @item green
  18361. each channel is displayed using the green color scheme
  18362. @item viridis
  18363. each channel is displayed using the viridis color scheme
  18364. @item plasma
  18365. each channel is displayed using the plasma color scheme
  18366. @item cividis
  18367. each channel is displayed using the cividis color scheme
  18368. @item terrain
  18369. each channel is displayed using the terrain color scheme
  18370. @end table
  18371. Default value is @samp{intensity}.
  18372. @item scale
  18373. Specify scale used for calculating intensity color values.
  18374. It accepts the following values:
  18375. @table @samp
  18376. @item lin
  18377. linear
  18378. @item sqrt
  18379. square root, default
  18380. @item cbrt
  18381. cubic root
  18382. @item log
  18383. logarithmic
  18384. @item 4thrt
  18385. 4th root
  18386. @item 5thrt
  18387. 5th root
  18388. @end table
  18389. Default value is @samp{log}.
  18390. @item fscale
  18391. Specify frequency scale.
  18392. It accepts the following values:
  18393. @table @samp
  18394. @item lin
  18395. linear
  18396. @item log
  18397. logarithmic
  18398. @end table
  18399. Default value is @samp{lin}.
  18400. @item saturation
  18401. Set saturation modifier for displayed colors. Negative values provide
  18402. alternative color scheme. @code{0} is no saturation at all.
  18403. Saturation must be in [-10.0, 10.0] range.
  18404. Default value is @code{1}.
  18405. @item win_func
  18406. Set window function.
  18407. It accepts the following values:
  18408. @table @samp
  18409. @item rect
  18410. @item bartlett
  18411. @item hann
  18412. @item hanning
  18413. @item hamming
  18414. @item blackman
  18415. @item welch
  18416. @item flattop
  18417. @item bharris
  18418. @item bnuttall
  18419. @item bhann
  18420. @item sine
  18421. @item nuttall
  18422. @item lanczos
  18423. @item gauss
  18424. @item tukey
  18425. @item dolph
  18426. @item cauchy
  18427. @item parzen
  18428. @item poisson
  18429. @item bohman
  18430. @end table
  18431. Default value is @code{hann}.
  18432. @item orientation
  18433. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18434. @code{horizontal}. Default is @code{vertical}.
  18435. @item gain
  18436. Set scale gain for calculating intensity color values.
  18437. Default value is @code{1}.
  18438. @item legend
  18439. Draw time and frequency axes and legends. Default is enabled.
  18440. @item rotation
  18441. Set color rotation, must be in [-1.0, 1.0] range.
  18442. Default value is @code{0}.
  18443. @item start
  18444. Set start frequency from which to display spectrogram. Default is @code{0}.
  18445. @item stop
  18446. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18447. @end table
  18448. @subsection Examples
  18449. @itemize
  18450. @item
  18451. Extract an audio spectrogram of a whole audio track
  18452. in a 1024x1024 picture using @command{ffmpeg}:
  18453. @example
  18454. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  18455. @end example
  18456. @end itemize
  18457. @section showvolume
  18458. Convert input audio volume to a video output.
  18459. The filter accepts the following options:
  18460. @table @option
  18461. @item rate, r
  18462. Set video rate.
  18463. @item b
  18464. Set border width, allowed range is [0, 5]. Default is 1.
  18465. @item w
  18466. Set channel width, allowed range is [80, 8192]. Default is 400.
  18467. @item h
  18468. Set channel height, allowed range is [1, 900]. Default is 20.
  18469. @item f
  18470. Set fade, allowed range is [0, 1]. Default is 0.95.
  18471. @item c
  18472. Set volume color expression.
  18473. The expression can use the following variables:
  18474. @table @option
  18475. @item VOLUME
  18476. Current max volume of channel in dB.
  18477. @item PEAK
  18478. Current peak.
  18479. @item CHANNEL
  18480. Current channel number, starting from 0.
  18481. @end table
  18482. @item t
  18483. If set, displays channel names. Default is enabled.
  18484. @item v
  18485. If set, displays volume values. Default is enabled.
  18486. @item o
  18487. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  18488. default is @code{h}.
  18489. @item s
  18490. Set step size, allowed range is [0, 5]. Default is 0, which means
  18491. step is disabled.
  18492. @item p
  18493. Set background opacity, allowed range is [0, 1]. Default is 0.
  18494. @item m
  18495. Set metering mode, can be peak: @code{p} or rms: @code{r},
  18496. default is @code{p}.
  18497. @item ds
  18498. Set display scale, can be linear: @code{lin} or log: @code{log},
  18499. default is @code{lin}.
  18500. @item dm
  18501. In second.
  18502. If set to > 0., display a line for the max level
  18503. in the previous seconds.
  18504. default is disabled: @code{0.}
  18505. @item dmc
  18506. The color of the max line. Use when @code{dm} option is set to > 0.
  18507. default is: @code{orange}
  18508. @end table
  18509. @section showwaves
  18510. Convert input audio to a video output, representing the samples waves.
  18511. The filter accepts the following options:
  18512. @table @option
  18513. @item size, s
  18514. Specify the video size for the output. For the syntax of this option, check the
  18515. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18516. Default value is @code{600x240}.
  18517. @item mode
  18518. Set display mode.
  18519. Available values are:
  18520. @table @samp
  18521. @item point
  18522. Draw a point for each sample.
  18523. @item line
  18524. Draw a vertical line for each sample.
  18525. @item p2p
  18526. Draw a point for each sample and a line between them.
  18527. @item cline
  18528. Draw a centered vertical line for each sample.
  18529. @end table
  18530. Default value is @code{point}.
  18531. @item n
  18532. Set the number of samples which are printed on the same column. A
  18533. larger value will decrease the frame rate. Must be a positive
  18534. integer. This option can be set only if the value for @var{rate}
  18535. is not explicitly specified.
  18536. @item rate, r
  18537. Set the (approximate) output frame rate. This is done by setting the
  18538. option @var{n}. Default value is "25".
  18539. @item split_channels
  18540. Set if channels should be drawn separately or overlap. Default value is 0.
  18541. @item colors
  18542. Set colors separated by '|' which are going to be used for drawing of each channel.
  18543. @item scale
  18544. Set amplitude scale.
  18545. Available values are:
  18546. @table @samp
  18547. @item lin
  18548. Linear.
  18549. @item log
  18550. Logarithmic.
  18551. @item sqrt
  18552. Square root.
  18553. @item cbrt
  18554. Cubic root.
  18555. @end table
  18556. Default is linear.
  18557. @item draw
  18558. Set the draw mode. This is mostly useful to set for high @var{n}.
  18559. Available values are:
  18560. @table @samp
  18561. @item scale
  18562. Scale pixel values for each drawn sample.
  18563. @item full
  18564. Draw every sample directly.
  18565. @end table
  18566. Default value is @code{scale}.
  18567. @end table
  18568. @subsection Examples
  18569. @itemize
  18570. @item
  18571. Output the input file audio and the corresponding video representation
  18572. at the same time:
  18573. @example
  18574. amovie=a.mp3,asplit[out0],showwaves[out1]
  18575. @end example
  18576. @item
  18577. Create a synthetic signal and show it with showwaves, forcing a
  18578. frame rate of 30 frames per second:
  18579. @example
  18580. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  18581. @end example
  18582. @end itemize
  18583. @section showwavespic
  18584. Convert input audio to a single video frame, representing the samples waves.
  18585. The filter accepts the following options:
  18586. @table @option
  18587. @item size, s
  18588. Specify the video size for the output. For the syntax of this option, check the
  18589. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18590. Default value is @code{600x240}.
  18591. @item split_channels
  18592. Set if channels should be drawn separately or overlap. Default value is 0.
  18593. @item colors
  18594. Set colors separated by '|' which are going to be used for drawing of each channel.
  18595. @item scale
  18596. Set amplitude scale.
  18597. Available values are:
  18598. @table @samp
  18599. @item lin
  18600. Linear.
  18601. @item log
  18602. Logarithmic.
  18603. @item sqrt
  18604. Square root.
  18605. @item cbrt
  18606. Cubic root.
  18607. @end table
  18608. Default is linear.
  18609. @item draw
  18610. Set the draw mode.
  18611. Available values are:
  18612. @table @samp
  18613. @item scale
  18614. Scale pixel values for each drawn sample.
  18615. @item full
  18616. Draw every sample directly.
  18617. @end table
  18618. Default value is @code{scale}.
  18619. @end table
  18620. @subsection Examples
  18621. @itemize
  18622. @item
  18623. Extract a channel split representation of the wave form of a whole audio track
  18624. in a 1024x800 picture using @command{ffmpeg}:
  18625. @example
  18626. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  18627. @end example
  18628. @end itemize
  18629. @section sidedata, asidedata
  18630. Delete frame side data, or select frames based on it.
  18631. This filter accepts the following options:
  18632. @table @option
  18633. @item mode
  18634. Set mode of operation of the filter.
  18635. Can be one of the following:
  18636. @table @samp
  18637. @item select
  18638. Select every frame with side data of @code{type}.
  18639. @item delete
  18640. Delete side data of @code{type}. If @code{type} is not set, delete all side
  18641. data in the frame.
  18642. @end table
  18643. @item type
  18644. Set side data type used with all modes. Must be set for @code{select} mode. For
  18645. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  18646. in @file{libavutil/frame.h}. For example, to choose
  18647. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  18648. @end table
  18649. @section spectrumsynth
  18650. Synthesize audio from 2 input video spectrums, first input stream represents
  18651. magnitude across time and second represents phase across time.
  18652. The filter will transform from frequency domain as displayed in videos back
  18653. to time domain as presented in audio output.
  18654. This filter is primarily created for reversing processed @ref{showspectrum}
  18655. filter outputs, but can synthesize sound from other spectrograms too.
  18656. But in such case results are going to be poor if the phase data is not
  18657. available, because in such cases phase data need to be recreated, usually
  18658. it's just recreated from random noise.
  18659. For best results use gray only output (@code{channel} color mode in
  18660. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  18661. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  18662. @code{data} option. Inputs videos should generally use @code{fullframe}
  18663. slide mode as that saves resources needed for decoding video.
  18664. The filter accepts the following options:
  18665. @table @option
  18666. @item sample_rate
  18667. Specify sample rate of output audio, the sample rate of audio from which
  18668. spectrum was generated may differ.
  18669. @item channels
  18670. Set number of channels represented in input video spectrums.
  18671. @item scale
  18672. Set scale which was used when generating magnitude input spectrum.
  18673. Can be @code{lin} or @code{log}. Default is @code{log}.
  18674. @item slide
  18675. Set slide which was used when generating inputs spectrums.
  18676. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  18677. Default is @code{fullframe}.
  18678. @item win_func
  18679. Set window function used for resynthesis.
  18680. @item overlap
  18681. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18682. which means optimal overlap for selected window function will be picked.
  18683. @item orientation
  18684. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  18685. Default is @code{vertical}.
  18686. @end table
  18687. @subsection Examples
  18688. @itemize
  18689. @item
  18690. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  18691. then resynthesize videos back to audio with spectrumsynth:
  18692. @example
  18693. 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
  18694. 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
  18695. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  18696. @end example
  18697. @end itemize
  18698. @section split, asplit
  18699. Split input into several identical outputs.
  18700. @code{asplit} works with audio input, @code{split} with video.
  18701. The filter accepts a single parameter which specifies the number of outputs. If
  18702. unspecified, it defaults to 2.
  18703. @subsection Examples
  18704. @itemize
  18705. @item
  18706. Create two separate outputs from the same input:
  18707. @example
  18708. [in] split [out0][out1]
  18709. @end example
  18710. @item
  18711. To create 3 or more outputs, you need to specify the number of
  18712. outputs, like in:
  18713. @example
  18714. [in] asplit=3 [out0][out1][out2]
  18715. @end example
  18716. @item
  18717. Create two separate outputs from the same input, one cropped and
  18718. one padded:
  18719. @example
  18720. [in] split [splitout1][splitout2];
  18721. [splitout1] crop=100:100:0:0 [cropout];
  18722. [splitout2] pad=200:200:100:100 [padout];
  18723. @end example
  18724. @item
  18725. Create 5 copies of the input audio with @command{ffmpeg}:
  18726. @example
  18727. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  18728. @end example
  18729. @end itemize
  18730. @section zmq, azmq
  18731. Receive commands sent through a libzmq client, and forward them to
  18732. filters in the filtergraph.
  18733. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  18734. must be inserted between two video filters, @code{azmq} between two
  18735. audio filters. Both are capable to send messages to any filter type.
  18736. To enable these filters you need to install the libzmq library and
  18737. headers and configure FFmpeg with @code{--enable-libzmq}.
  18738. For more information about libzmq see:
  18739. @url{http://www.zeromq.org/}
  18740. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  18741. receives messages sent through a network interface defined by the
  18742. @option{bind_address} (or the abbreviation "@option{b}") option.
  18743. Default value of this option is @file{tcp://localhost:5555}. You may
  18744. want to alter this value to your needs, but do not forget to escape any
  18745. ':' signs (see @ref{filtergraph escaping}).
  18746. The received message must be in the form:
  18747. @example
  18748. @var{TARGET} @var{COMMAND} [@var{ARG}]
  18749. @end example
  18750. @var{TARGET} specifies the target of the command, usually the name of
  18751. the filter class or a specific filter instance name. The default
  18752. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  18753. but you can override this by using the @samp{filter_name@@id} syntax
  18754. (see @ref{Filtergraph syntax}).
  18755. @var{COMMAND} specifies the name of the command for the target filter.
  18756. @var{ARG} is optional and specifies the optional argument list for the
  18757. given @var{COMMAND}.
  18758. Upon reception, the message is processed and the corresponding command
  18759. is injected into the filtergraph. Depending on the result, the filter
  18760. will send a reply to the client, adopting the format:
  18761. @example
  18762. @var{ERROR_CODE} @var{ERROR_REASON}
  18763. @var{MESSAGE}
  18764. @end example
  18765. @var{MESSAGE} is optional.
  18766. @subsection Examples
  18767. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18768. be used to send commands processed by these filters.
  18769. Consider the following filtergraph generated by @command{ffplay}.
  18770. In this example the last overlay filter has an instance name. All other
  18771. filters will have default instance names.
  18772. @example
  18773. ffplay -dumpgraph 1 -f lavfi "
  18774. color=s=100x100:c=red [l];
  18775. color=s=100x100:c=blue [r];
  18776. nullsrc=s=200x100, zmq [bg];
  18777. [bg][l] overlay [bg+l];
  18778. [bg+l][r] overlay@@my=x=100 "
  18779. @end example
  18780. To change the color of the left side of the video, the following
  18781. command can be used:
  18782. @example
  18783. echo Parsed_color_0 c yellow | tools/zmqsend
  18784. @end example
  18785. To change the right side:
  18786. @example
  18787. echo Parsed_color_1 c pink | tools/zmqsend
  18788. @end example
  18789. To change the position of the right side:
  18790. @example
  18791. echo overlay@@my x 150 | tools/zmqsend
  18792. @end example
  18793. @c man end MULTIMEDIA FILTERS
  18794. @chapter Multimedia Sources
  18795. @c man begin MULTIMEDIA SOURCES
  18796. Below is a description of the currently available multimedia sources.
  18797. @section amovie
  18798. This is the same as @ref{movie} source, except it selects an audio
  18799. stream by default.
  18800. @anchor{movie}
  18801. @section movie
  18802. Read audio and/or video stream(s) from a movie container.
  18803. It accepts the following parameters:
  18804. @table @option
  18805. @item filename
  18806. The name of the resource to read (not necessarily a file; it can also be a
  18807. device or a stream accessed through some protocol).
  18808. @item format_name, f
  18809. Specifies the format assumed for the movie to read, and can be either
  18810. the name of a container or an input device. If not specified, the
  18811. format is guessed from @var{movie_name} or by probing.
  18812. @item seek_point, sp
  18813. Specifies the seek point in seconds. The frames will be output
  18814. starting from this seek point. The parameter is evaluated with
  18815. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18816. postfix. The default value is "0".
  18817. @item streams, s
  18818. Specifies the streams to read. Several streams can be specified,
  18819. separated by "+". The source will then have as many outputs, in the
  18820. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18821. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18822. respectively the default (best suited) video and audio stream. Default
  18823. is "dv", or "da" if the filter is called as "amovie".
  18824. @item stream_index, si
  18825. Specifies the index of the video stream to read. If the value is -1,
  18826. the most suitable video stream will be automatically selected. The default
  18827. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18828. audio instead of video.
  18829. @item loop
  18830. Specifies how many times to read the stream in sequence.
  18831. If the value is 0, the stream will be looped infinitely.
  18832. Default value is "1".
  18833. Note that when the movie is looped the source timestamps are not
  18834. changed, so it will generate non monotonically increasing timestamps.
  18835. @item discontinuity
  18836. Specifies the time difference between frames above which the point is
  18837. considered a timestamp discontinuity which is removed by adjusting the later
  18838. timestamps.
  18839. @end table
  18840. It allows overlaying a second video on top of the main input of
  18841. a filtergraph, as shown in this graph:
  18842. @example
  18843. input -----------> deltapts0 --> overlay --> output
  18844. ^
  18845. |
  18846. movie --> scale--> deltapts1 -------+
  18847. @end example
  18848. @subsection Examples
  18849. @itemize
  18850. @item
  18851. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18852. on top of the input labelled "in":
  18853. @example
  18854. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18855. [in] setpts=PTS-STARTPTS [main];
  18856. [main][over] overlay=16:16 [out]
  18857. @end example
  18858. @item
  18859. Read from a video4linux2 device, and overlay it on top of the input
  18860. labelled "in":
  18861. @example
  18862. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18863. [in] setpts=PTS-STARTPTS [main];
  18864. [main][over] overlay=16:16 [out]
  18865. @end example
  18866. @item
  18867. Read the first video stream and the audio stream with id 0x81 from
  18868. dvd.vob; the video is connected to the pad named "video" and the audio is
  18869. connected to the pad named "audio":
  18870. @example
  18871. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18872. @end example
  18873. @end itemize
  18874. @subsection Commands
  18875. Both movie and amovie support the following commands:
  18876. @table @option
  18877. @item seek
  18878. Perform seek using "av_seek_frame".
  18879. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18880. @itemize
  18881. @item
  18882. @var{stream_index}: If stream_index is -1, a default
  18883. stream is selected, and @var{timestamp} is automatically converted
  18884. from AV_TIME_BASE units to the stream specific time_base.
  18885. @item
  18886. @var{timestamp}: Timestamp in AVStream.time_base units
  18887. or, if no stream is specified, in AV_TIME_BASE units.
  18888. @item
  18889. @var{flags}: Flags which select direction and seeking mode.
  18890. @end itemize
  18891. @item get_duration
  18892. Get movie duration in AV_TIME_BASE units.
  18893. @end table
  18894. @c man end MULTIMEDIA SOURCES