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.

25482 lines
678KB

  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. @subsection Commands
  1718. This filter supports the all above options as @ref{commands}.
  1719. @section asr
  1720. Automatic Speech Recognition
  1721. This filter uses PocketSphinx for speech recognition. To enable
  1722. compilation of this filter, you need to configure FFmpeg with
  1723. @code{--enable-pocketsphinx}.
  1724. It accepts the following options:
  1725. @table @option
  1726. @item rate
  1727. Set sampling rate of input audio. Defaults is @code{16000}.
  1728. This need to match speech models, otherwise one will get poor results.
  1729. @item hmm
  1730. Set dictionary containing acoustic model files.
  1731. @item dict
  1732. Set pronunciation dictionary.
  1733. @item lm
  1734. Set language model file.
  1735. @item lmctl
  1736. Set language model set.
  1737. @item lmname
  1738. Set which language model to use.
  1739. @item logfn
  1740. Set output for log messages.
  1741. @end table
  1742. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1743. @anchor{astats}
  1744. @section astats
  1745. Display time domain statistical information about the audio channels.
  1746. Statistics are calculated and displayed for each audio channel and,
  1747. where applicable, an overall figure is also given.
  1748. It accepts the following option:
  1749. @table @option
  1750. @item length
  1751. Short window length in seconds, used for peak and trough RMS measurement.
  1752. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1753. @item metadata
  1754. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1755. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1756. disabled.
  1757. Available keys for each channel are:
  1758. DC_offset
  1759. Min_level
  1760. Max_level
  1761. Min_difference
  1762. Max_difference
  1763. Mean_difference
  1764. RMS_difference
  1765. Peak_level
  1766. RMS_peak
  1767. RMS_trough
  1768. Crest_factor
  1769. Flat_factor
  1770. Peak_count
  1771. Noise_floor
  1772. Noise_floor_count
  1773. Bit_depth
  1774. Dynamic_range
  1775. Zero_crossings
  1776. Zero_crossings_rate
  1777. Number_of_NaNs
  1778. Number_of_Infs
  1779. Number_of_denormals
  1780. and for Overall:
  1781. DC_offset
  1782. Min_level
  1783. Max_level
  1784. Min_difference
  1785. Max_difference
  1786. Mean_difference
  1787. RMS_difference
  1788. Peak_level
  1789. RMS_level
  1790. RMS_peak
  1791. RMS_trough
  1792. Flat_factor
  1793. Peak_count
  1794. Noise_floor
  1795. Noise_floor_count
  1796. Bit_depth
  1797. Number_of_samples
  1798. Number_of_NaNs
  1799. Number_of_Infs
  1800. Number_of_denormals
  1801. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1802. this @code{lavfi.astats.Overall.Peak_count}.
  1803. For description what each key means read below.
  1804. @item reset
  1805. Set number of frame after which stats are going to be recalculated.
  1806. Default is disabled.
  1807. @item measure_perchannel
  1808. Select the entries which need to be measured per channel. The metadata keys can
  1809. be used as flags, default is @option{all} which measures everything.
  1810. @option{none} disables all per channel measurement.
  1811. @item measure_overall
  1812. Select the entries which need to be measured overall. The metadata keys can
  1813. be used as flags, default is @option{all} which measures everything.
  1814. @option{none} disables all overall measurement.
  1815. @end table
  1816. A description of each shown parameter follows:
  1817. @table @option
  1818. @item DC offset
  1819. Mean amplitude displacement from zero.
  1820. @item Min level
  1821. Minimal sample level.
  1822. @item Max level
  1823. Maximal sample level.
  1824. @item Min difference
  1825. Minimal difference between two consecutive samples.
  1826. @item Max difference
  1827. Maximal difference between two consecutive samples.
  1828. @item Mean difference
  1829. Mean difference between two consecutive samples.
  1830. The average of each difference between two consecutive samples.
  1831. @item RMS difference
  1832. Root Mean Square difference between two consecutive samples.
  1833. @item Peak level dB
  1834. @item RMS level dB
  1835. Standard peak and RMS level measured in dBFS.
  1836. @item RMS peak dB
  1837. @item RMS trough dB
  1838. Peak and trough values for RMS level measured over a short window.
  1839. @item Crest factor
  1840. Standard ratio of peak to RMS level (note: not in dB).
  1841. @item Flat factor
  1842. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1843. (i.e. either @var{Min level} or @var{Max level}).
  1844. @item Peak count
  1845. Number of occasions (not the number of samples) that the signal attained either
  1846. @var{Min level} or @var{Max level}.
  1847. @item Noise floor dB
  1848. Minimum local peak measured in dBFS over a short window.
  1849. @item Noise floor count
  1850. Number of occasions (not the number of samples) that the signal attained
  1851. @var{Noise floor}.
  1852. @item Bit depth
  1853. Overall bit depth of audio. Number of bits used for each sample.
  1854. @item Dynamic range
  1855. Measured dynamic range of audio in dB.
  1856. @item Zero crossings
  1857. Number of points where the waveform crosses the zero level axis.
  1858. @item Zero crossings rate
  1859. Rate of Zero crossings and number of audio samples.
  1860. @end table
  1861. @section atempo
  1862. Adjust audio tempo.
  1863. The filter accepts exactly one parameter, the audio tempo. If not
  1864. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1865. be in the [0.5, 100.0] range.
  1866. Note that tempo greater than 2 will skip some samples rather than
  1867. blend them in. If for any reason this is a concern it is always
  1868. possible to daisy-chain several instances of atempo to achieve the
  1869. desired product tempo.
  1870. @subsection Examples
  1871. @itemize
  1872. @item
  1873. Slow down audio to 80% tempo:
  1874. @example
  1875. atempo=0.8
  1876. @end example
  1877. @item
  1878. To speed up audio to 300% tempo:
  1879. @example
  1880. atempo=3
  1881. @end example
  1882. @item
  1883. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1884. @example
  1885. atempo=sqrt(3),atempo=sqrt(3)
  1886. @end example
  1887. @end itemize
  1888. @subsection Commands
  1889. This filter supports the following commands:
  1890. @table @option
  1891. @item tempo
  1892. Change filter tempo scale factor.
  1893. Syntax for the command is : "@var{tempo}"
  1894. @end table
  1895. @section atrim
  1896. Trim the input so that the output contains one continuous subpart of the input.
  1897. It accepts the following parameters:
  1898. @table @option
  1899. @item start
  1900. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1901. sample with the timestamp @var{start} will be the first sample in the output.
  1902. @item end
  1903. Specify time of the first audio sample that will be dropped, i.e. the
  1904. audio sample immediately preceding the one with the timestamp @var{end} will be
  1905. the last sample in the output.
  1906. @item start_pts
  1907. Same as @var{start}, except this option sets the start timestamp in samples
  1908. instead of seconds.
  1909. @item end_pts
  1910. Same as @var{end}, except this option sets the end timestamp in samples instead
  1911. of seconds.
  1912. @item duration
  1913. The maximum duration of the output in seconds.
  1914. @item start_sample
  1915. The number of the first sample that should be output.
  1916. @item end_sample
  1917. The number of the first sample that should be dropped.
  1918. @end table
  1919. @option{start}, @option{end}, and @option{duration} are expressed as time
  1920. duration specifications; see
  1921. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1922. Note that the first two sets of the start/end options and the @option{duration}
  1923. option look at the frame timestamp, while the _sample options simply count the
  1924. samples that pass through the filter. So start/end_pts and start/end_sample will
  1925. give different results when the timestamps are wrong, inexact or do not start at
  1926. zero. Also note that this filter does not modify the timestamps. If you wish
  1927. to have the output timestamps start at zero, insert the asetpts filter after the
  1928. atrim filter.
  1929. If multiple start or end options are set, this filter tries to be greedy and
  1930. keep all samples that match at least one of the specified constraints. To keep
  1931. only the part that matches all the constraints at once, chain multiple atrim
  1932. filters.
  1933. The defaults are such that all the input is kept. So it is possible to set e.g.
  1934. just the end values to keep everything before the specified time.
  1935. Examples:
  1936. @itemize
  1937. @item
  1938. Drop everything except the second minute of input:
  1939. @example
  1940. ffmpeg -i INPUT -af atrim=60:120
  1941. @end example
  1942. @item
  1943. Keep only the first 1000 samples:
  1944. @example
  1945. ffmpeg -i INPUT -af atrim=end_sample=1000
  1946. @end example
  1947. @end itemize
  1948. @section axcorrelate
  1949. Calculate normalized cross-correlation between two input audio streams.
  1950. Resulted samples are always between -1 and 1 inclusive.
  1951. If result is 1 it means two input samples are highly correlated in that selected segment.
  1952. Result 0 means they are not correlated at all.
  1953. If result is -1 it means two input samples are out of phase, which means they cancel each
  1954. other.
  1955. The filter accepts the following options:
  1956. @table @option
  1957. @item size
  1958. Set size of segment over which cross-correlation is calculated.
  1959. Default is 256. Allowed range is from 2 to 131072.
  1960. @item algo
  1961. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  1962. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  1963. are always zero and thus need much less calculations to make.
  1964. This is generally not true, but is valid for typical audio streams.
  1965. @end table
  1966. @subsection Examples
  1967. @itemize
  1968. @item
  1969. Calculate correlation between channels in stereo audio stream:
  1970. @example
  1971. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  1972. @end example
  1973. @end itemize
  1974. @section bandpass
  1975. Apply a two-pole Butterworth band-pass filter with central
  1976. frequency @var{frequency}, and (3dB-point) band-width width.
  1977. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1978. instead of the default: constant 0dB peak gain.
  1979. The filter roll off at 6dB per octave (20dB per decade).
  1980. The filter accepts the following options:
  1981. @table @option
  1982. @item frequency, f
  1983. Set the filter's central frequency. Default is @code{3000}.
  1984. @item csg
  1985. Constant skirt gain if set to 1. Defaults to 0.
  1986. @item width_type, t
  1987. Set method to specify band-width of filter.
  1988. @table @option
  1989. @item h
  1990. Hz
  1991. @item q
  1992. Q-Factor
  1993. @item o
  1994. octave
  1995. @item s
  1996. slope
  1997. @item k
  1998. kHz
  1999. @end table
  2000. @item width, w
  2001. Specify the band-width of a filter in width_type units.
  2002. @item mix, m
  2003. How much to use filtered signal in output. Default is 1.
  2004. Range is between 0 and 1.
  2005. @item channels, c
  2006. Specify which channels to filter, by default all available are filtered.
  2007. @item normalize, n
  2008. Normalize biquad coefficients, by default is disabled.
  2009. Enabling it will normalize magnitude response at DC to 0dB.
  2010. @end table
  2011. @subsection Commands
  2012. This filter supports the following commands:
  2013. @table @option
  2014. @item frequency, f
  2015. Change bandpass frequency.
  2016. Syntax for the command is : "@var{frequency}"
  2017. @item width_type, t
  2018. Change bandpass width_type.
  2019. Syntax for the command is : "@var{width_type}"
  2020. @item width, w
  2021. Change bandpass width.
  2022. Syntax for the command is : "@var{width}"
  2023. @item mix, m
  2024. Change bandpass mix.
  2025. Syntax for the command is : "@var{mix}"
  2026. @end table
  2027. @section bandreject
  2028. Apply a two-pole Butterworth band-reject filter with central
  2029. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2030. The filter roll off at 6dB per octave (20dB per decade).
  2031. The filter accepts the following options:
  2032. @table @option
  2033. @item frequency, f
  2034. Set the filter's central frequency. Default is @code{3000}.
  2035. @item width_type, t
  2036. Set method to specify band-width of filter.
  2037. @table @option
  2038. @item h
  2039. Hz
  2040. @item q
  2041. Q-Factor
  2042. @item o
  2043. octave
  2044. @item s
  2045. slope
  2046. @item k
  2047. kHz
  2048. @end table
  2049. @item width, w
  2050. Specify the band-width of a filter in width_type units.
  2051. @item mix, m
  2052. How much to use filtered signal in output. Default is 1.
  2053. Range is between 0 and 1.
  2054. @item channels, c
  2055. Specify which channels to filter, by default all available are filtered.
  2056. @item normalize, n
  2057. Normalize biquad coefficients, by default is disabled.
  2058. Enabling it will normalize magnitude response at DC to 0dB.
  2059. @end table
  2060. @subsection Commands
  2061. This filter supports the following commands:
  2062. @table @option
  2063. @item frequency, f
  2064. Change bandreject frequency.
  2065. Syntax for the command is : "@var{frequency}"
  2066. @item width_type, t
  2067. Change bandreject width_type.
  2068. Syntax for the command is : "@var{width_type}"
  2069. @item width, w
  2070. Change bandreject width.
  2071. Syntax for the command is : "@var{width}"
  2072. @item mix, m
  2073. Change bandreject mix.
  2074. Syntax for the command is : "@var{mix}"
  2075. @end table
  2076. @section bass, lowshelf
  2077. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2078. shelving filter with a response similar to that of a standard
  2079. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2080. The filter accepts the following options:
  2081. @table @option
  2082. @item gain, g
  2083. Give the gain at 0 Hz. Its useful range is about -20
  2084. (for a large cut) to +20 (for a large boost).
  2085. Beware of clipping when using a positive gain.
  2086. @item frequency, f
  2087. Set the filter's central frequency and so can be used
  2088. to extend or reduce the frequency range to be boosted or cut.
  2089. The default value is @code{100} Hz.
  2090. @item width_type, t
  2091. Set method to specify band-width of filter.
  2092. @table @option
  2093. @item h
  2094. Hz
  2095. @item q
  2096. Q-Factor
  2097. @item o
  2098. octave
  2099. @item s
  2100. slope
  2101. @item k
  2102. kHz
  2103. @end table
  2104. @item width, w
  2105. Determine how steep is the filter's shelf transition.
  2106. @item mix, m
  2107. How much to use filtered signal in output. Default is 1.
  2108. Range is between 0 and 1.
  2109. @item channels, c
  2110. Specify which channels to filter, by default all available are filtered.
  2111. @item normalize, n
  2112. Normalize biquad coefficients, by default is disabled.
  2113. Enabling it will normalize magnitude response at DC to 0dB.
  2114. @end table
  2115. @subsection Commands
  2116. This filter supports the following commands:
  2117. @table @option
  2118. @item frequency, f
  2119. Change bass frequency.
  2120. Syntax for the command is : "@var{frequency}"
  2121. @item width_type, t
  2122. Change bass width_type.
  2123. Syntax for the command is : "@var{width_type}"
  2124. @item width, w
  2125. Change bass width.
  2126. Syntax for the command is : "@var{width}"
  2127. @item gain, g
  2128. Change bass gain.
  2129. Syntax for the command is : "@var{gain}"
  2130. @item mix, m
  2131. Change bass mix.
  2132. Syntax for the command is : "@var{mix}"
  2133. @end table
  2134. @section biquad
  2135. Apply a biquad IIR filter with the given coefficients.
  2136. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2137. are the numerator and denominator coefficients respectively.
  2138. and @var{channels}, @var{c} specify which channels to filter, by default all
  2139. available are filtered.
  2140. @subsection Commands
  2141. This filter supports the following commands:
  2142. @table @option
  2143. @item a0
  2144. @item a1
  2145. @item a2
  2146. @item b0
  2147. @item b1
  2148. @item b2
  2149. Change biquad parameter.
  2150. Syntax for the command is : "@var{value}"
  2151. @item mix, m
  2152. How much to use filtered signal in output. Default is 1.
  2153. Range is between 0 and 1.
  2154. @item channels, c
  2155. Specify which channels to filter, by default all available are filtered.
  2156. @item normalize, n
  2157. Normalize biquad coefficients, by default is disabled.
  2158. Enabling it will normalize magnitude response at DC to 0dB.
  2159. @end table
  2160. @section bs2b
  2161. Bauer stereo to binaural transformation, which improves headphone listening of
  2162. stereo audio records.
  2163. To enable compilation of this filter you need to configure FFmpeg with
  2164. @code{--enable-libbs2b}.
  2165. It accepts the following parameters:
  2166. @table @option
  2167. @item profile
  2168. Pre-defined crossfeed level.
  2169. @table @option
  2170. @item default
  2171. Default level (fcut=700, feed=50).
  2172. @item cmoy
  2173. Chu Moy circuit (fcut=700, feed=60).
  2174. @item jmeier
  2175. Jan Meier circuit (fcut=650, feed=95).
  2176. @end table
  2177. @item fcut
  2178. Cut frequency (in Hz).
  2179. @item feed
  2180. Feed level (in Hz).
  2181. @end table
  2182. @section channelmap
  2183. Remap input channels to new locations.
  2184. It accepts the following parameters:
  2185. @table @option
  2186. @item map
  2187. Map channels from input to output. The argument is a '|'-separated list of
  2188. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2189. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2190. channel (e.g. FL for front left) or its index in the input channel layout.
  2191. @var{out_channel} is the name of the output channel or its index in the output
  2192. channel layout. If @var{out_channel} is not given then it is implicitly an
  2193. index, starting with zero and increasing by one for each mapping.
  2194. @item channel_layout
  2195. The channel layout of the output stream.
  2196. @end table
  2197. If no mapping is present, the filter will implicitly map input channels to
  2198. output channels, preserving indices.
  2199. @subsection Examples
  2200. @itemize
  2201. @item
  2202. For example, assuming a 5.1+downmix input MOV file,
  2203. @example
  2204. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2205. @end example
  2206. will create an output WAV file tagged as stereo from the downmix channels of
  2207. the input.
  2208. @item
  2209. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2210. @example
  2211. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2212. @end example
  2213. @end itemize
  2214. @section channelsplit
  2215. Split each channel from an input audio stream into a separate output stream.
  2216. It accepts the following parameters:
  2217. @table @option
  2218. @item channel_layout
  2219. The channel layout of the input stream. The default is "stereo".
  2220. @item channels
  2221. A channel layout describing the channels to be extracted as separate output streams
  2222. or "all" to extract each input channel as a separate stream. The default is "all".
  2223. Choosing channels not present in channel layout in the input will result in an error.
  2224. @end table
  2225. @subsection Examples
  2226. @itemize
  2227. @item
  2228. For example, assuming a stereo input MP3 file,
  2229. @example
  2230. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2231. @end example
  2232. will create an output Matroska file with two audio streams, one containing only
  2233. the left channel and the other the right channel.
  2234. @item
  2235. Split a 5.1 WAV file into per-channel files:
  2236. @example
  2237. ffmpeg -i in.wav -filter_complex
  2238. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2239. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2240. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2241. side_right.wav
  2242. @end example
  2243. @item
  2244. Extract only LFE from a 5.1 WAV file:
  2245. @example
  2246. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2247. -map '[LFE]' lfe.wav
  2248. @end example
  2249. @end itemize
  2250. @section chorus
  2251. Add a chorus effect to the audio.
  2252. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2253. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2254. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2255. The modulation depth defines the range the modulated delay is played before or after
  2256. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2257. sound tuned around the original one, like in a chorus where some vocals are slightly
  2258. off key.
  2259. It accepts the following parameters:
  2260. @table @option
  2261. @item in_gain
  2262. Set input gain. Default is 0.4.
  2263. @item out_gain
  2264. Set output gain. Default is 0.4.
  2265. @item delays
  2266. Set delays. A typical delay is around 40ms to 60ms.
  2267. @item decays
  2268. Set decays.
  2269. @item speeds
  2270. Set speeds.
  2271. @item depths
  2272. Set depths.
  2273. @end table
  2274. @subsection Examples
  2275. @itemize
  2276. @item
  2277. A single delay:
  2278. @example
  2279. chorus=0.7:0.9:55:0.4:0.25:2
  2280. @end example
  2281. @item
  2282. Two delays:
  2283. @example
  2284. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2285. @end example
  2286. @item
  2287. Fuller sounding chorus with three delays:
  2288. @example
  2289. 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
  2290. @end example
  2291. @end itemize
  2292. @section compand
  2293. Compress or expand the audio's dynamic range.
  2294. It accepts the following parameters:
  2295. @table @option
  2296. @item attacks
  2297. @item decays
  2298. A list of times in seconds for each channel over which the instantaneous level
  2299. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2300. increase of volume and @var{decays} refers to decrease of volume. For most
  2301. situations, the attack time (response to the audio getting louder) should be
  2302. shorter than the decay time, because the human ear is more sensitive to sudden
  2303. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2304. a typical value for decay is 0.8 seconds.
  2305. If specified number of attacks & decays is lower than number of channels, the last
  2306. set attack/decay will be used for all remaining channels.
  2307. @item points
  2308. A list of points for the transfer function, specified in dB relative to the
  2309. maximum possible signal amplitude. Each key points list must be defined using
  2310. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2311. @code{x0/y0 x1/y1 x2/y2 ....}
  2312. The input values must be in strictly increasing order but the transfer function
  2313. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2314. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2315. function are @code{-70/-70|-60/-20|1/0}.
  2316. @item soft-knee
  2317. Set the curve radius in dB for all joints. It defaults to 0.01.
  2318. @item gain
  2319. Set the additional gain in dB to be applied at all points on the transfer
  2320. function. This allows for easy adjustment of the overall gain.
  2321. It defaults to 0.
  2322. @item volume
  2323. Set an initial volume, in dB, to be assumed for each channel when filtering
  2324. starts. This permits the user to supply a nominal level initially, so that, for
  2325. example, a very large gain is not applied to initial signal levels before the
  2326. companding has begun to operate. A typical value for audio which is initially
  2327. quiet is -90 dB. It defaults to 0.
  2328. @item delay
  2329. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2330. delayed before being fed to the volume adjuster. Specifying a delay
  2331. approximately equal to the attack/decay times allows the filter to effectively
  2332. operate in predictive rather than reactive mode. It defaults to 0.
  2333. @end table
  2334. @subsection Examples
  2335. @itemize
  2336. @item
  2337. Make music with both quiet and loud passages suitable for listening to in a
  2338. noisy environment:
  2339. @example
  2340. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2341. @end example
  2342. Another example for audio with whisper and explosion parts:
  2343. @example
  2344. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2345. @end example
  2346. @item
  2347. A noise gate for when the noise is at a lower level than the signal:
  2348. @example
  2349. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2350. @end example
  2351. @item
  2352. Here is another noise gate, this time for when the noise is at a higher level
  2353. than the signal (making it, in some ways, similar to squelch):
  2354. @example
  2355. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2356. @end example
  2357. @item
  2358. 2:1 compression starting at -6dB:
  2359. @example
  2360. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2361. @end example
  2362. @item
  2363. 2:1 compression starting at -9dB:
  2364. @example
  2365. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2366. @end example
  2367. @item
  2368. 2:1 compression starting at -12dB:
  2369. @example
  2370. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2371. @end example
  2372. @item
  2373. 2:1 compression starting at -18dB:
  2374. @example
  2375. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2376. @end example
  2377. @item
  2378. 3:1 compression starting at -15dB:
  2379. @example
  2380. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2381. @end example
  2382. @item
  2383. Compressor/Gate:
  2384. @example
  2385. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2386. @end example
  2387. @item
  2388. Expander:
  2389. @example
  2390. 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
  2391. @end example
  2392. @item
  2393. Hard limiter at -6dB:
  2394. @example
  2395. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2396. @end example
  2397. @item
  2398. Hard limiter at -12dB:
  2399. @example
  2400. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2401. @end example
  2402. @item
  2403. Hard noise gate at -35 dB:
  2404. @example
  2405. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2406. @end example
  2407. @item
  2408. Soft limiter:
  2409. @example
  2410. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2411. @end example
  2412. @end itemize
  2413. @section compensationdelay
  2414. Compensation Delay Line is a metric based delay to compensate differing
  2415. positions of microphones or speakers.
  2416. For example, you have recorded guitar with two microphones placed in
  2417. different locations. Because the front of sound wave has fixed speed in
  2418. normal conditions, the phasing of microphones can vary and depends on
  2419. their location and interposition. The best sound mix can be achieved when
  2420. these microphones are in phase (synchronized). Note that a distance of
  2421. ~30 cm between microphones makes one microphone capture the signal in
  2422. antiphase to the other microphone. That makes the final mix sound moody.
  2423. This filter helps to solve phasing problems by adding different delays
  2424. to each microphone track and make them synchronized.
  2425. The best result can be reached when you take one track as base and
  2426. synchronize other tracks one by one with it.
  2427. Remember that synchronization/delay tolerance depends on sample rate, too.
  2428. Higher sample rates will give more tolerance.
  2429. The filter accepts the following parameters:
  2430. @table @option
  2431. @item mm
  2432. Set millimeters distance. This is compensation distance for fine tuning.
  2433. Default is 0.
  2434. @item cm
  2435. Set cm distance. This is compensation distance for tightening distance setup.
  2436. Default is 0.
  2437. @item m
  2438. Set meters distance. This is compensation distance for hard distance setup.
  2439. Default is 0.
  2440. @item dry
  2441. Set dry amount. Amount of unprocessed (dry) signal.
  2442. Default is 0.
  2443. @item wet
  2444. Set wet amount. Amount of processed (wet) signal.
  2445. Default is 1.
  2446. @item temp
  2447. Set temperature in degrees Celsius. This is the temperature of the environment.
  2448. Default is 20.
  2449. @end table
  2450. @section crossfeed
  2451. Apply headphone crossfeed filter.
  2452. Crossfeed is the process of blending the left and right channels of stereo
  2453. audio recording.
  2454. It is mainly used to reduce extreme stereo separation of low frequencies.
  2455. The intent is to produce more speaker like sound to the listener.
  2456. The filter accepts the following options:
  2457. @table @option
  2458. @item strength
  2459. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2460. This sets gain of low shelf filter for side part of stereo image.
  2461. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2462. @item range
  2463. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2464. This sets cut off frequency of low shelf filter. Default is cut off near
  2465. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2466. @item level_in
  2467. Set input gain. Default is 0.9.
  2468. @item level_out
  2469. Set output gain. Default is 1.
  2470. @end table
  2471. @section crystalizer
  2472. Simple algorithm to expand audio dynamic range.
  2473. The filter accepts the following options:
  2474. @table @option
  2475. @item i
  2476. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2477. (unchanged sound) to 10.0 (maximum effect).
  2478. @item c
  2479. Enable clipping. By default is enabled.
  2480. @end table
  2481. @subsection Commands
  2482. This filter supports the all above options as @ref{commands}.
  2483. @section dcshift
  2484. Apply a DC shift to the audio.
  2485. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2486. in the recording chain) from the audio. The effect of a DC offset is reduced
  2487. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2488. a signal has a DC offset.
  2489. @table @option
  2490. @item shift
  2491. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2492. the audio.
  2493. @item limitergain
  2494. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2495. used to prevent clipping.
  2496. @end table
  2497. @section deesser
  2498. Apply de-essing to the audio samples.
  2499. @table @option
  2500. @item i
  2501. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2502. Default is 0.
  2503. @item m
  2504. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2505. Default is 0.5.
  2506. @item f
  2507. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2508. Default is 0.5.
  2509. @item s
  2510. Set the output mode.
  2511. It accepts the following values:
  2512. @table @option
  2513. @item i
  2514. Pass input unchanged.
  2515. @item o
  2516. Pass ess filtered out.
  2517. @item e
  2518. Pass only ess.
  2519. Default value is @var{o}.
  2520. @end table
  2521. @end table
  2522. @section drmeter
  2523. Measure audio dynamic range.
  2524. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2525. is found in transition material. And anything less that 8 have very poor dynamics
  2526. and is very compressed.
  2527. The filter accepts the following options:
  2528. @table @option
  2529. @item length
  2530. Set window length in seconds used to split audio into segments of equal length.
  2531. Default is 3 seconds.
  2532. @end table
  2533. @section dynaudnorm
  2534. Dynamic Audio Normalizer.
  2535. This filter applies a certain amount of gain to the input audio in order
  2536. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2537. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2538. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2539. This allows for applying extra gain to the "quiet" sections of the audio
  2540. while avoiding distortions or clipping the "loud" sections. In other words:
  2541. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2542. sections, in the sense that the volume of each section is brought to the
  2543. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2544. this goal *without* applying "dynamic range compressing". It will retain 100%
  2545. of the dynamic range *within* each section of the audio file.
  2546. @table @option
  2547. @item framelen, f
  2548. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2549. Default is 500 milliseconds.
  2550. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2551. referred to as frames. This is required, because a peak magnitude has no
  2552. meaning for just a single sample value. Instead, we need to determine the
  2553. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2554. normalizer would simply use the peak magnitude of the complete file, the
  2555. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2556. frame. The length of a frame is specified in milliseconds. By default, the
  2557. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2558. been found to give good results with most files.
  2559. Note that the exact frame length, in number of samples, will be determined
  2560. automatically, based on the sampling rate of the individual input audio file.
  2561. @item gausssize, g
  2562. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2563. number. Default is 31.
  2564. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2565. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2566. is specified in frames, centered around the current frame. For the sake of
  2567. simplicity, this must be an odd number. Consequently, the default value of 31
  2568. takes into account the current frame, as well as the 15 preceding frames and
  2569. the 15 subsequent frames. Using a larger window results in a stronger
  2570. smoothing effect and thus in less gain variation, i.e. slower gain
  2571. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2572. effect and thus in more gain variation, i.e. faster gain adaptation.
  2573. In other words, the more you increase this value, the more the Dynamic Audio
  2574. Normalizer will behave like a "traditional" normalization filter. On the
  2575. contrary, the more you decrease this value, the more the Dynamic Audio
  2576. Normalizer will behave like a dynamic range compressor.
  2577. @item peak, p
  2578. Set the target peak value. This specifies the highest permissible magnitude
  2579. level for the normalized audio input. This filter will try to approach the
  2580. target peak magnitude as closely as possible, but at the same time it also
  2581. makes sure that the normalized signal will never exceed the peak magnitude.
  2582. A frame's maximum local gain factor is imposed directly by the target peak
  2583. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2584. It is not recommended to go above this value.
  2585. @item maxgain, m
  2586. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2587. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2588. factor for each input frame, i.e. the maximum gain factor that does not
  2589. result in clipping or distortion. The maximum gain factor is determined by
  2590. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2591. additionally bounds the frame's maximum gain factor by a predetermined
  2592. (global) maximum gain factor. This is done in order to avoid excessive gain
  2593. factors in "silent" or almost silent frames. By default, the maximum gain
  2594. factor is 10.0, For most inputs the default value should be sufficient and
  2595. it usually is not recommended to increase this value. Though, for input
  2596. with an extremely low overall volume level, it may be necessary to allow even
  2597. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2598. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2599. Instead, a "sigmoid" threshold function will be applied. This way, the
  2600. gain factors will smoothly approach the threshold value, but never exceed that
  2601. value.
  2602. @item targetrms, r
  2603. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2604. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2605. This means that the maximum local gain factor for each frame is defined
  2606. (only) by the frame's highest magnitude sample. This way, the samples can
  2607. be amplified as much as possible without exceeding the maximum signal
  2608. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2609. Normalizer can also take into account the frame's root mean square,
  2610. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2611. determine the power of a time-varying signal. It is therefore considered
  2612. that the RMS is a better approximation of the "perceived loudness" than
  2613. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2614. frames to a constant RMS value, a uniform "perceived loudness" can be
  2615. established. If a target RMS value has been specified, a frame's local gain
  2616. factor is defined as the factor that would result in exactly that RMS value.
  2617. Note, however, that the maximum local gain factor is still restricted by the
  2618. frame's highest magnitude sample, in order to prevent clipping.
  2619. @item coupling, n
  2620. Enable channels coupling. By default is enabled.
  2621. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2622. amount. This means the same gain factor will be applied to all channels, i.e.
  2623. the maximum possible gain factor is determined by the "loudest" channel.
  2624. However, in some recordings, it may happen that the volume of the different
  2625. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2626. In this case, this option can be used to disable the channel coupling. This way,
  2627. the gain factor will be determined independently for each channel, depending
  2628. only on the individual channel's highest magnitude sample. This allows for
  2629. harmonizing the volume of the different channels.
  2630. @item correctdc, c
  2631. Enable DC bias correction. By default is disabled.
  2632. An audio signal (in the time domain) is a sequence of sample values.
  2633. In the Dynamic Audio Normalizer these sample values are represented in the
  2634. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2635. audio signal, or "waveform", should be centered around the zero point.
  2636. That means if we calculate the mean value of all samples in a file, or in a
  2637. single frame, then the result should be 0.0 or at least very close to that
  2638. value. If, however, there is a significant deviation of the mean value from
  2639. 0.0, in either positive or negative direction, this is referred to as a
  2640. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2641. Audio Normalizer provides optional DC bias correction.
  2642. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2643. the mean value, or "DC correction" offset, of each input frame and subtract
  2644. that value from all of the frame's sample values which ensures those samples
  2645. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2646. boundaries, the DC correction offset values will be interpolated smoothly
  2647. between neighbouring frames.
  2648. @item altboundary, b
  2649. Enable alternative boundary mode. By default is disabled.
  2650. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2651. around each frame. This includes the preceding frames as well as the
  2652. subsequent frames. However, for the "boundary" frames, located at the very
  2653. beginning and at the very end of the audio file, not all neighbouring
  2654. frames are available. In particular, for the first few frames in the audio
  2655. file, the preceding frames are not known. And, similarly, for the last few
  2656. frames in the audio file, the subsequent frames are not known. Thus, the
  2657. question arises which gain factors should be assumed for the missing frames
  2658. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2659. to deal with this situation. The default boundary mode assumes a gain factor
  2660. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2661. "fade out" at the beginning and at the end of the input, respectively.
  2662. @item compress, s
  2663. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2664. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2665. compression. This means that signal peaks will not be pruned and thus the
  2666. full dynamic range will be retained within each local neighbourhood. However,
  2667. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2668. normalization algorithm with a more "traditional" compression.
  2669. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2670. (thresholding) function. If (and only if) the compression feature is enabled,
  2671. all input frames will be processed by a soft knee thresholding function prior
  2672. to the actual normalization process. Put simply, the thresholding function is
  2673. going to prune all samples whose magnitude exceeds a certain threshold value.
  2674. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2675. value. Instead, the threshold value will be adjusted for each individual
  2676. frame.
  2677. In general, smaller parameters result in stronger compression, and vice versa.
  2678. Values below 3.0 are not recommended, because audible distortion may appear.
  2679. @item threshold, t
  2680. Set the target threshold value. This specifies the lowest permissible
  2681. magnitude level for the audio input which will be normalized.
  2682. If input frame volume is above this value frame will be normalized.
  2683. Otherwise frame may not be normalized at all. The default value is set
  2684. to 0, which means all input frames will be normalized.
  2685. This option is mostly useful if digital noise is not wanted to be amplified.
  2686. @end table
  2687. @subsection Commands
  2688. This filter supports the all above options as @ref{commands}.
  2689. @section earwax
  2690. Make audio easier to listen to on headphones.
  2691. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2692. so that when listened to on headphones the stereo image is moved from
  2693. inside your head (standard for headphones) to outside and in front of
  2694. the listener (standard for speakers).
  2695. Ported from SoX.
  2696. @section equalizer
  2697. Apply a two-pole peaking equalisation (EQ) filter. With this
  2698. filter, the signal-level at and around a selected frequency can
  2699. be increased or decreased, whilst (unlike bandpass and bandreject
  2700. filters) that at all other frequencies is unchanged.
  2701. In order to produce complex equalisation curves, this filter can
  2702. be given several times, each with a different central frequency.
  2703. The filter accepts the following options:
  2704. @table @option
  2705. @item frequency, f
  2706. Set the filter's central frequency in Hz.
  2707. @item width_type, t
  2708. Set method to specify band-width of filter.
  2709. @table @option
  2710. @item h
  2711. Hz
  2712. @item q
  2713. Q-Factor
  2714. @item o
  2715. octave
  2716. @item s
  2717. slope
  2718. @item k
  2719. kHz
  2720. @end table
  2721. @item width, w
  2722. Specify the band-width of a filter in width_type units.
  2723. @item gain, g
  2724. Set the required gain or attenuation in dB.
  2725. Beware of clipping when using a positive gain.
  2726. @item mix, m
  2727. How much to use filtered signal in output. Default is 1.
  2728. Range is between 0 and 1.
  2729. @item channels, c
  2730. Specify which channels to filter, by default all available are filtered.
  2731. @item normalize, n
  2732. Normalize biquad coefficients, by default is disabled.
  2733. Enabling it will normalize magnitude response at DC to 0dB.
  2734. @end table
  2735. @subsection Examples
  2736. @itemize
  2737. @item
  2738. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2739. @example
  2740. equalizer=f=1000:t=h:width=200:g=-10
  2741. @end example
  2742. @item
  2743. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2744. @example
  2745. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2746. @end example
  2747. @end itemize
  2748. @subsection Commands
  2749. This filter supports the following commands:
  2750. @table @option
  2751. @item frequency, f
  2752. Change equalizer frequency.
  2753. Syntax for the command is : "@var{frequency}"
  2754. @item width_type, t
  2755. Change equalizer width_type.
  2756. Syntax for the command is : "@var{width_type}"
  2757. @item width, w
  2758. Change equalizer width.
  2759. Syntax for the command is : "@var{width}"
  2760. @item gain, g
  2761. Change equalizer gain.
  2762. Syntax for the command is : "@var{gain}"
  2763. @item mix, m
  2764. Change equalizer mix.
  2765. Syntax for the command is : "@var{mix}"
  2766. @end table
  2767. @section extrastereo
  2768. Linearly increases the difference between left and right channels which
  2769. adds some sort of "live" effect to playback.
  2770. The filter accepts the following options:
  2771. @table @option
  2772. @item m
  2773. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2774. (average of both channels), with 1.0 sound will be unchanged, with
  2775. -1.0 left and right channels will be swapped.
  2776. @item c
  2777. Enable clipping. By default is enabled.
  2778. @end table
  2779. @subsection Commands
  2780. This filter supports the all above options as @ref{commands}.
  2781. @section firequalizer
  2782. Apply FIR Equalization using arbitrary frequency response.
  2783. The filter accepts the following option:
  2784. @table @option
  2785. @item gain
  2786. Set gain curve equation (in dB). The expression can contain variables:
  2787. @table @option
  2788. @item f
  2789. the evaluated frequency
  2790. @item sr
  2791. sample rate
  2792. @item ch
  2793. channel number, set to 0 when multichannels evaluation is disabled
  2794. @item chid
  2795. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2796. multichannels evaluation is disabled
  2797. @item chs
  2798. number of channels
  2799. @item chlayout
  2800. channel_layout, see libavutil/channel_layout.h
  2801. @end table
  2802. and functions:
  2803. @table @option
  2804. @item gain_interpolate(f)
  2805. interpolate gain on frequency f based on gain_entry
  2806. @item cubic_interpolate(f)
  2807. same as gain_interpolate, but smoother
  2808. @end table
  2809. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2810. @item gain_entry
  2811. Set gain entry for gain_interpolate function. The expression can
  2812. contain functions:
  2813. @table @option
  2814. @item entry(f, g)
  2815. store gain entry at frequency f with value g
  2816. @end table
  2817. This option is also available as command.
  2818. @item delay
  2819. Set filter delay in seconds. Higher value means more accurate.
  2820. Default is @code{0.01}.
  2821. @item accuracy
  2822. Set filter accuracy in Hz. Lower value means more accurate.
  2823. Default is @code{5}.
  2824. @item wfunc
  2825. Set window function. Acceptable values are:
  2826. @table @option
  2827. @item rectangular
  2828. rectangular window, useful when gain curve is already smooth
  2829. @item hann
  2830. hann window (default)
  2831. @item hamming
  2832. hamming window
  2833. @item blackman
  2834. blackman window
  2835. @item nuttall3
  2836. 3-terms continuous 1st derivative nuttall window
  2837. @item mnuttall3
  2838. minimum 3-terms discontinuous nuttall window
  2839. @item nuttall
  2840. 4-terms continuous 1st derivative nuttall window
  2841. @item bnuttall
  2842. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2843. @item bharris
  2844. blackman-harris window
  2845. @item tukey
  2846. tukey window
  2847. @end table
  2848. @item fixed
  2849. If enabled, use fixed number of audio samples. This improves speed when
  2850. filtering with large delay. Default is disabled.
  2851. @item multi
  2852. Enable multichannels evaluation on gain. Default is disabled.
  2853. @item zero_phase
  2854. Enable zero phase mode by subtracting timestamp to compensate delay.
  2855. Default is disabled.
  2856. @item scale
  2857. Set scale used by gain. Acceptable values are:
  2858. @table @option
  2859. @item linlin
  2860. linear frequency, linear gain
  2861. @item linlog
  2862. linear frequency, logarithmic (in dB) gain (default)
  2863. @item loglin
  2864. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2865. @item loglog
  2866. logarithmic frequency, logarithmic gain
  2867. @end table
  2868. @item dumpfile
  2869. Set file for dumping, suitable for gnuplot.
  2870. @item dumpscale
  2871. Set scale for dumpfile. Acceptable values are same with scale option.
  2872. Default is linlog.
  2873. @item fft2
  2874. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2875. Default is disabled.
  2876. @item min_phase
  2877. Enable minimum phase impulse response. Default is disabled.
  2878. @end table
  2879. @subsection Examples
  2880. @itemize
  2881. @item
  2882. lowpass at 1000 Hz:
  2883. @example
  2884. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2885. @end example
  2886. @item
  2887. lowpass at 1000 Hz with gain_entry:
  2888. @example
  2889. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2890. @end example
  2891. @item
  2892. custom equalization:
  2893. @example
  2894. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2895. @end example
  2896. @item
  2897. higher delay with zero phase to compensate delay:
  2898. @example
  2899. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2900. @end example
  2901. @item
  2902. lowpass on left channel, highpass on right channel:
  2903. @example
  2904. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2905. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2906. @end example
  2907. @end itemize
  2908. @section flanger
  2909. Apply a flanging effect to the audio.
  2910. The filter accepts the following options:
  2911. @table @option
  2912. @item delay
  2913. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2914. @item depth
  2915. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2916. @item regen
  2917. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2918. Default value is 0.
  2919. @item width
  2920. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2921. Default value is 71.
  2922. @item speed
  2923. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2924. @item shape
  2925. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2926. Default value is @var{sinusoidal}.
  2927. @item phase
  2928. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2929. Default value is 25.
  2930. @item interp
  2931. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2932. Default is @var{linear}.
  2933. @end table
  2934. @section haas
  2935. Apply Haas effect to audio.
  2936. Note that this makes most sense to apply on mono signals.
  2937. With this filter applied to mono signals it give some directionality and
  2938. stretches its stereo image.
  2939. The filter accepts the following options:
  2940. @table @option
  2941. @item level_in
  2942. Set input level. By default is @var{1}, or 0dB
  2943. @item level_out
  2944. Set output level. By default is @var{1}, or 0dB.
  2945. @item side_gain
  2946. Set gain applied to side part of signal. By default is @var{1}.
  2947. @item middle_source
  2948. Set kind of middle source. Can be one of the following:
  2949. @table @samp
  2950. @item left
  2951. Pick left channel.
  2952. @item right
  2953. Pick right channel.
  2954. @item mid
  2955. Pick middle part signal of stereo image.
  2956. @item side
  2957. Pick side part signal of stereo image.
  2958. @end table
  2959. @item middle_phase
  2960. Change middle phase. By default is disabled.
  2961. @item left_delay
  2962. Set left channel delay. By default is @var{2.05} milliseconds.
  2963. @item left_balance
  2964. Set left channel balance. By default is @var{-1}.
  2965. @item left_gain
  2966. Set left channel gain. By default is @var{1}.
  2967. @item left_phase
  2968. Change left phase. By default is disabled.
  2969. @item right_delay
  2970. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2971. @item right_balance
  2972. Set right channel balance. By default is @var{1}.
  2973. @item right_gain
  2974. Set right channel gain. By default is @var{1}.
  2975. @item right_phase
  2976. Change right phase. By default is enabled.
  2977. @end table
  2978. @section hdcd
  2979. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2980. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2981. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2982. of HDCD, and detects the Transient Filter flag.
  2983. @example
  2984. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2985. @end example
  2986. When using the filter with wav, note the default encoding for wav is 16-bit,
  2987. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2988. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2989. @example
  2990. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2991. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2992. @end example
  2993. The filter accepts the following options:
  2994. @table @option
  2995. @item disable_autoconvert
  2996. Disable any automatic format conversion or resampling in the filter graph.
  2997. @item process_stereo
  2998. Process the stereo channels together. If target_gain does not match between
  2999. channels, consider it invalid and use the last valid target_gain.
  3000. @item cdt_ms
  3001. Set the code detect timer period in ms.
  3002. @item force_pe
  3003. Always extend peaks above -3dBFS even if PE isn't signaled.
  3004. @item analyze_mode
  3005. Replace audio with a solid tone and adjust the amplitude to signal some
  3006. specific aspect of the decoding process. The output file can be loaded in
  3007. an audio editor alongside the original to aid analysis.
  3008. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3009. Modes are:
  3010. @table @samp
  3011. @item 0, off
  3012. Disabled
  3013. @item 1, lle
  3014. Gain adjustment level at each sample
  3015. @item 2, pe
  3016. Samples where peak extend occurs
  3017. @item 3, cdt
  3018. Samples where the code detect timer is active
  3019. @item 4, tgm
  3020. Samples where the target gain does not match between channels
  3021. @end table
  3022. @end table
  3023. @section headphone
  3024. Apply head-related transfer functions (HRTFs) to create virtual
  3025. loudspeakers around the user for binaural listening via headphones.
  3026. The HRIRs are provided via additional streams, for each channel
  3027. one stereo input stream is needed.
  3028. The filter accepts the following options:
  3029. @table @option
  3030. @item map
  3031. Set mapping of input streams for convolution.
  3032. The argument is a '|'-separated list of channel names in order as they
  3033. are given as additional stream inputs for filter.
  3034. This also specify number of input streams. Number of input streams
  3035. must be not less than number of channels in first stream plus one.
  3036. @item gain
  3037. Set gain applied to audio. Value is in dB. Default is 0.
  3038. @item type
  3039. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3040. processing audio in time domain which is slow.
  3041. @var{freq} is processing audio in frequency domain which is fast.
  3042. Default is @var{freq}.
  3043. @item lfe
  3044. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3045. @item size
  3046. Set size of frame in number of samples which will be processed at once.
  3047. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3048. @item hrir
  3049. Set format of hrir stream.
  3050. Default value is @var{stereo}. Alternative value is @var{multich}.
  3051. If value is set to @var{stereo}, number of additional streams should
  3052. be greater or equal to number of input channels in first input stream.
  3053. Also each additional stream should have stereo number of channels.
  3054. If value is set to @var{multich}, number of additional streams should
  3055. be exactly one. Also number of input channels of additional stream
  3056. should be equal or greater than twice number of channels of first input
  3057. stream.
  3058. @end table
  3059. @subsection Examples
  3060. @itemize
  3061. @item
  3062. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3063. each amovie filter use stereo file with IR coefficients as input.
  3064. The files give coefficients for each position of virtual loudspeaker:
  3065. @example
  3066. ffmpeg -i input.wav
  3067. -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"
  3068. output.wav
  3069. @end example
  3070. @item
  3071. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3072. but now in @var{multich} @var{hrir} format.
  3073. @example
  3074. 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"
  3075. output.wav
  3076. @end example
  3077. @end itemize
  3078. @section highpass
  3079. Apply a high-pass filter with 3dB point frequency.
  3080. The filter can be either single-pole, or double-pole (the default).
  3081. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3082. The filter accepts the following options:
  3083. @table @option
  3084. @item frequency, f
  3085. Set frequency in Hz. Default is 3000.
  3086. @item poles, p
  3087. Set number of poles. Default is 2.
  3088. @item width_type, t
  3089. Set method to specify band-width of filter.
  3090. @table @option
  3091. @item h
  3092. Hz
  3093. @item q
  3094. Q-Factor
  3095. @item o
  3096. octave
  3097. @item s
  3098. slope
  3099. @item k
  3100. kHz
  3101. @end table
  3102. @item width, w
  3103. Specify the band-width of a filter in width_type units.
  3104. Applies only to double-pole filter.
  3105. The default is 0.707q and gives a Butterworth response.
  3106. @item mix, m
  3107. How much to use filtered signal in output. Default is 1.
  3108. Range is between 0 and 1.
  3109. @item channels, c
  3110. Specify which channels to filter, by default all available are filtered.
  3111. @item normalize, n
  3112. Normalize biquad coefficients, by default is disabled.
  3113. Enabling it will normalize magnitude response at DC to 0dB.
  3114. @end table
  3115. @subsection Commands
  3116. This filter supports the following commands:
  3117. @table @option
  3118. @item frequency, f
  3119. Change highpass frequency.
  3120. Syntax for the command is : "@var{frequency}"
  3121. @item width_type, t
  3122. Change highpass width_type.
  3123. Syntax for the command is : "@var{width_type}"
  3124. @item width, w
  3125. Change highpass width.
  3126. Syntax for the command is : "@var{width}"
  3127. @item mix, m
  3128. Change highpass mix.
  3129. Syntax for the command is : "@var{mix}"
  3130. @end table
  3131. @section join
  3132. Join multiple input streams into one multi-channel stream.
  3133. It accepts the following parameters:
  3134. @table @option
  3135. @item inputs
  3136. The number of input streams. It defaults to 2.
  3137. @item channel_layout
  3138. The desired output channel layout. It defaults to stereo.
  3139. @item map
  3140. Map channels from inputs to output. The argument is a '|'-separated list of
  3141. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3142. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3143. can be either the name of the input channel (e.g. FL for front left) or its
  3144. index in the specified input stream. @var{out_channel} is the name of the output
  3145. channel.
  3146. @end table
  3147. The filter will attempt to guess the mappings when they are not specified
  3148. explicitly. It does so by first trying to find an unused matching input channel
  3149. and if that fails it picks the first unused input channel.
  3150. Join 3 inputs (with properly set channel layouts):
  3151. @example
  3152. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3153. @end example
  3154. Build a 5.1 output from 6 single-channel streams:
  3155. @example
  3156. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3157. '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'
  3158. out
  3159. @end example
  3160. @section ladspa
  3161. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3162. To enable compilation of this filter you need to configure FFmpeg with
  3163. @code{--enable-ladspa}.
  3164. @table @option
  3165. @item file, f
  3166. Specifies the name of LADSPA plugin library to load. If the environment
  3167. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3168. each one of the directories specified by the colon separated list in
  3169. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3170. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3171. @file{/usr/lib/ladspa/}.
  3172. @item plugin, p
  3173. Specifies the plugin within the library. Some libraries contain only
  3174. one plugin, but others contain many of them. If this is not set filter
  3175. will list all available plugins within the specified library.
  3176. @item controls, c
  3177. Set the '|' separated list of controls which are zero or more floating point
  3178. values that determine the behavior of the loaded plugin (for example delay,
  3179. threshold or gain).
  3180. Controls need to be defined using the following syntax:
  3181. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3182. @var{valuei} is the value set on the @var{i}-th control.
  3183. Alternatively they can be also defined using the following syntax:
  3184. @var{value0}|@var{value1}|@var{value2}|..., where
  3185. @var{valuei} is the value set on the @var{i}-th control.
  3186. If @option{controls} is set to @code{help}, all available controls and
  3187. their valid ranges are printed.
  3188. @item sample_rate, s
  3189. Specify the sample rate, default to 44100. Only used if plugin have
  3190. zero inputs.
  3191. @item nb_samples, n
  3192. Set the number of samples per channel per each output frame, default
  3193. is 1024. Only used if plugin have zero inputs.
  3194. @item duration, d
  3195. Set the minimum duration of the sourced audio. See
  3196. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3197. for the accepted syntax.
  3198. Note that the resulting duration may be greater than the specified duration,
  3199. as the generated audio is always cut at the end of a complete frame.
  3200. If not specified, or the expressed duration is negative, the audio is
  3201. supposed to be generated forever.
  3202. Only used if plugin have zero inputs.
  3203. @end table
  3204. @subsection Examples
  3205. @itemize
  3206. @item
  3207. List all available plugins within amp (LADSPA example plugin) library:
  3208. @example
  3209. ladspa=file=amp
  3210. @end example
  3211. @item
  3212. List all available controls and their valid ranges for @code{vcf_notch}
  3213. plugin from @code{VCF} library:
  3214. @example
  3215. ladspa=f=vcf:p=vcf_notch:c=help
  3216. @end example
  3217. @item
  3218. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3219. plugin library:
  3220. @example
  3221. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3222. @end example
  3223. @item
  3224. Add reverberation to the audio using TAP-plugins
  3225. (Tom's Audio Processing plugins):
  3226. @example
  3227. ladspa=file=tap_reverb:tap_reverb
  3228. @end example
  3229. @item
  3230. Generate white noise, with 0.2 amplitude:
  3231. @example
  3232. ladspa=file=cmt:noise_source_white:c=c0=.2
  3233. @end example
  3234. @item
  3235. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3236. @code{C* Audio Plugin Suite} (CAPS) library:
  3237. @example
  3238. ladspa=file=caps:Click:c=c1=20'
  3239. @end example
  3240. @item
  3241. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3242. @example
  3243. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3244. @end example
  3245. @item
  3246. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3247. @code{SWH Plugins} collection:
  3248. @example
  3249. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3250. @end example
  3251. @item
  3252. Attenuate low frequencies using Multiband EQ from Steve Harris
  3253. @code{SWH Plugins} collection:
  3254. @example
  3255. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3256. @end example
  3257. @item
  3258. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3259. (CAPS) library:
  3260. @example
  3261. ladspa=caps:Narrower
  3262. @end example
  3263. @item
  3264. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3265. @example
  3266. ladspa=caps:White:.2
  3267. @end example
  3268. @item
  3269. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3270. @example
  3271. ladspa=caps:Fractal:c=c1=1
  3272. @end example
  3273. @item
  3274. Dynamic volume normalization using @code{VLevel} plugin:
  3275. @example
  3276. ladspa=vlevel-ladspa:vlevel_mono
  3277. @end example
  3278. @end itemize
  3279. @subsection Commands
  3280. This filter supports the following commands:
  3281. @table @option
  3282. @item cN
  3283. Modify the @var{N}-th control value.
  3284. If the specified value is not valid, it is ignored and prior one is kept.
  3285. @end table
  3286. @section loudnorm
  3287. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3288. Support for both single pass (livestreams, files) and double pass (files) modes.
  3289. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3290. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3291. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3292. The filter accepts the following options:
  3293. @table @option
  3294. @item I, i
  3295. Set integrated loudness target.
  3296. Range is -70.0 - -5.0. Default value is -24.0.
  3297. @item LRA, lra
  3298. Set loudness range target.
  3299. Range is 1.0 - 20.0. Default value is 7.0.
  3300. @item TP, tp
  3301. Set maximum true peak.
  3302. Range is -9.0 - +0.0. Default value is -2.0.
  3303. @item measured_I, measured_i
  3304. Measured IL of input file.
  3305. Range is -99.0 - +0.0.
  3306. @item measured_LRA, measured_lra
  3307. Measured LRA of input file.
  3308. Range is 0.0 - 99.0.
  3309. @item measured_TP, measured_tp
  3310. Measured true peak of input file.
  3311. Range is -99.0 - +99.0.
  3312. @item measured_thresh
  3313. Measured threshold of input file.
  3314. Range is -99.0 - +0.0.
  3315. @item offset
  3316. Set offset gain. Gain is applied before the true-peak limiter.
  3317. Range is -99.0 - +99.0. Default is +0.0.
  3318. @item linear
  3319. Normalize by linearly scaling the source audio.
  3320. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3321. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3322. be lower than source LRA and the change in integrated loudness shouldn't
  3323. result in a true peak which exceeds the target TP. If any of these
  3324. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3325. Options are @code{true} or @code{false}. Default is @code{true}.
  3326. @item dual_mono
  3327. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3328. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3329. If set to @code{true}, this option will compensate for this effect.
  3330. Multi-channel input files are not affected by this option.
  3331. Options are true or false. Default is false.
  3332. @item print_format
  3333. Set print format for stats. Options are summary, json, or none.
  3334. Default value is none.
  3335. @end table
  3336. @section lowpass
  3337. Apply a low-pass filter with 3dB point frequency.
  3338. The filter can be either single-pole or double-pole (the default).
  3339. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3340. The filter accepts the following options:
  3341. @table @option
  3342. @item frequency, f
  3343. Set frequency in Hz. Default is 500.
  3344. @item poles, p
  3345. Set number of poles. Default is 2.
  3346. @item width_type, t
  3347. Set method to specify band-width of filter.
  3348. @table @option
  3349. @item h
  3350. Hz
  3351. @item q
  3352. Q-Factor
  3353. @item o
  3354. octave
  3355. @item s
  3356. slope
  3357. @item k
  3358. kHz
  3359. @end table
  3360. @item width, w
  3361. Specify the band-width of a filter in width_type units.
  3362. Applies only to double-pole filter.
  3363. The default is 0.707q and gives a Butterworth response.
  3364. @item mix, m
  3365. How much to use filtered signal in output. Default is 1.
  3366. Range is between 0 and 1.
  3367. @item channels, c
  3368. Specify which channels to filter, by default all available are filtered.
  3369. @item normalize, n
  3370. Normalize biquad coefficients, by default is disabled.
  3371. Enabling it will normalize magnitude response at DC to 0dB.
  3372. @end table
  3373. @subsection Examples
  3374. @itemize
  3375. @item
  3376. Lowpass only LFE channel, it LFE is not present it does nothing:
  3377. @example
  3378. lowpass=c=LFE
  3379. @end example
  3380. @end itemize
  3381. @subsection Commands
  3382. This filter supports the following commands:
  3383. @table @option
  3384. @item frequency, f
  3385. Change lowpass frequency.
  3386. Syntax for the command is : "@var{frequency}"
  3387. @item width_type, t
  3388. Change lowpass width_type.
  3389. Syntax for the command is : "@var{width_type}"
  3390. @item width, w
  3391. Change lowpass width.
  3392. Syntax for the command is : "@var{width}"
  3393. @item mix, m
  3394. Change lowpass mix.
  3395. Syntax for the command is : "@var{mix}"
  3396. @end table
  3397. @section lv2
  3398. Load a LV2 (LADSPA Version 2) plugin.
  3399. To enable compilation of this filter you need to configure FFmpeg with
  3400. @code{--enable-lv2}.
  3401. @table @option
  3402. @item plugin, p
  3403. Specifies the plugin URI. You may need to escape ':'.
  3404. @item controls, c
  3405. Set the '|' separated list of controls which are zero or more floating point
  3406. values that determine the behavior of the loaded plugin (for example delay,
  3407. threshold or gain).
  3408. If @option{controls} is set to @code{help}, all available controls and
  3409. their valid ranges are printed.
  3410. @item sample_rate, s
  3411. Specify the sample rate, default to 44100. Only used if plugin have
  3412. zero inputs.
  3413. @item nb_samples, n
  3414. Set the number of samples per channel per each output frame, default
  3415. is 1024. Only used if plugin have zero inputs.
  3416. @item duration, d
  3417. Set the minimum duration of the sourced audio. See
  3418. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3419. for the accepted syntax.
  3420. Note that the resulting duration may be greater than the specified duration,
  3421. as the generated audio is always cut at the end of a complete frame.
  3422. If not specified, or the expressed duration is negative, the audio is
  3423. supposed to be generated forever.
  3424. Only used if plugin have zero inputs.
  3425. @end table
  3426. @subsection Examples
  3427. @itemize
  3428. @item
  3429. Apply bass enhancer plugin from Calf:
  3430. @example
  3431. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3432. @end example
  3433. @item
  3434. Apply vinyl plugin from Calf:
  3435. @example
  3436. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3437. @end example
  3438. @item
  3439. Apply bit crusher plugin from ArtyFX:
  3440. @example
  3441. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3442. @end example
  3443. @end itemize
  3444. @section mcompand
  3445. Multiband Compress or expand the audio's dynamic range.
  3446. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3447. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3448. response when absent compander action.
  3449. It accepts the following parameters:
  3450. @table @option
  3451. @item args
  3452. This option syntax is:
  3453. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3454. For explanation of each item refer to compand filter documentation.
  3455. @end table
  3456. @anchor{pan}
  3457. @section pan
  3458. Mix channels with specific gain levels. The filter accepts the output
  3459. channel layout followed by a set of channels definitions.
  3460. This filter is also designed to efficiently remap the channels of an audio
  3461. stream.
  3462. The filter accepts parameters of the form:
  3463. "@var{l}|@var{outdef}|@var{outdef}|..."
  3464. @table @option
  3465. @item l
  3466. output channel layout or number of channels
  3467. @item outdef
  3468. output channel specification, of the form:
  3469. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3470. @item out_name
  3471. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3472. number (c0, c1, etc.)
  3473. @item gain
  3474. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3475. @item in_name
  3476. input channel to use, see out_name for details; it is not possible to mix
  3477. named and numbered input channels
  3478. @end table
  3479. If the `=' in a channel specification is replaced by `<', then the gains for
  3480. that specification will be renormalized so that the total is 1, thus
  3481. avoiding clipping noise.
  3482. @subsection Mixing examples
  3483. For example, if you want to down-mix from stereo to mono, but with a bigger
  3484. factor for the left channel:
  3485. @example
  3486. pan=1c|c0=0.9*c0+0.1*c1
  3487. @end example
  3488. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3489. 7-channels surround:
  3490. @example
  3491. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3492. @end example
  3493. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3494. that should be preferred (see "-ac" option) unless you have very specific
  3495. needs.
  3496. @subsection Remapping examples
  3497. The channel remapping will be effective if, and only if:
  3498. @itemize
  3499. @item gain coefficients are zeroes or ones,
  3500. @item only one input per channel output,
  3501. @end itemize
  3502. If all these conditions are satisfied, the filter will notify the user ("Pure
  3503. channel mapping detected"), and use an optimized and lossless method to do the
  3504. remapping.
  3505. For example, if you have a 5.1 source and want a stereo audio stream by
  3506. dropping the extra channels:
  3507. @example
  3508. pan="stereo| c0=FL | c1=FR"
  3509. @end example
  3510. Given the same source, you can also switch front left and front right channels
  3511. and keep the input channel layout:
  3512. @example
  3513. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3514. @end example
  3515. If the input is a stereo audio stream, you can mute the front left channel (and
  3516. still keep the stereo channel layout) with:
  3517. @example
  3518. pan="stereo|c1=c1"
  3519. @end example
  3520. Still with a stereo audio stream input, you can copy the right channel in both
  3521. front left and right:
  3522. @example
  3523. pan="stereo| c0=FR | c1=FR"
  3524. @end example
  3525. @section replaygain
  3526. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3527. outputs it unchanged.
  3528. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3529. @section resample
  3530. Convert the audio sample format, sample rate and channel layout. It is
  3531. not meant to be used directly.
  3532. @section rubberband
  3533. Apply time-stretching and pitch-shifting with librubberband.
  3534. To enable compilation of this filter, you need to configure FFmpeg with
  3535. @code{--enable-librubberband}.
  3536. The filter accepts the following options:
  3537. @table @option
  3538. @item tempo
  3539. Set tempo scale factor.
  3540. @item pitch
  3541. Set pitch scale factor.
  3542. @item transients
  3543. Set transients detector.
  3544. Possible values are:
  3545. @table @var
  3546. @item crisp
  3547. @item mixed
  3548. @item smooth
  3549. @end table
  3550. @item detector
  3551. Set detector.
  3552. Possible values are:
  3553. @table @var
  3554. @item compound
  3555. @item percussive
  3556. @item soft
  3557. @end table
  3558. @item phase
  3559. Set phase.
  3560. Possible values are:
  3561. @table @var
  3562. @item laminar
  3563. @item independent
  3564. @end table
  3565. @item window
  3566. Set processing window size.
  3567. Possible values are:
  3568. @table @var
  3569. @item standard
  3570. @item short
  3571. @item long
  3572. @end table
  3573. @item smoothing
  3574. Set smoothing.
  3575. Possible values are:
  3576. @table @var
  3577. @item off
  3578. @item on
  3579. @end table
  3580. @item formant
  3581. Enable formant preservation when shift pitching.
  3582. Possible values are:
  3583. @table @var
  3584. @item shifted
  3585. @item preserved
  3586. @end table
  3587. @item pitchq
  3588. Set pitch quality.
  3589. Possible values are:
  3590. @table @var
  3591. @item quality
  3592. @item speed
  3593. @item consistency
  3594. @end table
  3595. @item channels
  3596. Set channels.
  3597. Possible values are:
  3598. @table @var
  3599. @item apart
  3600. @item together
  3601. @end table
  3602. @end table
  3603. @subsection Commands
  3604. This filter supports the following commands:
  3605. @table @option
  3606. @item tempo
  3607. Change filter tempo scale factor.
  3608. Syntax for the command is : "@var{tempo}"
  3609. @item pitch
  3610. Change filter pitch scale factor.
  3611. Syntax for the command is : "@var{pitch}"
  3612. @end table
  3613. @section sidechaincompress
  3614. This filter acts like normal compressor but has the ability to compress
  3615. detected signal using second input signal.
  3616. It needs two input streams and returns one output stream.
  3617. First input stream will be processed depending on second stream signal.
  3618. The filtered signal then can be filtered with other filters in later stages of
  3619. processing. See @ref{pan} and @ref{amerge} filter.
  3620. The filter accepts the following options:
  3621. @table @option
  3622. @item level_in
  3623. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3624. @item mode
  3625. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3626. Default is @code{downward}.
  3627. @item threshold
  3628. If a signal of second stream raises above this level it will affect the gain
  3629. reduction of first stream.
  3630. By default is 0.125. Range is between 0.00097563 and 1.
  3631. @item ratio
  3632. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3633. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3634. Default is 2. Range is between 1 and 20.
  3635. @item attack
  3636. Amount of milliseconds the signal has to rise above the threshold before gain
  3637. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3638. @item release
  3639. Amount of milliseconds the signal has to fall below the threshold before
  3640. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3641. @item makeup
  3642. Set the amount by how much signal will be amplified after processing.
  3643. Default is 1. Range is from 1 to 64.
  3644. @item knee
  3645. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3646. Default is 2.82843. Range is between 1 and 8.
  3647. @item link
  3648. Choose if the @code{average} level between all channels of side-chain stream
  3649. or the louder(@code{maximum}) channel of side-chain stream affects the
  3650. reduction. Default is @code{average}.
  3651. @item detection
  3652. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3653. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3654. @item level_sc
  3655. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3656. @item mix
  3657. How much to use compressed signal in output. Default is 1.
  3658. Range is between 0 and 1.
  3659. @end table
  3660. @subsection Commands
  3661. This filter supports the all above options as @ref{commands}.
  3662. @subsection Examples
  3663. @itemize
  3664. @item
  3665. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3666. depending on the signal of 2nd input and later compressed signal to be
  3667. merged with 2nd input:
  3668. @example
  3669. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3670. @end example
  3671. @end itemize
  3672. @section sidechaingate
  3673. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3674. filter the detected signal before sending it to the gain reduction stage.
  3675. Normally a gate uses the full range signal to detect a level above the
  3676. threshold.
  3677. For example: If you cut all lower frequencies from your sidechain signal
  3678. the gate will decrease the volume of your track only if not enough highs
  3679. appear. With this technique you are able to reduce the resonation of a
  3680. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3681. guitar.
  3682. It needs two input streams and returns one output stream.
  3683. First input stream will be processed depending on second stream signal.
  3684. The filter accepts the following options:
  3685. @table @option
  3686. @item level_in
  3687. Set input level before filtering.
  3688. Default is 1. Allowed range is from 0.015625 to 64.
  3689. @item mode
  3690. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3691. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3692. will be amplified, expanding dynamic range in upward direction.
  3693. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3694. @item range
  3695. Set the level of gain reduction when the signal is below the threshold.
  3696. Default is 0.06125. Allowed range is from 0 to 1.
  3697. Setting this to 0 disables reduction and then filter behaves like expander.
  3698. @item threshold
  3699. If a signal rises above this level the gain reduction is released.
  3700. Default is 0.125. Allowed range is from 0 to 1.
  3701. @item ratio
  3702. Set a ratio about which the signal is reduced.
  3703. Default is 2. Allowed range is from 1 to 9000.
  3704. @item attack
  3705. Amount of milliseconds the signal has to rise above the threshold before gain
  3706. reduction stops.
  3707. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3708. @item release
  3709. Amount of milliseconds the signal has to fall below the threshold before the
  3710. reduction is increased again. Default is 250 milliseconds.
  3711. Allowed range is from 0.01 to 9000.
  3712. @item makeup
  3713. Set amount of amplification of signal after processing.
  3714. Default is 1. Allowed range is from 1 to 64.
  3715. @item knee
  3716. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3717. Default is 2.828427125. Allowed range is from 1 to 8.
  3718. @item detection
  3719. Choose if exact signal should be taken for detection or an RMS like one.
  3720. Default is rms. Can be peak or rms.
  3721. @item link
  3722. Choose if the average level between all channels or the louder channel affects
  3723. the reduction.
  3724. Default is average. Can be average or maximum.
  3725. @item level_sc
  3726. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3727. @end table
  3728. @section silencedetect
  3729. Detect silence in an audio stream.
  3730. This filter logs a message when it detects that the input audio volume is less
  3731. or equal to a noise tolerance value for a duration greater or equal to the
  3732. minimum detected noise duration.
  3733. The printed times and duration are expressed in seconds. The
  3734. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3735. is set on the first frame whose timestamp equals or exceeds the detection
  3736. duration and it contains the timestamp of the first frame of the silence.
  3737. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3738. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3739. keys are set on the first frame after the silence. If @option{mono} is
  3740. enabled, and each channel is evaluated separately, the @code{.X}
  3741. suffixed keys are used, and @code{X} corresponds to the channel number.
  3742. The filter accepts the following options:
  3743. @table @option
  3744. @item noise, n
  3745. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3746. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3747. @item duration, d
  3748. Set silence duration until notification (default is 2 seconds). See
  3749. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3750. for the accepted syntax.
  3751. @item mono, m
  3752. Process each channel separately, instead of combined. By default is disabled.
  3753. @end table
  3754. @subsection Examples
  3755. @itemize
  3756. @item
  3757. Detect 5 seconds of silence with -50dB noise tolerance:
  3758. @example
  3759. silencedetect=n=-50dB:d=5
  3760. @end example
  3761. @item
  3762. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3763. tolerance in @file{silence.mp3}:
  3764. @example
  3765. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3766. @end example
  3767. @end itemize
  3768. @section silenceremove
  3769. Remove silence from the beginning, middle or end of the audio.
  3770. The filter accepts the following options:
  3771. @table @option
  3772. @item start_periods
  3773. This value is used to indicate if audio should be trimmed at beginning of
  3774. the audio. A value of zero indicates no silence should be trimmed from the
  3775. beginning. When specifying a non-zero value, it trims audio up until it
  3776. finds non-silence. Normally, when trimming silence from beginning of audio
  3777. the @var{start_periods} will be @code{1} but it can be increased to higher
  3778. values to trim all audio up to specific count of non-silence periods.
  3779. Default value is @code{0}.
  3780. @item start_duration
  3781. Specify the amount of time that non-silence must be detected before it stops
  3782. trimming audio. By increasing the duration, bursts of noises can be treated
  3783. as silence and trimmed off. Default value is @code{0}.
  3784. @item start_threshold
  3785. This indicates what sample value should be treated as silence. For digital
  3786. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3787. you may wish to increase the value to account for background noise.
  3788. Can be specified in dB (in case "dB" is appended to the specified value)
  3789. or amplitude ratio. Default value is @code{0}.
  3790. @item start_silence
  3791. Specify max duration of silence at beginning that will be kept after
  3792. trimming. Default is 0, which is equal to trimming all samples detected
  3793. as silence.
  3794. @item start_mode
  3795. Specify mode of detection of silence end in start of multi-channel audio.
  3796. Can be @var{any} or @var{all}. Default is @var{any}.
  3797. With @var{any}, any sample that is detected as non-silence will cause
  3798. stopped trimming of silence.
  3799. With @var{all}, only if all channels are detected as non-silence will cause
  3800. stopped trimming of silence.
  3801. @item stop_periods
  3802. Set the count for trimming silence from the end of audio.
  3803. To remove silence from the middle of a file, specify a @var{stop_periods}
  3804. that is negative. This value is then treated as a positive value and is
  3805. used to indicate the effect should restart processing as specified by
  3806. @var{start_periods}, making it suitable for removing periods of silence
  3807. in the middle of the audio.
  3808. Default value is @code{0}.
  3809. @item stop_duration
  3810. Specify a duration of silence that must exist before audio is not copied any
  3811. more. By specifying a higher duration, silence that is wanted can be left in
  3812. the audio.
  3813. Default value is @code{0}.
  3814. @item stop_threshold
  3815. This is the same as @option{start_threshold} but for trimming silence from
  3816. the end of audio.
  3817. Can be specified in dB (in case "dB" is appended to the specified value)
  3818. or amplitude ratio. Default value is @code{0}.
  3819. @item stop_silence
  3820. Specify max duration of silence at end that will be kept after
  3821. trimming. Default is 0, which is equal to trimming all samples detected
  3822. as silence.
  3823. @item stop_mode
  3824. Specify mode of detection of silence start in end of multi-channel audio.
  3825. Can be @var{any} or @var{all}. Default is @var{any}.
  3826. With @var{any}, any sample that is detected as non-silence will cause
  3827. stopped trimming of silence.
  3828. With @var{all}, only if all channels are detected as non-silence will cause
  3829. stopped trimming of silence.
  3830. @item detection
  3831. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3832. and works better with digital silence which is exactly 0.
  3833. Default value is @code{rms}.
  3834. @item window
  3835. Set duration in number of seconds used to calculate size of window in number
  3836. of samples for detecting silence.
  3837. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3838. @end table
  3839. @subsection Examples
  3840. @itemize
  3841. @item
  3842. The following example shows how this filter can be used to start a recording
  3843. that does not contain the delay at the start which usually occurs between
  3844. pressing the record button and the start of the performance:
  3845. @example
  3846. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3847. @end example
  3848. @item
  3849. Trim all silence encountered from beginning to end where there is more than 1
  3850. second of silence in audio:
  3851. @example
  3852. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3853. @end example
  3854. @item
  3855. Trim all digital silence samples, using peak detection, from beginning to end
  3856. where there is more than 0 samples of digital silence in audio and digital
  3857. silence is detected in all channels at same positions in stream:
  3858. @example
  3859. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3860. @end example
  3861. @end itemize
  3862. @section sofalizer
  3863. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3864. loudspeakers around the user for binaural listening via headphones (audio
  3865. formats up to 9 channels supported).
  3866. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3867. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3868. Austrian Academy of Sciences.
  3869. To enable compilation of this filter you need to configure FFmpeg with
  3870. @code{--enable-libmysofa}.
  3871. The filter accepts the following options:
  3872. @table @option
  3873. @item sofa
  3874. Set the SOFA file used for rendering.
  3875. @item gain
  3876. Set gain applied to audio. Value is in dB. Default is 0.
  3877. @item rotation
  3878. Set rotation of virtual loudspeakers in deg. Default is 0.
  3879. @item elevation
  3880. Set elevation of virtual speakers in deg. Default is 0.
  3881. @item radius
  3882. Set distance in meters between loudspeakers and the listener with near-field
  3883. HRTFs. Default is 1.
  3884. @item type
  3885. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3886. processing audio in time domain which is slow.
  3887. @var{freq} is processing audio in frequency domain which is fast.
  3888. Default is @var{freq}.
  3889. @item speakers
  3890. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3891. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3892. Each virtual loudspeaker is described with short channel name following with
  3893. azimuth and elevation in degrees.
  3894. Each virtual loudspeaker description is separated by '|'.
  3895. For example to override front left and front right channel positions use:
  3896. 'speakers=FL 45 15|FR 345 15'.
  3897. Descriptions with unrecognised channel names are ignored.
  3898. @item lfegain
  3899. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3900. @item framesize
  3901. Set custom frame size in number of samples. Default is 1024.
  3902. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3903. is set to @var{freq}.
  3904. @item normalize
  3905. Should all IRs be normalized upon importing SOFA file.
  3906. By default is enabled.
  3907. @item interpolate
  3908. Should nearest IRs be interpolated with neighbor IRs if exact position
  3909. does not match. By default is disabled.
  3910. @item minphase
  3911. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3912. @item anglestep
  3913. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3914. @item radstep
  3915. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3916. @end table
  3917. @subsection Examples
  3918. @itemize
  3919. @item
  3920. Using ClubFritz6 sofa file:
  3921. @example
  3922. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3923. @end example
  3924. @item
  3925. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3926. @example
  3927. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3928. @end example
  3929. @item
  3930. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3931. and also with custom gain:
  3932. @example
  3933. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3934. @end example
  3935. @end itemize
  3936. @section stereotools
  3937. This filter has some handy utilities to manage stereo signals, for converting
  3938. M/S stereo recordings to L/R signal while having control over the parameters
  3939. or spreading the stereo image of master track.
  3940. The filter accepts the following options:
  3941. @table @option
  3942. @item level_in
  3943. Set input level before filtering for both channels. Defaults is 1.
  3944. Allowed range is from 0.015625 to 64.
  3945. @item level_out
  3946. Set output level after filtering for both channels. Defaults is 1.
  3947. Allowed range is from 0.015625 to 64.
  3948. @item balance_in
  3949. Set input balance between both channels. Default is 0.
  3950. Allowed range is from -1 to 1.
  3951. @item balance_out
  3952. Set output balance between both channels. Default is 0.
  3953. Allowed range is from -1 to 1.
  3954. @item softclip
  3955. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3956. clipping. Disabled by default.
  3957. @item mutel
  3958. Mute the left channel. Disabled by default.
  3959. @item muter
  3960. Mute the right channel. Disabled by default.
  3961. @item phasel
  3962. Change the phase of the left channel. Disabled by default.
  3963. @item phaser
  3964. Change the phase of the right channel. Disabled by default.
  3965. @item mode
  3966. Set stereo mode. Available values are:
  3967. @table @samp
  3968. @item lr>lr
  3969. Left/Right to Left/Right, this is default.
  3970. @item lr>ms
  3971. Left/Right to Mid/Side.
  3972. @item ms>lr
  3973. Mid/Side to Left/Right.
  3974. @item lr>ll
  3975. Left/Right to Left/Left.
  3976. @item lr>rr
  3977. Left/Right to Right/Right.
  3978. @item lr>l+r
  3979. Left/Right to Left + Right.
  3980. @item lr>rl
  3981. Left/Right to Right/Left.
  3982. @item ms>ll
  3983. Mid/Side to Left/Left.
  3984. @item ms>rr
  3985. Mid/Side to Right/Right.
  3986. @end table
  3987. @item slev
  3988. Set level of side signal. Default is 1.
  3989. Allowed range is from 0.015625 to 64.
  3990. @item sbal
  3991. Set balance of side signal. Default is 0.
  3992. Allowed range is from -1 to 1.
  3993. @item mlev
  3994. Set level of the middle signal. Default is 1.
  3995. Allowed range is from 0.015625 to 64.
  3996. @item mpan
  3997. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3998. @item base
  3999. Set stereo base between mono and inversed channels. Default is 0.
  4000. Allowed range is from -1 to 1.
  4001. @item delay
  4002. Set delay in milliseconds how much to delay left from right channel and
  4003. vice versa. Default is 0. Allowed range is from -20 to 20.
  4004. @item sclevel
  4005. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4006. @item phase
  4007. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4008. @item bmode_in, bmode_out
  4009. Set balance mode for balance_in/balance_out option.
  4010. Can be one of the following:
  4011. @table @samp
  4012. @item balance
  4013. Classic balance mode. Attenuate one channel at time.
  4014. Gain is raised up to 1.
  4015. @item amplitude
  4016. Similar as classic mode above but gain is raised up to 2.
  4017. @item power
  4018. Equal power distribution, from -6dB to +6dB range.
  4019. @end table
  4020. @end table
  4021. @subsection Examples
  4022. @itemize
  4023. @item
  4024. Apply karaoke like effect:
  4025. @example
  4026. stereotools=mlev=0.015625
  4027. @end example
  4028. @item
  4029. Convert M/S signal to L/R:
  4030. @example
  4031. "stereotools=mode=ms>lr"
  4032. @end example
  4033. @end itemize
  4034. @section stereowiden
  4035. This filter enhance the stereo effect by suppressing signal common to both
  4036. channels and by delaying the signal of left into right and vice versa,
  4037. thereby widening the stereo effect.
  4038. The filter accepts the following options:
  4039. @table @option
  4040. @item delay
  4041. Time in milliseconds of the delay of left signal into right and vice versa.
  4042. Default is 20 milliseconds.
  4043. @item feedback
  4044. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4045. effect of left signal in right output and vice versa which gives widening
  4046. effect. Default is 0.3.
  4047. @item crossfeed
  4048. Cross feed of left into right with inverted phase. This helps in suppressing
  4049. the mono. If the value is 1 it will cancel all the signal common to both
  4050. channels. Default is 0.3.
  4051. @item drymix
  4052. Set level of input signal of original channel. Default is 0.8.
  4053. @end table
  4054. @subsection Commands
  4055. This filter supports the all above options except @code{delay} as @ref{commands}.
  4056. @section superequalizer
  4057. Apply 18 band equalizer.
  4058. The filter accepts the following options:
  4059. @table @option
  4060. @item 1b
  4061. Set 65Hz band gain.
  4062. @item 2b
  4063. Set 92Hz band gain.
  4064. @item 3b
  4065. Set 131Hz band gain.
  4066. @item 4b
  4067. Set 185Hz band gain.
  4068. @item 5b
  4069. Set 262Hz band gain.
  4070. @item 6b
  4071. Set 370Hz band gain.
  4072. @item 7b
  4073. Set 523Hz band gain.
  4074. @item 8b
  4075. Set 740Hz band gain.
  4076. @item 9b
  4077. Set 1047Hz band gain.
  4078. @item 10b
  4079. Set 1480Hz band gain.
  4080. @item 11b
  4081. Set 2093Hz band gain.
  4082. @item 12b
  4083. Set 2960Hz band gain.
  4084. @item 13b
  4085. Set 4186Hz band gain.
  4086. @item 14b
  4087. Set 5920Hz band gain.
  4088. @item 15b
  4089. Set 8372Hz band gain.
  4090. @item 16b
  4091. Set 11840Hz band gain.
  4092. @item 17b
  4093. Set 16744Hz band gain.
  4094. @item 18b
  4095. Set 20000Hz band gain.
  4096. @end table
  4097. @section surround
  4098. Apply audio surround upmix filter.
  4099. This filter allows to produce multichannel output from audio stream.
  4100. The filter accepts the following options:
  4101. @table @option
  4102. @item chl_out
  4103. Set output channel layout. By default, this is @var{5.1}.
  4104. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4105. for the required syntax.
  4106. @item chl_in
  4107. Set input channel layout. By default, this is @var{stereo}.
  4108. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4109. for the required syntax.
  4110. @item level_in
  4111. Set input volume level. By default, this is @var{1}.
  4112. @item level_out
  4113. Set output volume level. By default, this is @var{1}.
  4114. @item lfe
  4115. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4116. @item lfe_low
  4117. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4118. @item lfe_high
  4119. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4120. @item lfe_mode
  4121. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4122. In @var{add} mode, LFE channel is created from input audio and added to output.
  4123. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4124. also all non-LFE output channels are subtracted with output LFE channel.
  4125. @item angle
  4126. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4127. Default is @var{90}.
  4128. @item fc_in
  4129. Set front center input volume. By default, this is @var{1}.
  4130. @item fc_out
  4131. Set front center output volume. By default, this is @var{1}.
  4132. @item fl_in
  4133. Set front left input volume. By default, this is @var{1}.
  4134. @item fl_out
  4135. Set front left output volume. By default, this is @var{1}.
  4136. @item fr_in
  4137. Set front right input volume. By default, this is @var{1}.
  4138. @item fr_out
  4139. Set front right output volume. By default, this is @var{1}.
  4140. @item sl_in
  4141. Set side left input volume. By default, this is @var{1}.
  4142. @item sl_out
  4143. Set side left output volume. By default, this is @var{1}.
  4144. @item sr_in
  4145. Set side right input volume. By default, this is @var{1}.
  4146. @item sr_out
  4147. Set side right output volume. By default, this is @var{1}.
  4148. @item bl_in
  4149. Set back left input volume. By default, this is @var{1}.
  4150. @item bl_out
  4151. Set back left output volume. By default, this is @var{1}.
  4152. @item br_in
  4153. Set back right input volume. By default, this is @var{1}.
  4154. @item br_out
  4155. Set back right output volume. By default, this is @var{1}.
  4156. @item bc_in
  4157. Set back center input volume. By default, this is @var{1}.
  4158. @item bc_out
  4159. Set back center output volume. By default, this is @var{1}.
  4160. @item lfe_in
  4161. Set LFE input volume. By default, this is @var{1}.
  4162. @item lfe_out
  4163. Set LFE output volume. By default, this is @var{1}.
  4164. @item allx
  4165. Set spread usage of stereo image across X axis for all channels.
  4166. @item ally
  4167. Set spread usage of stereo image across Y axis for all channels.
  4168. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4169. Set spread usage of stereo image across X axis for each channel.
  4170. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4171. Set spread usage of stereo image across Y axis for each channel.
  4172. @item win_size
  4173. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4174. @item win_func
  4175. Set window function.
  4176. It accepts the following values:
  4177. @table @samp
  4178. @item rect
  4179. @item bartlett
  4180. @item hann, hanning
  4181. @item hamming
  4182. @item blackman
  4183. @item welch
  4184. @item flattop
  4185. @item bharris
  4186. @item bnuttall
  4187. @item bhann
  4188. @item sine
  4189. @item nuttall
  4190. @item lanczos
  4191. @item gauss
  4192. @item tukey
  4193. @item dolph
  4194. @item cauchy
  4195. @item parzen
  4196. @item poisson
  4197. @item bohman
  4198. @end table
  4199. Default is @code{hann}.
  4200. @item overlap
  4201. Set window overlap. If set to 1, the recommended overlap for selected
  4202. window function will be picked. Default is @code{0.5}.
  4203. @end table
  4204. @section treble, highshelf
  4205. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4206. shelving filter with a response similar to that of a standard
  4207. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4208. The filter accepts the following options:
  4209. @table @option
  4210. @item gain, g
  4211. Give the gain at whichever is the lower of ~22 kHz and the
  4212. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4213. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4214. @item frequency, f
  4215. Set the filter's central frequency and so can be used
  4216. to extend or reduce the frequency range to be boosted or cut.
  4217. The default value is @code{3000} Hz.
  4218. @item width_type, t
  4219. Set method to specify band-width of filter.
  4220. @table @option
  4221. @item h
  4222. Hz
  4223. @item q
  4224. Q-Factor
  4225. @item o
  4226. octave
  4227. @item s
  4228. slope
  4229. @item k
  4230. kHz
  4231. @end table
  4232. @item width, w
  4233. Determine how steep is the filter's shelf transition.
  4234. @item mix, m
  4235. How much to use filtered signal in output. Default is 1.
  4236. Range is between 0 and 1.
  4237. @item channels, c
  4238. Specify which channels to filter, by default all available are filtered.
  4239. @item normalize, n
  4240. Normalize biquad coefficients, by default is disabled.
  4241. Enabling it will normalize magnitude response at DC to 0dB.
  4242. @end table
  4243. @subsection Commands
  4244. This filter supports the following commands:
  4245. @table @option
  4246. @item frequency, f
  4247. Change treble frequency.
  4248. Syntax for the command is : "@var{frequency}"
  4249. @item width_type, t
  4250. Change treble width_type.
  4251. Syntax for the command is : "@var{width_type}"
  4252. @item width, w
  4253. Change treble width.
  4254. Syntax for the command is : "@var{width}"
  4255. @item gain, g
  4256. Change treble gain.
  4257. Syntax for the command is : "@var{gain}"
  4258. @item mix, m
  4259. Change treble mix.
  4260. Syntax for the command is : "@var{mix}"
  4261. @end table
  4262. @section tremolo
  4263. Sinusoidal amplitude modulation.
  4264. The filter accepts the following options:
  4265. @table @option
  4266. @item f
  4267. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4268. (20 Hz or lower) will result in a tremolo effect.
  4269. This filter may also be used as a ring modulator by specifying
  4270. a modulation frequency higher than 20 Hz.
  4271. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4272. @item d
  4273. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4274. Default value is 0.5.
  4275. @end table
  4276. @section vibrato
  4277. Sinusoidal phase modulation.
  4278. The filter accepts the following options:
  4279. @table @option
  4280. @item f
  4281. Modulation frequency in Hertz.
  4282. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4283. @item d
  4284. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4285. Default value is 0.5.
  4286. @end table
  4287. @section volume
  4288. Adjust the input audio volume.
  4289. It accepts the following parameters:
  4290. @table @option
  4291. @item volume
  4292. Set audio volume expression.
  4293. Output values are clipped to the maximum value.
  4294. The output audio volume is given by the relation:
  4295. @example
  4296. @var{output_volume} = @var{volume} * @var{input_volume}
  4297. @end example
  4298. The default value for @var{volume} is "1.0".
  4299. @item precision
  4300. This parameter represents the mathematical precision.
  4301. It determines which input sample formats will be allowed, which affects the
  4302. precision of the volume scaling.
  4303. @table @option
  4304. @item fixed
  4305. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4306. @item float
  4307. 32-bit floating-point; this limits input sample format to FLT. (default)
  4308. @item double
  4309. 64-bit floating-point; this limits input sample format to DBL.
  4310. @end table
  4311. @item replaygain
  4312. Choose the behaviour on encountering ReplayGain side data in input frames.
  4313. @table @option
  4314. @item drop
  4315. Remove ReplayGain side data, ignoring its contents (the default).
  4316. @item ignore
  4317. Ignore ReplayGain side data, but leave it in the frame.
  4318. @item track
  4319. Prefer the track gain, if present.
  4320. @item album
  4321. Prefer the album gain, if present.
  4322. @end table
  4323. @item replaygain_preamp
  4324. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4325. Default value for @var{replaygain_preamp} is 0.0.
  4326. @item replaygain_noclip
  4327. Prevent clipping by limiting the gain applied.
  4328. Default value for @var{replaygain_noclip} is 1.
  4329. @item eval
  4330. Set when the volume expression is evaluated.
  4331. It accepts the following values:
  4332. @table @samp
  4333. @item once
  4334. only evaluate expression once during the filter initialization, or
  4335. when the @samp{volume} command is sent
  4336. @item frame
  4337. evaluate expression for each incoming frame
  4338. @end table
  4339. Default value is @samp{once}.
  4340. @end table
  4341. The volume expression can contain the following parameters.
  4342. @table @option
  4343. @item n
  4344. frame number (starting at zero)
  4345. @item nb_channels
  4346. number of channels
  4347. @item nb_consumed_samples
  4348. number of samples consumed by the filter
  4349. @item nb_samples
  4350. number of samples in the current frame
  4351. @item pos
  4352. original frame position in the file
  4353. @item pts
  4354. frame PTS
  4355. @item sample_rate
  4356. sample rate
  4357. @item startpts
  4358. PTS at start of stream
  4359. @item startt
  4360. time at start of stream
  4361. @item t
  4362. frame time
  4363. @item tb
  4364. timestamp timebase
  4365. @item volume
  4366. last set volume value
  4367. @end table
  4368. Note that when @option{eval} is set to @samp{once} only the
  4369. @var{sample_rate} and @var{tb} variables are available, all other
  4370. variables will evaluate to NAN.
  4371. @subsection Commands
  4372. This filter supports the following commands:
  4373. @table @option
  4374. @item volume
  4375. Modify the volume expression.
  4376. The command accepts the same syntax of the corresponding option.
  4377. If the specified expression is not valid, it is kept at its current
  4378. value.
  4379. @end table
  4380. @subsection Examples
  4381. @itemize
  4382. @item
  4383. Halve the input audio volume:
  4384. @example
  4385. volume=volume=0.5
  4386. volume=volume=1/2
  4387. volume=volume=-6.0206dB
  4388. @end example
  4389. In all the above example the named key for @option{volume} can be
  4390. omitted, for example like in:
  4391. @example
  4392. volume=0.5
  4393. @end example
  4394. @item
  4395. Increase input audio power by 6 decibels using fixed-point precision:
  4396. @example
  4397. volume=volume=6dB:precision=fixed
  4398. @end example
  4399. @item
  4400. Fade volume after time 10 with an annihilation period of 5 seconds:
  4401. @example
  4402. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4403. @end example
  4404. @end itemize
  4405. @section volumedetect
  4406. Detect the volume of the input video.
  4407. The filter has no parameters. The input is not modified. Statistics about
  4408. the volume will be printed in the log when the input stream end is reached.
  4409. In particular it will show the mean volume (root mean square), maximum
  4410. volume (on a per-sample basis), and the beginning of a histogram of the
  4411. registered volume values (from the maximum value to a cumulated 1/1000 of
  4412. the samples).
  4413. All volumes are in decibels relative to the maximum PCM value.
  4414. @subsection Examples
  4415. Here is an excerpt of the output:
  4416. @example
  4417. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4418. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4419. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4420. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4421. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4422. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4423. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4424. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4425. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4426. @end example
  4427. It means that:
  4428. @itemize
  4429. @item
  4430. The mean square energy is approximately -27 dB, or 10^-2.7.
  4431. @item
  4432. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4433. @item
  4434. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4435. @end itemize
  4436. In other words, raising the volume by +4 dB does not cause any clipping,
  4437. raising it by +5 dB causes clipping for 6 samples, etc.
  4438. @c man end AUDIO FILTERS
  4439. @chapter Audio Sources
  4440. @c man begin AUDIO SOURCES
  4441. Below is a description of the currently available audio sources.
  4442. @section abuffer
  4443. Buffer audio frames, and make them available to the filter chain.
  4444. This source is mainly intended for a programmatic use, in particular
  4445. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4446. It accepts the following parameters:
  4447. @table @option
  4448. @item time_base
  4449. The timebase which will be used for timestamps of submitted frames. It must be
  4450. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4451. @item sample_rate
  4452. The sample rate of the incoming audio buffers.
  4453. @item sample_fmt
  4454. The sample format of the incoming audio buffers.
  4455. Either a sample format name or its corresponding integer representation from
  4456. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4457. @item channel_layout
  4458. The channel layout of the incoming audio buffers.
  4459. Either a channel layout name from channel_layout_map in
  4460. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4461. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4462. @item channels
  4463. The number of channels of the incoming audio buffers.
  4464. If both @var{channels} and @var{channel_layout} are specified, then they
  4465. must be consistent.
  4466. @end table
  4467. @subsection Examples
  4468. @example
  4469. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4470. @end example
  4471. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4472. Since the sample format with name "s16p" corresponds to the number
  4473. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4474. equivalent to:
  4475. @example
  4476. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4477. @end example
  4478. @section aevalsrc
  4479. Generate an audio signal specified by an expression.
  4480. This source accepts in input one or more expressions (one for each
  4481. channel), which are evaluated and used to generate a corresponding
  4482. audio signal.
  4483. This source accepts the following options:
  4484. @table @option
  4485. @item exprs
  4486. Set the '|'-separated expressions list for each separate channel. In case the
  4487. @option{channel_layout} option is not specified, the selected channel layout
  4488. depends on the number of provided expressions. Otherwise the last
  4489. specified expression is applied to the remaining output channels.
  4490. @item channel_layout, c
  4491. Set the channel layout. The number of channels in the specified layout
  4492. must be equal to the number of specified expressions.
  4493. @item duration, d
  4494. Set the minimum duration of the sourced audio. See
  4495. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4496. for the accepted syntax.
  4497. Note that the resulting duration may be greater than the specified
  4498. duration, as the generated audio is always cut at the end of a
  4499. complete frame.
  4500. If not specified, or the expressed duration is negative, the audio is
  4501. supposed to be generated forever.
  4502. @item nb_samples, n
  4503. Set the number of samples per channel per each output frame,
  4504. default to 1024.
  4505. @item sample_rate, s
  4506. Specify the sample rate, default to 44100.
  4507. @end table
  4508. Each expression in @var{exprs} can contain the following constants:
  4509. @table @option
  4510. @item n
  4511. number of the evaluated sample, starting from 0
  4512. @item t
  4513. time of the evaluated sample expressed in seconds, starting from 0
  4514. @item s
  4515. sample rate
  4516. @end table
  4517. @subsection Examples
  4518. @itemize
  4519. @item
  4520. Generate silence:
  4521. @example
  4522. aevalsrc=0
  4523. @end example
  4524. @item
  4525. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4526. 8000 Hz:
  4527. @example
  4528. aevalsrc="sin(440*2*PI*t):s=8000"
  4529. @end example
  4530. @item
  4531. Generate a two channels signal, specify the channel layout (Front
  4532. Center + Back Center) explicitly:
  4533. @example
  4534. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4535. @end example
  4536. @item
  4537. Generate white noise:
  4538. @example
  4539. aevalsrc="-2+random(0)"
  4540. @end example
  4541. @item
  4542. Generate an amplitude modulated signal:
  4543. @example
  4544. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4545. @end example
  4546. @item
  4547. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4548. @example
  4549. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4550. @end example
  4551. @end itemize
  4552. @section afirsrc
  4553. Generate a FIR coefficients using frequency sampling method.
  4554. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4555. The filter accepts the following options:
  4556. @table @option
  4557. @item taps, t
  4558. Set number of filter coefficents in output audio stream.
  4559. Default value is 1025.
  4560. @item frequency, f
  4561. Set frequency points from where magnitude and phase are set.
  4562. This must be in non decreasing order, and first element must be 0, while last element
  4563. must be 1. Elements are separated by white spaces.
  4564. @item magnitude, m
  4565. Set magnitude value for every frequency point set by @option{frequency}.
  4566. Number of values must be same as number of frequency points.
  4567. Values are separated by white spaces.
  4568. @item phase, p
  4569. Set phase value for every frequency point set by @option{frequency}.
  4570. Number of values must be same as number of frequency points.
  4571. Values are separated by white spaces.
  4572. @item sample_rate, r
  4573. Set sample rate, default is 44100.
  4574. @item nb_samples, n
  4575. Set number of samples per each frame. Default is 1024.
  4576. @item win_func, w
  4577. Set window function. Default is blackman.
  4578. @end table
  4579. @section anullsrc
  4580. The null audio source, return unprocessed audio frames. It is mainly useful
  4581. as a template and to be employed in analysis / debugging tools, or as
  4582. the source for filters which ignore the input data (for example the sox
  4583. synth filter).
  4584. This source accepts the following options:
  4585. @table @option
  4586. @item channel_layout, cl
  4587. Specifies the channel layout, and can be either an integer or a string
  4588. representing a channel layout. The default value of @var{channel_layout}
  4589. is "stereo".
  4590. Check the channel_layout_map definition in
  4591. @file{libavutil/channel_layout.c} for the mapping between strings and
  4592. channel layout values.
  4593. @item sample_rate, r
  4594. Specifies the sample rate, and defaults to 44100.
  4595. @item nb_samples, n
  4596. Set the number of samples per requested frames.
  4597. @end table
  4598. @subsection Examples
  4599. @itemize
  4600. @item
  4601. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4602. @example
  4603. anullsrc=r=48000:cl=4
  4604. @end example
  4605. @item
  4606. Do the same operation with a more obvious syntax:
  4607. @example
  4608. anullsrc=r=48000:cl=mono
  4609. @end example
  4610. @end itemize
  4611. All the parameters need to be explicitly defined.
  4612. @section flite
  4613. Synthesize a voice utterance using the libflite library.
  4614. To enable compilation of this filter you need to configure FFmpeg with
  4615. @code{--enable-libflite}.
  4616. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4617. The filter accepts the following options:
  4618. @table @option
  4619. @item list_voices
  4620. If set to 1, list the names of the available voices and exit
  4621. immediately. Default value is 0.
  4622. @item nb_samples, n
  4623. Set the maximum number of samples per frame. Default value is 512.
  4624. @item textfile
  4625. Set the filename containing the text to speak.
  4626. @item text
  4627. Set the text to speak.
  4628. @item voice, v
  4629. Set the voice to use for the speech synthesis. Default value is
  4630. @code{kal}. See also the @var{list_voices} option.
  4631. @end table
  4632. @subsection Examples
  4633. @itemize
  4634. @item
  4635. Read from file @file{speech.txt}, and synthesize the text using the
  4636. standard flite voice:
  4637. @example
  4638. flite=textfile=speech.txt
  4639. @end example
  4640. @item
  4641. Read the specified text selecting the @code{slt} voice:
  4642. @example
  4643. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4644. @end example
  4645. @item
  4646. Input text to ffmpeg:
  4647. @example
  4648. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4649. @end example
  4650. @item
  4651. Make @file{ffplay} speak the specified text, using @code{flite} and
  4652. the @code{lavfi} device:
  4653. @example
  4654. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4655. @end example
  4656. @end itemize
  4657. For more information about libflite, check:
  4658. @url{http://www.festvox.org/flite/}
  4659. @section anoisesrc
  4660. Generate a noise audio signal.
  4661. The filter accepts the following options:
  4662. @table @option
  4663. @item sample_rate, r
  4664. Specify the sample rate. Default value is 48000 Hz.
  4665. @item amplitude, a
  4666. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4667. is 1.0.
  4668. @item duration, d
  4669. Specify the duration of the generated audio stream. Not specifying this option
  4670. results in noise with an infinite length.
  4671. @item color, colour, c
  4672. Specify the color of noise. Available noise colors are white, pink, brown,
  4673. blue, violet and velvet. Default color is white.
  4674. @item seed, s
  4675. Specify a value used to seed the PRNG.
  4676. @item nb_samples, n
  4677. Set the number of samples per each output frame, default is 1024.
  4678. @end table
  4679. @subsection Examples
  4680. @itemize
  4681. @item
  4682. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4683. @example
  4684. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4685. @end example
  4686. @end itemize
  4687. @section hilbert
  4688. Generate odd-tap Hilbert transform FIR coefficients.
  4689. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4690. the signal by 90 degrees.
  4691. This is used in many matrix coding schemes and for analytic signal generation.
  4692. The process is often written as a multiplication by i (or j), the imaginary unit.
  4693. The filter accepts the following options:
  4694. @table @option
  4695. @item sample_rate, s
  4696. Set sample rate, default is 44100.
  4697. @item taps, t
  4698. Set length of FIR filter, default is 22051.
  4699. @item nb_samples, n
  4700. Set number of samples per each frame.
  4701. @item win_func, w
  4702. Set window function to be used when generating FIR coefficients.
  4703. @end table
  4704. @section sinc
  4705. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4706. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4707. The filter accepts the following options:
  4708. @table @option
  4709. @item sample_rate, r
  4710. Set sample rate, default is 44100.
  4711. @item nb_samples, n
  4712. Set number of samples per each frame. Default is 1024.
  4713. @item hp
  4714. Set high-pass frequency. Default is 0.
  4715. @item lp
  4716. Set low-pass frequency. Default is 0.
  4717. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4718. is higher than 0 then filter will create band-pass filter coefficients,
  4719. otherwise band-reject filter coefficients.
  4720. @item phase
  4721. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4722. @item beta
  4723. Set Kaiser window beta.
  4724. @item att
  4725. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4726. @item round
  4727. Enable rounding, by default is disabled.
  4728. @item hptaps
  4729. Set number of taps for high-pass filter.
  4730. @item lptaps
  4731. Set number of taps for low-pass filter.
  4732. @end table
  4733. @section sine
  4734. Generate an audio signal made of a sine wave with amplitude 1/8.
  4735. The audio signal is bit-exact.
  4736. The filter accepts the following options:
  4737. @table @option
  4738. @item frequency, f
  4739. Set the carrier frequency. Default is 440 Hz.
  4740. @item beep_factor, b
  4741. Enable a periodic beep every second with frequency @var{beep_factor} times
  4742. the carrier frequency. Default is 0, meaning the beep is disabled.
  4743. @item sample_rate, r
  4744. Specify the sample rate, default is 44100.
  4745. @item duration, d
  4746. Specify the duration of the generated audio stream.
  4747. @item samples_per_frame
  4748. Set the number of samples per output frame.
  4749. The expression can contain the following constants:
  4750. @table @option
  4751. @item n
  4752. The (sequential) number of the output audio frame, starting from 0.
  4753. @item pts
  4754. The PTS (Presentation TimeStamp) of the output audio frame,
  4755. expressed in @var{TB} units.
  4756. @item t
  4757. The PTS of the output audio frame, expressed in seconds.
  4758. @item TB
  4759. The timebase of the output audio frames.
  4760. @end table
  4761. Default is @code{1024}.
  4762. @end table
  4763. @subsection Examples
  4764. @itemize
  4765. @item
  4766. Generate a simple 440 Hz sine wave:
  4767. @example
  4768. sine
  4769. @end example
  4770. @item
  4771. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4772. @example
  4773. sine=220:4:d=5
  4774. sine=f=220:b=4:d=5
  4775. sine=frequency=220:beep_factor=4:duration=5
  4776. @end example
  4777. @item
  4778. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4779. pattern:
  4780. @example
  4781. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4782. @end example
  4783. @end itemize
  4784. @c man end AUDIO SOURCES
  4785. @chapter Audio Sinks
  4786. @c man begin AUDIO SINKS
  4787. Below is a description of the currently available audio sinks.
  4788. @section abuffersink
  4789. Buffer audio frames, and make them available to the end of filter chain.
  4790. This sink is mainly intended for programmatic use, in particular
  4791. through the interface defined in @file{libavfilter/buffersink.h}
  4792. or the options system.
  4793. It accepts a pointer to an AVABufferSinkContext structure, which
  4794. defines the incoming buffers' formats, to be passed as the opaque
  4795. parameter to @code{avfilter_init_filter} for initialization.
  4796. @section anullsink
  4797. Null audio sink; do absolutely nothing with the input audio. It is
  4798. mainly useful as a template and for use in analysis / debugging
  4799. tools.
  4800. @c man end AUDIO SINKS
  4801. @chapter Video Filters
  4802. @c man begin VIDEO FILTERS
  4803. When you configure your FFmpeg build, you can disable any of the
  4804. existing filters using @code{--disable-filters}.
  4805. The configure output will show the video filters included in your
  4806. build.
  4807. Below is a description of the currently available video filters.
  4808. @section addroi
  4809. Mark a region of interest in a video frame.
  4810. The frame data is passed through unchanged, but metadata is attached
  4811. to the frame indicating regions of interest which can affect the
  4812. behaviour of later encoding. Multiple regions can be marked by
  4813. applying the filter multiple times.
  4814. @table @option
  4815. @item x
  4816. Region distance in pixels from the left edge of the frame.
  4817. @item y
  4818. Region distance in pixels from the top edge of the frame.
  4819. @item w
  4820. Region width in pixels.
  4821. @item h
  4822. Region height in pixels.
  4823. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4824. and may contain the following variables:
  4825. @table @option
  4826. @item iw
  4827. Width of the input frame.
  4828. @item ih
  4829. Height of the input frame.
  4830. @end table
  4831. @item qoffset
  4832. Quantisation offset to apply within the region.
  4833. This must be a real value in the range -1 to +1. A value of zero
  4834. indicates no quality change. A negative value asks for better quality
  4835. (less quantisation), while a positive value asks for worse quality
  4836. (greater quantisation).
  4837. The range is calibrated so that the extreme values indicate the
  4838. largest possible offset - if the rest of the frame is encoded with the
  4839. worst possible quality, an offset of -1 indicates that this region
  4840. should be encoded with the best possible quality anyway. Intermediate
  4841. values are then interpolated in some codec-dependent way.
  4842. For example, in 10-bit H.264 the quantisation parameter varies between
  4843. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4844. this region should be encoded with a QP around one-tenth of the full
  4845. range better than the rest of the frame. So, if most of the frame
  4846. were to be encoded with a QP of around 30, this region would get a QP
  4847. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4848. An extreme value of -1 would indicate that this region should be
  4849. encoded with the best possible quality regardless of the treatment of
  4850. the rest of the frame - that is, should be encoded at a QP of -12.
  4851. @item clear
  4852. If set to true, remove any existing regions of interest marked on the
  4853. frame before adding the new one.
  4854. @end table
  4855. @subsection Examples
  4856. @itemize
  4857. @item
  4858. Mark the centre quarter of the frame as interesting.
  4859. @example
  4860. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4861. @end example
  4862. @item
  4863. Mark the 100-pixel-wide region on the left edge of the frame as very
  4864. uninteresting (to be encoded at much lower quality than the rest of
  4865. the frame).
  4866. @example
  4867. addroi=0:0:100:ih:+1/5
  4868. @end example
  4869. @end itemize
  4870. @section alphaextract
  4871. Extract the alpha component from the input as a grayscale video. This
  4872. is especially useful with the @var{alphamerge} filter.
  4873. @section alphamerge
  4874. Add or replace the alpha component of the primary input with the
  4875. grayscale value of a second input. This is intended for use with
  4876. @var{alphaextract} to allow the transmission or storage of frame
  4877. sequences that have alpha in a format that doesn't support an alpha
  4878. channel.
  4879. For example, to reconstruct full frames from a normal YUV-encoded video
  4880. and a separate video created with @var{alphaextract}, you might use:
  4881. @example
  4882. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4883. @end example
  4884. Since this filter is designed for reconstruction, it operates on frame
  4885. sequences without considering timestamps, and terminates when either
  4886. input reaches end of stream. This will cause problems if your encoding
  4887. pipeline drops frames. If you're trying to apply an image as an
  4888. overlay to a video stream, consider the @var{overlay} filter instead.
  4889. @section amplify
  4890. Amplify differences between current pixel and pixels of adjacent frames in
  4891. same pixel location.
  4892. This filter accepts the following options:
  4893. @table @option
  4894. @item radius
  4895. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4896. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4897. @item factor
  4898. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4899. @item threshold
  4900. Set threshold for difference amplification. Any difference greater or equal to
  4901. this value will not alter source pixel. Default is 10.
  4902. Allowed range is from 0 to 65535.
  4903. @item tolerance
  4904. Set tolerance for difference amplification. Any difference lower to
  4905. this value will not alter source pixel. Default is 0.
  4906. Allowed range is from 0 to 65535.
  4907. @item low
  4908. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4909. This option controls maximum possible value that will decrease source pixel value.
  4910. @item high
  4911. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4912. This option controls maximum possible value that will increase source pixel value.
  4913. @item planes
  4914. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4915. @end table
  4916. @subsection Commands
  4917. This filter supports the following @ref{commands} that corresponds to option of same name:
  4918. @table @option
  4919. @item factor
  4920. @item threshold
  4921. @item tolerance
  4922. @item low
  4923. @item high
  4924. @item planes
  4925. @end table
  4926. @section ass
  4927. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4928. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4929. Substation Alpha) subtitles files.
  4930. This filter accepts the following option in addition to the common options from
  4931. the @ref{subtitles} filter:
  4932. @table @option
  4933. @item shaping
  4934. Set the shaping engine
  4935. Available values are:
  4936. @table @samp
  4937. @item auto
  4938. The default libass shaping engine, which is the best available.
  4939. @item simple
  4940. Fast, font-agnostic shaper that can do only substitutions
  4941. @item complex
  4942. Slower shaper using OpenType for substitutions and positioning
  4943. @end table
  4944. The default is @code{auto}.
  4945. @end table
  4946. @section atadenoise
  4947. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4948. The filter accepts the following options:
  4949. @table @option
  4950. @item 0a
  4951. Set threshold A for 1st plane. Default is 0.02.
  4952. Valid range is 0 to 0.3.
  4953. @item 0b
  4954. Set threshold B for 1st plane. Default is 0.04.
  4955. Valid range is 0 to 5.
  4956. @item 1a
  4957. Set threshold A for 2nd plane. Default is 0.02.
  4958. Valid range is 0 to 0.3.
  4959. @item 1b
  4960. Set threshold B for 2nd plane. Default is 0.04.
  4961. Valid range is 0 to 5.
  4962. @item 2a
  4963. Set threshold A for 3rd plane. Default is 0.02.
  4964. Valid range is 0 to 0.3.
  4965. @item 2b
  4966. Set threshold B for 3rd plane. Default is 0.04.
  4967. Valid range is 0 to 5.
  4968. Threshold A is designed to react on abrupt changes in the input signal and
  4969. threshold B is designed to react on continuous changes in the input signal.
  4970. @item s
  4971. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4972. number in range [5, 129].
  4973. @item p
  4974. Set what planes of frame filter will use for averaging. Default is all.
  4975. @item a
  4976. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  4977. Alternatively can be set to @code{s} serial.
  4978. Parallel can be faster then serial, while other way around is never true.
  4979. Parallel will abort early on first change being greater then thresholds, while serial
  4980. will continue processing other side of frames if they are equal or bellow thresholds.
  4981. @end table
  4982. @subsection Commands
  4983. This filter supports same @ref{commands} as options except option @code{s}.
  4984. The command accepts the same syntax of the corresponding option.
  4985. @section avgblur
  4986. Apply average blur filter.
  4987. The filter accepts the following options:
  4988. @table @option
  4989. @item sizeX
  4990. Set horizontal radius size.
  4991. @item planes
  4992. Set which planes to filter. By default all planes are filtered.
  4993. @item sizeY
  4994. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4995. Default is @code{0}.
  4996. @end table
  4997. @subsection Commands
  4998. This filter supports same commands as options.
  4999. The command accepts the same syntax of the corresponding option.
  5000. If the specified expression is not valid, it is kept at its current
  5001. value.
  5002. @section bbox
  5003. Compute the bounding box for the non-black pixels in the input frame
  5004. luminance plane.
  5005. This filter computes the bounding box containing all the pixels with a
  5006. luminance value greater than the minimum allowed value.
  5007. The parameters describing the bounding box are printed on the filter
  5008. log.
  5009. The filter accepts the following option:
  5010. @table @option
  5011. @item min_val
  5012. Set the minimal luminance value. Default is @code{16}.
  5013. @end table
  5014. @section bilateral
  5015. Apply bilateral filter, spatial smoothing while preserving edges.
  5016. The filter accepts the following options:
  5017. @table @option
  5018. @item sigmaS
  5019. Set sigma of gaussian function to calculate spatial weight.
  5020. Allowed range is 0 to 10. Default is 0.1.
  5021. @item sigmaR
  5022. Set sigma of gaussian function to calculate range weight.
  5023. Allowed range is 0 to 1. Default is 0.1.
  5024. @item planes
  5025. Set planes to filter. Default is first only.
  5026. @end table
  5027. @section bitplanenoise
  5028. Show and measure bit plane noise.
  5029. The filter accepts the following options:
  5030. @table @option
  5031. @item bitplane
  5032. Set which plane to analyze. Default is @code{1}.
  5033. @item filter
  5034. Filter out noisy pixels from @code{bitplane} set above.
  5035. Default is disabled.
  5036. @end table
  5037. @section blackdetect
  5038. Detect video intervals that are (almost) completely black. Can be
  5039. useful to detect chapter transitions, commercials, or invalid
  5040. recordings.
  5041. The filter outputs its detection analysis to both the log as well as
  5042. frame metadata. If a black segment of at least the specified minimum
  5043. duration is found, a line with the start and end timestamps as well
  5044. as duration is printed to the log with level @code{info}. In addition,
  5045. a log line with level @code{debug} is printed per frame showing the
  5046. black amount detected for that frame.
  5047. The filter also attaches metadata to the first frame of a black
  5048. segment with key @code{lavfi.black_start} and to the first frame
  5049. after the black segment ends with key @code{lavfi.black_end}. The
  5050. value is the frame's timestamp. This metadata is added regardless
  5051. of the minimum duration specified.
  5052. The filter accepts the following options:
  5053. @table @option
  5054. @item black_min_duration, d
  5055. Set the minimum detected black duration expressed in seconds. It must
  5056. be a non-negative floating point number.
  5057. Default value is 2.0.
  5058. @item picture_black_ratio_th, pic_th
  5059. Set the threshold for considering a picture "black".
  5060. Express the minimum value for the ratio:
  5061. @example
  5062. @var{nb_black_pixels} / @var{nb_pixels}
  5063. @end example
  5064. for which a picture is considered black.
  5065. Default value is 0.98.
  5066. @item pixel_black_th, pix_th
  5067. Set the threshold for considering a pixel "black".
  5068. The threshold expresses the maximum pixel luminance value for which a
  5069. pixel is considered "black". The provided value is scaled according to
  5070. the following equation:
  5071. @example
  5072. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5073. @end example
  5074. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5075. the input video format, the range is [0-255] for YUV full-range
  5076. formats and [16-235] for YUV non full-range formats.
  5077. Default value is 0.10.
  5078. @end table
  5079. The following example sets the maximum pixel threshold to the minimum
  5080. value, and detects only black intervals of 2 or more seconds:
  5081. @example
  5082. blackdetect=d=2:pix_th=0.00
  5083. @end example
  5084. @section blackframe
  5085. Detect frames that are (almost) completely black. Can be useful to
  5086. detect chapter transitions or commercials. Output lines consist of
  5087. the frame number of the detected frame, the percentage of blackness,
  5088. the position in the file if known or -1 and the timestamp in seconds.
  5089. In order to display the output lines, you need to set the loglevel at
  5090. least to the AV_LOG_INFO value.
  5091. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5092. The value represents the percentage of pixels in the picture that
  5093. are below the threshold value.
  5094. It accepts the following parameters:
  5095. @table @option
  5096. @item amount
  5097. The percentage of the pixels that have to be below the threshold; it defaults to
  5098. @code{98}.
  5099. @item threshold, thresh
  5100. The threshold below which a pixel value is considered black; it defaults to
  5101. @code{32}.
  5102. @end table
  5103. @anchor{blend}
  5104. @section blend
  5105. Blend two video frames into each other.
  5106. The @code{blend} filter takes two input streams and outputs one
  5107. stream, the first input is the "top" layer and second input is
  5108. "bottom" layer. By default, the output terminates when the longest input terminates.
  5109. The @code{tblend} (time blend) filter takes two consecutive frames
  5110. from one single stream, and outputs the result obtained by blending
  5111. the new frame on top of the old frame.
  5112. A description of the accepted options follows.
  5113. @table @option
  5114. @item c0_mode
  5115. @item c1_mode
  5116. @item c2_mode
  5117. @item c3_mode
  5118. @item all_mode
  5119. Set blend mode for specific pixel component or all pixel components in case
  5120. of @var{all_mode}. Default value is @code{normal}.
  5121. Available values for component modes are:
  5122. @table @samp
  5123. @item addition
  5124. @item grainmerge
  5125. @item and
  5126. @item average
  5127. @item burn
  5128. @item darken
  5129. @item difference
  5130. @item grainextract
  5131. @item divide
  5132. @item dodge
  5133. @item freeze
  5134. @item exclusion
  5135. @item extremity
  5136. @item glow
  5137. @item hardlight
  5138. @item hardmix
  5139. @item heat
  5140. @item lighten
  5141. @item linearlight
  5142. @item multiply
  5143. @item multiply128
  5144. @item negation
  5145. @item normal
  5146. @item or
  5147. @item overlay
  5148. @item phoenix
  5149. @item pinlight
  5150. @item reflect
  5151. @item screen
  5152. @item softlight
  5153. @item subtract
  5154. @item vividlight
  5155. @item xor
  5156. @end table
  5157. @item c0_opacity
  5158. @item c1_opacity
  5159. @item c2_opacity
  5160. @item c3_opacity
  5161. @item all_opacity
  5162. Set blend opacity for specific pixel component or all pixel components in case
  5163. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5164. @item c0_expr
  5165. @item c1_expr
  5166. @item c2_expr
  5167. @item c3_expr
  5168. @item all_expr
  5169. Set blend expression for specific pixel component or all pixel components in case
  5170. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5171. The expressions can use the following variables:
  5172. @table @option
  5173. @item N
  5174. The sequential number of the filtered frame, starting from @code{0}.
  5175. @item X
  5176. @item Y
  5177. the coordinates of the current sample
  5178. @item W
  5179. @item H
  5180. the width and height of currently filtered plane
  5181. @item SW
  5182. @item SH
  5183. Width and height scale for the plane being filtered. It is the
  5184. ratio between the dimensions of the current plane to the luma plane,
  5185. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5186. the luma plane and @code{0.5,0.5} for the chroma planes.
  5187. @item T
  5188. Time of the current frame, expressed in seconds.
  5189. @item TOP, A
  5190. Value of pixel component at current location for first video frame (top layer).
  5191. @item BOTTOM, B
  5192. Value of pixel component at current location for second video frame (bottom layer).
  5193. @end table
  5194. @end table
  5195. The @code{blend} filter also supports the @ref{framesync} options.
  5196. @subsection Examples
  5197. @itemize
  5198. @item
  5199. Apply transition from bottom layer to top layer in first 10 seconds:
  5200. @example
  5201. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5202. @end example
  5203. @item
  5204. Apply linear horizontal transition from top layer to bottom layer:
  5205. @example
  5206. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5207. @end example
  5208. @item
  5209. Apply 1x1 checkerboard effect:
  5210. @example
  5211. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5212. @end example
  5213. @item
  5214. Apply uncover left effect:
  5215. @example
  5216. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5217. @end example
  5218. @item
  5219. Apply uncover down effect:
  5220. @example
  5221. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5222. @end example
  5223. @item
  5224. Apply uncover up-left effect:
  5225. @example
  5226. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5227. @end example
  5228. @item
  5229. Split diagonally video and shows top and bottom layer on each side:
  5230. @example
  5231. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5232. @end example
  5233. @item
  5234. Display differences between the current and the previous frame:
  5235. @example
  5236. tblend=all_mode=grainextract
  5237. @end example
  5238. @end itemize
  5239. @section bm3d
  5240. Denoise frames using Block-Matching 3D algorithm.
  5241. The filter accepts the following options.
  5242. @table @option
  5243. @item sigma
  5244. Set denoising strength. Default value is 1.
  5245. Allowed range is from 0 to 999.9.
  5246. The denoising algorithm is very sensitive to sigma, so adjust it
  5247. according to the source.
  5248. @item block
  5249. Set local patch size. This sets dimensions in 2D.
  5250. @item bstep
  5251. Set sliding step for processing blocks. Default value is 4.
  5252. Allowed range is from 1 to 64.
  5253. Smaller values allows processing more reference blocks and is slower.
  5254. @item group
  5255. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5256. When set to 1, no block matching is done. Larger values allows more blocks
  5257. in single group.
  5258. Allowed range is from 1 to 256.
  5259. @item range
  5260. Set radius for search block matching. Default is 9.
  5261. Allowed range is from 1 to INT32_MAX.
  5262. @item mstep
  5263. Set step between two search locations for block matching. Default is 1.
  5264. Allowed range is from 1 to 64. Smaller is slower.
  5265. @item thmse
  5266. Set threshold of mean square error for block matching. Valid range is 0 to
  5267. INT32_MAX.
  5268. @item hdthr
  5269. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5270. Larger values results in stronger hard-thresholding filtering in frequency
  5271. domain.
  5272. @item estim
  5273. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5274. Default is @code{basic}.
  5275. @item ref
  5276. If enabled, filter will use 2nd stream for block matching.
  5277. Default is disabled for @code{basic} value of @var{estim} option,
  5278. and always enabled if value of @var{estim} is @code{final}.
  5279. @item planes
  5280. Set planes to filter. Default is all available except alpha.
  5281. @end table
  5282. @subsection Examples
  5283. @itemize
  5284. @item
  5285. Basic filtering with bm3d:
  5286. @example
  5287. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5288. @end example
  5289. @item
  5290. Same as above, but filtering only luma:
  5291. @example
  5292. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5293. @end example
  5294. @item
  5295. Same as above, but with both estimation modes:
  5296. @example
  5297. 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
  5298. @end example
  5299. @item
  5300. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5301. @example
  5302. 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
  5303. @end example
  5304. @end itemize
  5305. @section boxblur
  5306. Apply a boxblur algorithm to the input video.
  5307. It accepts the following parameters:
  5308. @table @option
  5309. @item luma_radius, lr
  5310. @item luma_power, lp
  5311. @item chroma_radius, cr
  5312. @item chroma_power, cp
  5313. @item alpha_radius, ar
  5314. @item alpha_power, ap
  5315. @end table
  5316. A description of the accepted options follows.
  5317. @table @option
  5318. @item luma_radius, lr
  5319. @item chroma_radius, cr
  5320. @item alpha_radius, ar
  5321. Set an expression for the box radius in pixels used for blurring the
  5322. corresponding input plane.
  5323. The radius value must be a non-negative number, and must not be
  5324. greater than the value of the expression @code{min(w,h)/2} for the
  5325. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5326. planes.
  5327. Default value for @option{luma_radius} is "2". If not specified,
  5328. @option{chroma_radius} and @option{alpha_radius} default to the
  5329. corresponding value set for @option{luma_radius}.
  5330. The expressions can contain the following constants:
  5331. @table @option
  5332. @item w
  5333. @item h
  5334. The input width and height in pixels.
  5335. @item cw
  5336. @item ch
  5337. The input chroma image width and height in pixels.
  5338. @item hsub
  5339. @item vsub
  5340. The horizontal and vertical chroma subsample values. For example, for the
  5341. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5342. @end table
  5343. @item luma_power, lp
  5344. @item chroma_power, cp
  5345. @item alpha_power, ap
  5346. Specify how many times the boxblur filter is applied to the
  5347. corresponding plane.
  5348. Default value for @option{luma_power} is 2. If not specified,
  5349. @option{chroma_power} and @option{alpha_power} default to the
  5350. corresponding value set for @option{luma_power}.
  5351. A value of 0 will disable the effect.
  5352. @end table
  5353. @subsection Examples
  5354. @itemize
  5355. @item
  5356. Apply a boxblur filter with the luma, chroma, and alpha radii
  5357. set to 2:
  5358. @example
  5359. boxblur=luma_radius=2:luma_power=1
  5360. boxblur=2:1
  5361. @end example
  5362. @item
  5363. Set the luma radius to 2, and alpha and chroma radius to 0:
  5364. @example
  5365. boxblur=2:1:cr=0:ar=0
  5366. @end example
  5367. @item
  5368. Set the luma and chroma radii to a fraction of the video dimension:
  5369. @example
  5370. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5371. @end example
  5372. @end itemize
  5373. @section bwdif
  5374. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5375. Deinterlacing Filter").
  5376. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5377. interpolation algorithms.
  5378. It accepts the following parameters:
  5379. @table @option
  5380. @item mode
  5381. The interlacing mode to adopt. It accepts one of the following values:
  5382. @table @option
  5383. @item 0, send_frame
  5384. Output one frame for each frame.
  5385. @item 1, send_field
  5386. Output one frame for each field.
  5387. @end table
  5388. The default value is @code{send_field}.
  5389. @item parity
  5390. The picture field parity assumed for the input interlaced video. It accepts one
  5391. of the following values:
  5392. @table @option
  5393. @item 0, tff
  5394. Assume the top field is first.
  5395. @item 1, bff
  5396. Assume the bottom field is first.
  5397. @item -1, auto
  5398. Enable automatic detection of field parity.
  5399. @end table
  5400. The default value is @code{auto}.
  5401. If the interlacing is unknown or the decoder does not export this information,
  5402. top field first will be assumed.
  5403. @item deint
  5404. Specify which frames to deinterlace. Accepts one of the following
  5405. values:
  5406. @table @option
  5407. @item 0, all
  5408. Deinterlace all frames.
  5409. @item 1, interlaced
  5410. Only deinterlace frames marked as interlaced.
  5411. @end table
  5412. The default value is @code{all}.
  5413. @end table
  5414. @section cas
  5415. Apply Contrast Adaptive Sharpen filter to video stream.
  5416. The filter accepts the following options:
  5417. @table @option
  5418. @item strength
  5419. Set the sharpening strength. Default value is 0.
  5420. @item planes
  5421. Set planes to filter. Default value is to filter all
  5422. planes except alpha plane.
  5423. @end table
  5424. @section chromahold
  5425. Remove all color information for all colors except for certain one.
  5426. The filter accepts the following options:
  5427. @table @option
  5428. @item color
  5429. The color which will not be replaced with neutral chroma.
  5430. @item similarity
  5431. Similarity percentage with the above color.
  5432. 0.01 matches only the exact key color, while 1.0 matches everything.
  5433. @item blend
  5434. Blend percentage.
  5435. 0.0 makes pixels either fully gray, or not gray at all.
  5436. Higher values result in more preserved color.
  5437. @item yuv
  5438. Signals that the color passed is already in YUV instead of RGB.
  5439. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5440. This can be used to pass exact YUV values as hexadecimal numbers.
  5441. @end table
  5442. @subsection Commands
  5443. This filter supports same @ref{commands} as options.
  5444. The command accepts the same syntax of the corresponding option.
  5445. If the specified expression is not valid, it is kept at its current
  5446. value.
  5447. @section chromakey
  5448. YUV colorspace color/chroma keying.
  5449. The filter accepts the following options:
  5450. @table @option
  5451. @item color
  5452. The color which will be replaced with transparency.
  5453. @item similarity
  5454. Similarity percentage with the key color.
  5455. 0.01 matches only the exact key color, while 1.0 matches everything.
  5456. @item blend
  5457. Blend percentage.
  5458. 0.0 makes pixels either fully transparent, or not transparent at all.
  5459. Higher values result in semi-transparent pixels, with a higher transparency
  5460. the more similar the pixels color is to the key color.
  5461. @item yuv
  5462. Signals that the color passed is already in YUV instead of RGB.
  5463. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5464. This can be used to pass exact YUV values as hexadecimal numbers.
  5465. @end table
  5466. @subsection Commands
  5467. This filter supports same @ref{commands} as options.
  5468. The command accepts the same syntax of the corresponding option.
  5469. If the specified expression is not valid, it is kept at its current
  5470. value.
  5471. @subsection Examples
  5472. @itemize
  5473. @item
  5474. Make every green pixel in the input image transparent:
  5475. @example
  5476. ffmpeg -i input.png -vf chromakey=green out.png
  5477. @end example
  5478. @item
  5479. Overlay a greenscreen-video on top of a static black background.
  5480. @example
  5481. 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
  5482. @end example
  5483. @end itemize
  5484. @section chromashift
  5485. Shift chroma pixels horizontally and/or vertically.
  5486. The filter accepts the following options:
  5487. @table @option
  5488. @item cbh
  5489. Set amount to shift chroma-blue horizontally.
  5490. @item cbv
  5491. Set amount to shift chroma-blue vertically.
  5492. @item crh
  5493. Set amount to shift chroma-red horizontally.
  5494. @item crv
  5495. Set amount to shift chroma-red vertically.
  5496. @item edge
  5497. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5498. @end table
  5499. @subsection Commands
  5500. This filter supports the all above options as @ref{commands}.
  5501. @section ciescope
  5502. Display CIE color diagram with pixels overlaid onto it.
  5503. The filter accepts the following options:
  5504. @table @option
  5505. @item system
  5506. Set color system.
  5507. @table @samp
  5508. @item ntsc, 470m
  5509. @item ebu, 470bg
  5510. @item smpte
  5511. @item 240m
  5512. @item apple
  5513. @item widergb
  5514. @item cie1931
  5515. @item rec709, hdtv
  5516. @item uhdtv, rec2020
  5517. @item dcip3
  5518. @end table
  5519. @item cie
  5520. Set CIE system.
  5521. @table @samp
  5522. @item xyy
  5523. @item ucs
  5524. @item luv
  5525. @end table
  5526. @item gamuts
  5527. Set what gamuts to draw.
  5528. See @code{system} option for available values.
  5529. @item size, s
  5530. Set ciescope size, by default set to 512.
  5531. @item intensity, i
  5532. Set intensity used to map input pixel values to CIE diagram.
  5533. @item contrast
  5534. Set contrast used to draw tongue colors that are out of active color system gamut.
  5535. @item corrgamma
  5536. Correct gamma displayed on scope, by default enabled.
  5537. @item showwhite
  5538. Show white point on CIE diagram, by default disabled.
  5539. @item gamma
  5540. Set input gamma. Used only with XYZ input color space.
  5541. @end table
  5542. @section codecview
  5543. Visualize information exported by some codecs.
  5544. Some codecs can export information through frames using side-data or other
  5545. means. For example, some MPEG based codecs export motion vectors through the
  5546. @var{export_mvs} flag in the codec @option{flags2} option.
  5547. The filter accepts the following option:
  5548. @table @option
  5549. @item mv
  5550. Set motion vectors to visualize.
  5551. Available flags for @var{mv} are:
  5552. @table @samp
  5553. @item pf
  5554. forward predicted MVs of P-frames
  5555. @item bf
  5556. forward predicted MVs of B-frames
  5557. @item bb
  5558. backward predicted MVs of B-frames
  5559. @end table
  5560. @item qp
  5561. Display quantization parameters using the chroma planes.
  5562. @item mv_type, mvt
  5563. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5564. Available flags for @var{mv_type} are:
  5565. @table @samp
  5566. @item fp
  5567. forward predicted MVs
  5568. @item bp
  5569. backward predicted MVs
  5570. @end table
  5571. @item frame_type, ft
  5572. Set frame type to visualize motion vectors of.
  5573. Available flags for @var{frame_type} are:
  5574. @table @samp
  5575. @item if
  5576. intra-coded frames (I-frames)
  5577. @item pf
  5578. predicted frames (P-frames)
  5579. @item bf
  5580. bi-directionally predicted frames (B-frames)
  5581. @end table
  5582. @end table
  5583. @subsection Examples
  5584. @itemize
  5585. @item
  5586. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5587. @example
  5588. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5589. @end example
  5590. @item
  5591. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5592. @example
  5593. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5594. @end example
  5595. @end itemize
  5596. @section colorbalance
  5597. Modify intensity of primary colors (red, green and blue) of input frames.
  5598. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5599. regions for the red-cyan, green-magenta or blue-yellow balance.
  5600. A positive adjustment value shifts the balance towards the primary color, a negative
  5601. value towards the complementary color.
  5602. The filter accepts the following options:
  5603. @table @option
  5604. @item rs
  5605. @item gs
  5606. @item bs
  5607. Adjust red, green and blue shadows (darkest pixels).
  5608. @item rm
  5609. @item gm
  5610. @item bm
  5611. Adjust red, green and blue midtones (medium pixels).
  5612. @item rh
  5613. @item gh
  5614. @item bh
  5615. Adjust red, green and blue highlights (brightest pixels).
  5616. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5617. @item pl
  5618. Preserve lightness when changing color balance. Default is disabled.
  5619. @end table
  5620. @subsection Examples
  5621. @itemize
  5622. @item
  5623. Add red color cast to shadows:
  5624. @example
  5625. colorbalance=rs=.3
  5626. @end example
  5627. @end itemize
  5628. @subsection Commands
  5629. This filter supports the all above options as @ref{commands}.
  5630. @section colorchannelmixer
  5631. Adjust video input frames by re-mixing color channels.
  5632. This filter modifies a color channel by adding the values associated to
  5633. the other channels of the same pixels. For example if the value to
  5634. modify is red, the output value will be:
  5635. @example
  5636. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5637. @end example
  5638. The filter accepts the following options:
  5639. @table @option
  5640. @item rr
  5641. @item rg
  5642. @item rb
  5643. @item ra
  5644. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5645. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5646. @item gr
  5647. @item gg
  5648. @item gb
  5649. @item ga
  5650. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5651. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5652. @item br
  5653. @item bg
  5654. @item bb
  5655. @item ba
  5656. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5657. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5658. @item ar
  5659. @item ag
  5660. @item ab
  5661. @item aa
  5662. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5663. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5664. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5665. @end table
  5666. @subsection Examples
  5667. @itemize
  5668. @item
  5669. Convert source to grayscale:
  5670. @example
  5671. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5672. @end example
  5673. @item
  5674. Simulate sepia tones:
  5675. @example
  5676. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5677. @end example
  5678. @end itemize
  5679. @subsection Commands
  5680. This filter supports the all above options as @ref{commands}.
  5681. @section colorkey
  5682. RGB colorspace color keying.
  5683. The filter accepts the following options:
  5684. @table @option
  5685. @item color
  5686. The color which will be replaced with transparency.
  5687. @item similarity
  5688. Similarity percentage with the key color.
  5689. 0.01 matches only the exact key color, while 1.0 matches everything.
  5690. @item blend
  5691. Blend percentage.
  5692. 0.0 makes pixels either fully transparent, or not transparent at all.
  5693. Higher values result in semi-transparent pixels, with a higher transparency
  5694. the more similar the pixels color is to the key color.
  5695. @end table
  5696. @subsection Examples
  5697. @itemize
  5698. @item
  5699. Make every green pixel in the input image transparent:
  5700. @example
  5701. ffmpeg -i input.png -vf colorkey=green out.png
  5702. @end example
  5703. @item
  5704. Overlay a greenscreen-video on top of a static background image.
  5705. @example
  5706. 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
  5707. @end example
  5708. @end itemize
  5709. @subsection Commands
  5710. This filter supports same @ref{commands} as options.
  5711. The command accepts the same syntax of the corresponding option.
  5712. If the specified expression is not valid, it is kept at its current
  5713. value.
  5714. @section colorhold
  5715. Remove all color information for all RGB colors except for certain one.
  5716. The filter accepts the following options:
  5717. @table @option
  5718. @item color
  5719. The color which will not be replaced with neutral gray.
  5720. @item similarity
  5721. Similarity percentage with the above color.
  5722. 0.01 matches only the exact key color, while 1.0 matches everything.
  5723. @item blend
  5724. Blend percentage. 0.0 makes pixels fully gray.
  5725. Higher values result in more preserved color.
  5726. @end table
  5727. @subsection Commands
  5728. This filter supports same @ref{commands} as options.
  5729. The command accepts the same syntax of the corresponding option.
  5730. If the specified expression is not valid, it is kept at its current
  5731. value.
  5732. @section colorlevels
  5733. Adjust video input frames using levels.
  5734. The filter accepts the following options:
  5735. @table @option
  5736. @item rimin
  5737. @item gimin
  5738. @item bimin
  5739. @item aimin
  5740. Adjust red, green, blue and alpha input black point.
  5741. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5742. @item rimax
  5743. @item gimax
  5744. @item bimax
  5745. @item aimax
  5746. Adjust red, green, blue and alpha input white point.
  5747. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5748. Input levels are used to lighten highlights (bright tones), darken shadows
  5749. (dark tones), change the balance of bright and dark tones.
  5750. @item romin
  5751. @item gomin
  5752. @item bomin
  5753. @item aomin
  5754. Adjust red, green, blue and alpha output black point.
  5755. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5756. @item romax
  5757. @item gomax
  5758. @item bomax
  5759. @item aomax
  5760. Adjust red, green, blue and alpha output white point.
  5761. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5762. Output levels allows manual selection of a constrained output level range.
  5763. @end table
  5764. @subsection Examples
  5765. @itemize
  5766. @item
  5767. Make video output darker:
  5768. @example
  5769. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5770. @end example
  5771. @item
  5772. Increase contrast:
  5773. @example
  5774. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5775. @end example
  5776. @item
  5777. Make video output lighter:
  5778. @example
  5779. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5780. @end example
  5781. @item
  5782. Increase brightness:
  5783. @example
  5784. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5785. @end example
  5786. @end itemize
  5787. @subsection Commands
  5788. This filter supports the all above options as @ref{commands}.
  5789. @section colormatrix
  5790. Convert color matrix.
  5791. The filter accepts the following options:
  5792. @table @option
  5793. @item src
  5794. @item dst
  5795. Specify the source and destination color matrix. Both values must be
  5796. specified.
  5797. The accepted values are:
  5798. @table @samp
  5799. @item bt709
  5800. BT.709
  5801. @item fcc
  5802. FCC
  5803. @item bt601
  5804. BT.601
  5805. @item bt470
  5806. BT.470
  5807. @item bt470bg
  5808. BT.470BG
  5809. @item smpte170m
  5810. SMPTE-170M
  5811. @item smpte240m
  5812. SMPTE-240M
  5813. @item bt2020
  5814. BT.2020
  5815. @end table
  5816. @end table
  5817. For example to convert from BT.601 to SMPTE-240M, use the command:
  5818. @example
  5819. colormatrix=bt601:smpte240m
  5820. @end example
  5821. @section colorspace
  5822. Convert colorspace, transfer characteristics or color primaries.
  5823. Input video needs to have an even size.
  5824. The filter accepts the following options:
  5825. @table @option
  5826. @anchor{all}
  5827. @item all
  5828. Specify all color properties at once.
  5829. The accepted values are:
  5830. @table @samp
  5831. @item bt470m
  5832. BT.470M
  5833. @item bt470bg
  5834. BT.470BG
  5835. @item bt601-6-525
  5836. BT.601-6 525
  5837. @item bt601-6-625
  5838. BT.601-6 625
  5839. @item bt709
  5840. BT.709
  5841. @item smpte170m
  5842. SMPTE-170M
  5843. @item smpte240m
  5844. SMPTE-240M
  5845. @item bt2020
  5846. BT.2020
  5847. @end table
  5848. @anchor{space}
  5849. @item space
  5850. Specify output colorspace.
  5851. The accepted values are:
  5852. @table @samp
  5853. @item bt709
  5854. BT.709
  5855. @item fcc
  5856. FCC
  5857. @item bt470bg
  5858. BT.470BG or BT.601-6 625
  5859. @item smpte170m
  5860. SMPTE-170M or BT.601-6 525
  5861. @item smpte240m
  5862. SMPTE-240M
  5863. @item ycgco
  5864. YCgCo
  5865. @item bt2020ncl
  5866. BT.2020 with non-constant luminance
  5867. @end table
  5868. @anchor{trc}
  5869. @item trc
  5870. Specify output transfer characteristics.
  5871. The accepted values are:
  5872. @table @samp
  5873. @item bt709
  5874. BT.709
  5875. @item bt470m
  5876. BT.470M
  5877. @item bt470bg
  5878. BT.470BG
  5879. @item gamma22
  5880. Constant gamma of 2.2
  5881. @item gamma28
  5882. Constant gamma of 2.8
  5883. @item smpte170m
  5884. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5885. @item smpte240m
  5886. SMPTE-240M
  5887. @item srgb
  5888. SRGB
  5889. @item iec61966-2-1
  5890. iec61966-2-1
  5891. @item iec61966-2-4
  5892. iec61966-2-4
  5893. @item xvycc
  5894. xvycc
  5895. @item bt2020-10
  5896. BT.2020 for 10-bits content
  5897. @item bt2020-12
  5898. BT.2020 for 12-bits content
  5899. @end table
  5900. @anchor{primaries}
  5901. @item primaries
  5902. Specify output color primaries.
  5903. The accepted values are:
  5904. @table @samp
  5905. @item bt709
  5906. BT.709
  5907. @item bt470m
  5908. BT.470M
  5909. @item bt470bg
  5910. BT.470BG or BT.601-6 625
  5911. @item smpte170m
  5912. SMPTE-170M or BT.601-6 525
  5913. @item smpte240m
  5914. SMPTE-240M
  5915. @item film
  5916. film
  5917. @item smpte431
  5918. SMPTE-431
  5919. @item smpte432
  5920. SMPTE-432
  5921. @item bt2020
  5922. BT.2020
  5923. @item jedec-p22
  5924. JEDEC P22 phosphors
  5925. @end table
  5926. @anchor{range}
  5927. @item range
  5928. Specify output color range.
  5929. The accepted values are:
  5930. @table @samp
  5931. @item tv
  5932. TV (restricted) range
  5933. @item mpeg
  5934. MPEG (restricted) range
  5935. @item pc
  5936. PC (full) range
  5937. @item jpeg
  5938. JPEG (full) range
  5939. @end table
  5940. @item format
  5941. Specify output color format.
  5942. The accepted values are:
  5943. @table @samp
  5944. @item yuv420p
  5945. YUV 4:2:0 planar 8-bits
  5946. @item yuv420p10
  5947. YUV 4:2:0 planar 10-bits
  5948. @item yuv420p12
  5949. YUV 4:2:0 planar 12-bits
  5950. @item yuv422p
  5951. YUV 4:2:2 planar 8-bits
  5952. @item yuv422p10
  5953. YUV 4:2:2 planar 10-bits
  5954. @item yuv422p12
  5955. YUV 4:2:2 planar 12-bits
  5956. @item yuv444p
  5957. YUV 4:4:4 planar 8-bits
  5958. @item yuv444p10
  5959. YUV 4:4:4 planar 10-bits
  5960. @item yuv444p12
  5961. YUV 4:4:4 planar 12-bits
  5962. @end table
  5963. @item fast
  5964. Do a fast conversion, which skips gamma/primary correction. This will take
  5965. significantly less CPU, but will be mathematically incorrect. To get output
  5966. compatible with that produced by the colormatrix filter, use fast=1.
  5967. @item dither
  5968. Specify dithering mode.
  5969. The accepted values are:
  5970. @table @samp
  5971. @item none
  5972. No dithering
  5973. @item fsb
  5974. Floyd-Steinberg dithering
  5975. @end table
  5976. @item wpadapt
  5977. Whitepoint adaptation mode.
  5978. The accepted values are:
  5979. @table @samp
  5980. @item bradford
  5981. Bradford whitepoint adaptation
  5982. @item vonkries
  5983. von Kries whitepoint adaptation
  5984. @item identity
  5985. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5986. @end table
  5987. @item iall
  5988. Override all input properties at once. Same accepted values as @ref{all}.
  5989. @item ispace
  5990. Override input colorspace. Same accepted values as @ref{space}.
  5991. @item iprimaries
  5992. Override input color primaries. Same accepted values as @ref{primaries}.
  5993. @item itrc
  5994. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5995. @item irange
  5996. Override input color range. Same accepted values as @ref{range}.
  5997. @end table
  5998. The filter converts the transfer characteristics, color space and color
  5999. primaries to the specified user values. The output value, if not specified,
  6000. is set to a default value based on the "all" property. If that property is
  6001. also not specified, the filter will log an error. The output color range and
  6002. format default to the same value as the input color range and format. The
  6003. input transfer characteristics, color space, color primaries and color range
  6004. should be set on the input data. If any of these are missing, the filter will
  6005. log an error and no conversion will take place.
  6006. For example to convert the input to SMPTE-240M, use the command:
  6007. @example
  6008. colorspace=smpte240m
  6009. @end example
  6010. @section convolution
  6011. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6012. The filter accepts the following options:
  6013. @table @option
  6014. @item 0m
  6015. @item 1m
  6016. @item 2m
  6017. @item 3m
  6018. Set matrix for each plane.
  6019. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6020. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6021. @item 0rdiv
  6022. @item 1rdiv
  6023. @item 2rdiv
  6024. @item 3rdiv
  6025. Set multiplier for calculated value for each plane.
  6026. If unset or 0, it will be sum of all matrix elements.
  6027. @item 0bias
  6028. @item 1bias
  6029. @item 2bias
  6030. @item 3bias
  6031. Set bias for each plane. This value is added to the result of the multiplication.
  6032. Useful for making the overall image brighter or darker. Default is 0.0.
  6033. @item 0mode
  6034. @item 1mode
  6035. @item 2mode
  6036. @item 3mode
  6037. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6038. Default is @var{square}.
  6039. @end table
  6040. @subsection Examples
  6041. @itemize
  6042. @item
  6043. Apply sharpen:
  6044. @example
  6045. 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"
  6046. @end example
  6047. @item
  6048. Apply blur:
  6049. @example
  6050. 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"
  6051. @end example
  6052. @item
  6053. Apply edge enhance:
  6054. @example
  6055. 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"
  6056. @end example
  6057. @item
  6058. Apply edge detect:
  6059. @example
  6060. 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"
  6061. @end example
  6062. @item
  6063. Apply laplacian edge detector which includes diagonals:
  6064. @example
  6065. 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"
  6066. @end example
  6067. @item
  6068. Apply emboss:
  6069. @example
  6070. 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"
  6071. @end example
  6072. @end itemize
  6073. @section convolve
  6074. Apply 2D convolution of video stream in frequency domain using second stream
  6075. as impulse.
  6076. The filter accepts the following options:
  6077. @table @option
  6078. @item planes
  6079. Set which planes to process.
  6080. @item impulse
  6081. Set which impulse video frames will be processed, can be @var{first}
  6082. or @var{all}. Default is @var{all}.
  6083. @end table
  6084. The @code{convolve} filter also supports the @ref{framesync} options.
  6085. @section copy
  6086. Copy the input video source unchanged to the output. This is mainly useful for
  6087. testing purposes.
  6088. @anchor{coreimage}
  6089. @section coreimage
  6090. Video filtering on GPU using Apple's CoreImage API on OSX.
  6091. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6092. processed by video hardware. However, software-based OpenGL implementations
  6093. exist which means there is no guarantee for hardware processing. It depends on
  6094. the respective OSX.
  6095. There are many filters and image generators provided by Apple that come with a
  6096. large variety of options. The filter has to be referenced by its name along
  6097. with its options.
  6098. The coreimage filter accepts the following options:
  6099. @table @option
  6100. @item list_filters
  6101. List all available filters and generators along with all their respective
  6102. options as well as possible minimum and maximum values along with the default
  6103. values.
  6104. @example
  6105. list_filters=true
  6106. @end example
  6107. @item filter
  6108. Specify all filters by their respective name and options.
  6109. Use @var{list_filters} to determine all valid filter names and options.
  6110. Numerical options are specified by a float value and are automatically clamped
  6111. to their respective value range. Vector and color options have to be specified
  6112. by a list of space separated float values. Character escaping has to be done.
  6113. A special option name @code{default} is available to use default options for a
  6114. filter.
  6115. It is required to specify either @code{default} or at least one of the filter options.
  6116. All omitted options are used with their default values.
  6117. The syntax of the filter string is as follows:
  6118. @example
  6119. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6120. @end example
  6121. @item output_rect
  6122. Specify a rectangle where the output of the filter chain is copied into the
  6123. input image. It is given by a list of space separated float values:
  6124. @example
  6125. output_rect=x\ y\ width\ height
  6126. @end example
  6127. If not given, the output rectangle equals the dimensions of the input image.
  6128. The output rectangle is automatically cropped at the borders of the input
  6129. image. Negative values are valid for each component.
  6130. @example
  6131. output_rect=25\ 25\ 100\ 100
  6132. @end example
  6133. @end table
  6134. Several filters can be chained for successive processing without GPU-HOST
  6135. transfers allowing for fast processing of complex filter chains.
  6136. Currently, only filters with zero (generators) or exactly one (filters) input
  6137. image and one output image are supported. Also, transition filters are not yet
  6138. usable as intended.
  6139. Some filters generate output images with additional padding depending on the
  6140. respective filter kernel. The padding is automatically removed to ensure the
  6141. filter output has the same size as the input image.
  6142. For image generators, the size of the output image is determined by the
  6143. previous output image of the filter chain or the input image of the whole
  6144. filterchain, respectively. The generators do not use the pixel information of
  6145. this image to generate their output. However, the generated output is
  6146. blended onto this image, resulting in partial or complete coverage of the
  6147. output image.
  6148. The @ref{coreimagesrc} video source can be used for generating input images
  6149. which are directly fed into the filter chain. By using it, providing input
  6150. images by another video source or an input video is not required.
  6151. @subsection Examples
  6152. @itemize
  6153. @item
  6154. List all filters available:
  6155. @example
  6156. coreimage=list_filters=true
  6157. @end example
  6158. @item
  6159. Use the CIBoxBlur filter with default options to blur an image:
  6160. @example
  6161. coreimage=filter=CIBoxBlur@@default
  6162. @end example
  6163. @item
  6164. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6165. its center at 100x100 and a radius of 50 pixels:
  6166. @example
  6167. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6168. @end example
  6169. @item
  6170. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6171. given as complete and escaped command-line for Apple's standard bash shell:
  6172. @example
  6173. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6174. @end example
  6175. @end itemize
  6176. @section cover_rect
  6177. Cover a rectangular object
  6178. It accepts the following options:
  6179. @table @option
  6180. @item cover
  6181. Filepath of the optional cover image, needs to be in yuv420.
  6182. @item mode
  6183. Set covering mode.
  6184. It accepts the following values:
  6185. @table @samp
  6186. @item cover
  6187. cover it by the supplied image
  6188. @item blur
  6189. cover it by interpolating the surrounding pixels
  6190. @end table
  6191. Default value is @var{blur}.
  6192. @end table
  6193. @subsection Examples
  6194. @itemize
  6195. @item
  6196. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6197. @example
  6198. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6199. @end example
  6200. @end itemize
  6201. @section crop
  6202. Crop the input video to given dimensions.
  6203. It accepts the following parameters:
  6204. @table @option
  6205. @item w, out_w
  6206. The width of the output video. It defaults to @code{iw}.
  6207. This expression is evaluated only once during the filter
  6208. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6209. @item h, out_h
  6210. The height of the output video. It defaults to @code{ih}.
  6211. This expression is evaluated only once during the filter
  6212. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6213. @item x
  6214. The horizontal position, in the input video, of the left edge of the output
  6215. video. It defaults to @code{(in_w-out_w)/2}.
  6216. This expression is evaluated per-frame.
  6217. @item y
  6218. The vertical position, in the input video, of the top edge of the output video.
  6219. It defaults to @code{(in_h-out_h)/2}.
  6220. This expression is evaluated per-frame.
  6221. @item keep_aspect
  6222. If set to 1 will force the output display aspect ratio
  6223. to be the same of the input, by changing the output sample aspect
  6224. ratio. It defaults to 0.
  6225. @item exact
  6226. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6227. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6228. It defaults to 0.
  6229. @end table
  6230. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6231. expressions containing the following constants:
  6232. @table @option
  6233. @item x
  6234. @item y
  6235. The computed values for @var{x} and @var{y}. They are evaluated for
  6236. each new frame.
  6237. @item in_w
  6238. @item in_h
  6239. The input width and height.
  6240. @item iw
  6241. @item ih
  6242. These are the same as @var{in_w} and @var{in_h}.
  6243. @item out_w
  6244. @item out_h
  6245. The output (cropped) width and height.
  6246. @item ow
  6247. @item oh
  6248. These are the same as @var{out_w} and @var{out_h}.
  6249. @item a
  6250. same as @var{iw} / @var{ih}
  6251. @item sar
  6252. input sample aspect ratio
  6253. @item dar
  6254. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6255. @item hsub
  6256. @item vsub
  6257. horizontal and vertical chroma subsample values. For example for the
  6258. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6259. @item n
  6260. The number of the input frame, starting from 0.
  6261. @item pos
  6262. the position in the file of the input frame, NAN if unknown
  6263. @item t
  6264. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6265. @end table
  6266. The expression for @var{out_w} may depend on the value of @var{out_h},
  6267. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6268. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6269. evaluated after @var{out_w} and @var{out_h}.
  6270. The @var{x} and @var{y} parameters specify the expressions for the
  6271. position of the top-left corner of the output (non-cropped) area. They
  6272. are evaluated for each frame. If the evaluated value is not valid, it
  6273. is approximated to the nearest valid value.
  6274. The expression for @var{x} may depend on @var{y}, and the expression
  6275. for @var{y} may depend on @var{x}.
  6276. @subsection Examples
  6277. @itemize
  6278. @item
  6279. Crop area with size 100x100 at position (12,34).
  6280. @example
  6281. crop=100:100:12:34
  6282. @end example
  6283. Using named options, the example above becomes:
  6284. @example
  6285. crop=w=100:h=100:x=12:y=34
  6286. @end example
  6287. @item
  6288. Crop the central input area with size 100x100:
  6289. @example
  6290. crop=100:100
  6291. @end example
  6292. @item
  6293. Crop the central input area with size 2/3 of the input video:
  6294. @example
  6295. crop=2/3*in_w:2/3*in_h
  6296. @end example
  6297. @item
  6298. Crop the input video central square:
  6299. @example
  6300. crop=out_w=in_h
  6301. crop=in_h
  6302. @end example
  6303. @item
  6304. Delimit the rectangle with the top-left corner placed at position
  6305. 100:100 and the right-bottom corner corresponding to the right-bottom
  6306. corner of the input image.
  6307. @example
  6308. crop=in_w-100:in_h-100:100:100
  6309. @end example
  6310. @item
  6311. Crop 10 pixels from the left and right borders, and 20 pixels from
  6312. the top and bottom borders
  6313. @example
  6314. crop=in_w-2*10:in_h-2*20
  6315. @end example
  6316. @item
  6317. Keep only the bottom right quarter of the input image:
  6318. @example
  6319. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6320. @end example
  6321. @item
  6322. Crop height for getting Greek harmony:
  6323. @example
  6324. crop=in_w:1/PHI*in_w
  6325. @end example
  6326. @item
  6327. Apply trembling effect:
  6328. @example
  6329. 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)
  6330. @end example
  6331. @item
  6332. Apply erratic camera effect depending on timestamp:
  6333. @example
  6334. 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)"
  6335. @end example
  6336. @item
  6337. Set x depending on the value of y:
  6338. @example
  6339. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6340. @end example
  6341. @end itemize
  6342. @subsection Commands
  6343. This filter supports the following commands:
  6344. @table @option
  6345. @item w, out_w
  6346. @item h, out_h
  6347. @item x
  6348. @item y
  6349. Set width/height of the output video and the horizontal/vertical position
  6350. in the input video.
  6351. The command accepts the same syntax of the corresponding option.
  6352. If the specified expression is not valid, it is kept at its current
  6353. value.
  6354. @end table
  6355. @section cropdetect
  6356. Auto-detect the crop size.
  6357. It calculates the necessary cropping parameters and prints the
  6358. recommended parameters via the logging system. The detected dimensions
  6359. correspond to the non-black area of the input video.
  6360. It accepts the following parameters:
  6361. @table @option
  6362. @item limit
  6363. Set higher black value threshold, which can be optionally specified
  6364. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6365. value greater to the set value is considered non-black. It defaults to 24.
  6366. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6367. on the bitdepth of the pixel format.
  6368. @item round
  6369. The value which the width/height should be divisible by. It defaults to
  6370. 16. The offset is automatically adjusted to center the video. Use 2 to
  6371. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6372. encoding to most video codecs.
  6373. @item reset_count, reset
  6374. Set the counter that determines after how many frames cropdetect will
  6375. reset the previously detected largest video area and start over to
  6376. detect the current optimal crop area. Default value is 0.
  6377. This can be useful when channel logos distort the video area. 0
  6378. indicates 'never reset', and returns the largest area encountered during
  6379. playback.
  6380. @end table
  6381. @anchor{cue}
  6382. @section cue
  6383. Delay video filtering until a given wallclock timestamp. The filter first
  6384. passes on @option{preroll} amount of frames, then it buffers at most
  6385. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6386. it forwards the buffered frames and also any subsequent frames coming in its
  6387. input.
  6388. The filter can be used synchronize the output of multiple ffmpeg processes for
  6389. realtime output devices like decklink. By putting the delay in the filtering
  6390. chain and pre-buffering frames the process can pass on data to output almost
  6391. immediately after the target wallclock timestamp is reached.
  6392. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6393. some use cases.
  6394. @table @option
  6395. @item cue
  6396. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6397. @item preroll
  6398. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6399. @item buffer
  6400. The maximum duration of content to buffer before waiting for the cue expressed
  6401. in seconds. Default is 0.
  6402. @end table
  6403. @anchor{curves}
  6404. @section curves
  6405. Apply color adjustments using curves.
  6406. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6407. component (red, green and blue) has its values defined by @var{N} key points
  6408. tied from each other using a smooth curve. The x-axis represents the pixel
  6409. values from the input frame, and the y-axis the new pixel values to be set for
  6410. the output frame.
  6411. By default, a component curve is defined by the two points @var{(0;0)} and
  6412. @var{(1;1)}. This creates a straight line where each original pixel value is
  6413. "adjusted" to its own value, which means no change to the image.
  6414. The filter allows you to redefine these two points and add some more. A new
  6415. curve (using a natural cubic spline interpolation) will be define to pass
  6416. smoothly through all these new coordinates. The new defined points needs to be
  6417. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6418. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6419. the vector spaces, the values will be clipped accordingly.
  6420. The filter accepts the following options:
  6421. @table @option
  6422. @item preset
  6423. Select one of the available color presets. This option can be used in addition
  6424. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6425. options takes priority on the preset values.
  6426. Available presets are:
  6427. @table @samp
  6428. @item none
  6429. @item color_negative
  6430. @item cross_process
  6431. @item darker
  6432. @item increase_contrast
  6433. @item lighter
  6434. @item linear_contrast
  6435. @item medium_contrast
  6436. @item negative
  6437. @item strong_contrast
  6438. @item vintage
  6439. @end table
  6440. Default is @code{none}.
  6441. @item master, m
  6442. Set the master key points. These points will define a second pass mapping. It
  6443. is sometimes called a "luminance" or "value" mapping. It can be used with
  6444. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6445. post-processing LUT.
  6446. @item red, r
  6447. Set the key points for the red component.
  6448. @item green, g
  6449. Set the key points for the green component.
  6450. @item blue, b
  6451. Set the key points for the blue component.
  6452. @item all
  6453. Set the key points for all components (not including master).
  6454. Can be used in addition to the other key points component
  6455. options. In this case, the unset component(s) will fallback on this
  6456. @option{all} setting.
  6457. @item psfile
  6458. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6459. @item plot
  6460. Save Gnuplot script of the curves in specified file.
  6461. @end table
  6462. To avoid some filtergraph syntax conflicts, each key points list need to be
  6463. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6464. @subsection Examples
  6465. @itemize
  6466. @item
  6467. Increase slightly the middle level of blue:
  6468. @example
  6469. curves=blue='0/0 0.5/0.58 1/1'
  6470. @end example
  6471. @item
  6472. Vintage effect:
  6473. @example
  6474. 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'
  6475. @end example
  6476. Here we obtain the following coordinates for each components:
  6477. @table @var
  6478. @item red
  6479. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6480. @item green
  6481. @code{(0;0) (0.50;0.48) (1;1)}
  6482. @item blue
  6483. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6484. @end table
  6485. @item
  6486. The previous example can also be achieved with the associated built-in preset:
  6487. @example
  6488. curves=preset=vintage
  6489. @end example
  6490. @item
  6491. Or simply:
  6492. @example
  6493. curves=vintage
  6494. @end example
  6495. @item
  6496. Use a Photoshop preset and redefine the points of the green component:
  6497. @example
  6498. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6499. @end example
  6500. @item
  6501. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6502. and @command{gnuplot}:
  6503. @example
  6504. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6505. gnuplot -p /tmp/curves.plt
  6506. @end example
  6507. @end itemize
  6508. @section datascope
  6509. Video data analysis filter.
  6510. This filter shows hexadecimal pixel values of part of video.
  6511. The filter accepts the following options:
  6512. @table @option
  6513. @item size, s
  6514. Set output video size.
  6515. @item x
  6516. Set x offset from where to pick pixels.
  6517. @item y
  6518. Set y offset from where to pick pixels.
  6519. @item mode
  6520. Set scope mode, can be one of the following:
  6521. @table @samp
  6522. @item mono
  6523. Draw hexadecimal pixel values with white color on black background.
  6524. @item color
  6525. Draw hexadecimal pixel values with input video pixel color on black
  6526. background.
  6527. @item color2
  6528. Draw hexadecimal pixel values on color background picked from input video,
  6529. the text color is picked in such way so its always visible.
  6530. @end table
  6531. @item axis
  6532. Draw rows and columns numbers on left and top of video.
  6533. @item opacity
  6534. Set background opacity.
  6535. @item format
  6536. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6537. @end table
  6538. @section dctdnoiz
  6539. Denoise frames using 2D DCT (frequency domain filtering).
  6540. This filter is not designed for real time.
  6541. The filter accepts the following options:
  6542. @table @option
  6543. @item sigma, s
  6544. Set the noise sigma constant.
  6545. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6546. coefficient (absolute value) below this threshold with be dropped.
  6547. If you need a more advanced filtering, see @option{expr}.
  6548. Default is @code{0}.
  6549. @item overlap
  6550. Set number overlapping pixels for each block. Since the filter can be slow, you
  6551. may want to reduce this value, at the cost of a less effective filter and the
  6552. risk of various artefacts.
  6553. If the overlapping value doesn't permit processing the whole input width or
  6554. height, a warning will be displayed and according borders won't be denoised.
  6555. Default value is @var{blocksize}-1, which is the best possible setting.
  6556. @item expr, e
  6557. Set the coefficient factor expression.
  6558. For each coefficient of a DCT block, this expression will be evaluated as a
  6559. multiplier value for the coefficient.
  6560. If this is option is set, the @option{sigma} option will be ignored.
  6561. The absolute value of the coefficient can be accessed through the @var{c}
  6562. variable.
  6563. @item n
  6564. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6565. @var{blocksize}, which is the width and height of the processed blocks.
  6566. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6567. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6568. on the speed processing. Also, a larger block size does not necessarily means a
  6569. better de-noising.
  6570. @end table
  6571. @subsection Examples
  6572. Apply a denoise with a @option{sigma} of @code{4.5}:
  6573. @example
  6574. dctdnoiz=4.5
  6575. @end example
  6576. The same operation can be achieved using the expression system:
  6577. @example
  6578. dctdnoiz=e='gte(c, 4.5*3)'
  6579. @end example
  6580. Violent denoise using a block size of @code{16x16}:
  6581. @example
  6582. dctdnoiz=15:n=4
  6583. @end example
  6584. @section deband
  6585. Remove banding artifacts from input video.
  6586. It works by replacing banded pixels with average value of referenced pixels.
  6587. The filter accepts the following options:
  6588. @table @option
  6589. @item 1thr
  6590. @item 2thr
  6591. @item 3thr
  6592. @item 4thr
  6593. Set banding detection threshold for each plane. Default is 0.02.
  6594. Valid range is 0.00003 to 0.5.
  6595. If difference between current pixel and reference pixel is less than threshold,
  6596. it will be considered as banded.
  6597. @item range, r
  6598. Banding detection range in pixels. Default is 16. If positive, random number
  6599. in range 0 to set value will be used. If negative, exact absolute value
  6600. will be used.
  6601. The range defines square of four pixels around current pixel.
  6602. @item direction, d
  6603. Set direction in radians from which four pixel will be compared. If positive,
  6604. random direction from 0 to set direction will be picked. If negative, exact of
  6605. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6606. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6607. column.
  6608. @item blur, b
  6609. If enabled, current pixel is compared with average value of all four
  6610. surrounding pixels. The default is enabled. If disabled current pixel is
  6611. compared with all four surrounding pixels. The pixel is considered banded
  6612. if only all four differences with surrounding pixels are less than threshold.
  6613. @item coupling, c
  6614. If enabled, current pixel is changed if and only if all pixel components are banded,
  6615. e.g. banding detection threshold is triggered for all color components.
  6616. The default is disabled.
  6617. @end table
  6618. @section deblock
  6619. Remove blocking artifacts from input video.
  6620. The filter accepts the following options:
  6621. @table @option
  6622. @item filter
  6623. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6624. This controls what kind of deblocking is applied.
  6625. @item block
  6626. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6627. @item alpha
  6628. @item beta
  6629. @item gamma
  6630. @item delta
  6631. Set blocking detection thresholds. Allowed range is 0 to 1.
  6632. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6633. Using higher threshold gives more deblocking strength.
  6634. Setting @var{alpha} controls threshold detection at exact edge of block.
  6635. Remaining options controls threshold detection near the edge. Each one for
  6636. below/above or left/right. Setting any of those to @var{0} disables
  6637. deblocking.
  6638. @item planes
  6639. Set planes to filter. Default is to filter all available planes.
  6640. @end table
  6641. @subsection Examples
  6642. @itemize
  6643. @item
  6644. Deblock using weak filter and block size of 4 pixels.
  6645. @example
  6646. deblock=filter=weak:block=4
  6647. @end example
  6648. @item
  6649. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6650. deblocking more edges.
  6651. @example
  6652. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6653. @end example
  6654. @item
  6655. Similar as above, but filter only first plane.
  6656. @example
  6657. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6658. @end example
  6659. @item
  6660. Similar as above, but filter only second and third plane.
  6661. @example
  6662. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6663. @end example
  6664. @end itemize
  6665. @anchor{decimate}
  6666. @section decimate
  6667. Drop duplicated frames at regular intervals.
  6668. The filter accepts the following options:
  6669. @table @option
  6670. @item cycle
  6671. Set the number of frames from which one will be dropped. Setting this to
  6672. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6673. Default is @code{5}.
  6674. @item dupthresh
  6675. Set the threshold for duplicate detection. If the difference metric for a frame
  6676. is less than or equal to this value, then it is declared as duplicate. Default
  6677. is @code{1.1}
  6678. @item scthresh
  6679. Set scene change threshold. Default is @code{15}.
  6680. @item blockx
  6681. @item blocky
  6682. Set the size of the x and y-axis blocks used during metric calculations.
  6683. Larger blocks give better noise suppression, but also give worse detection of
  6684. small movements. Must be a power of two. Default is @code{32}.
  6685. @item ppsrc
  6686. Mark main input as a pre-processed input and activate clean source input
  6687. stream. This allows the input to be pre-processed with various filters to help
  6688. the metrics calculation while keeping the frame selection lossless. When set to
  6689. @code{1}, the first stream is for the pre-processed input, and the second
  6690. stream is the clean source from where the kept frames are chosen. Default is
  6691. @code{0}.
  6692. @item chroma
  6693. Set whether or not chroma is considered in the metric calculations. Default is
  6694. @code{1}.
  6695. @end table
  6696. @section deconvolve
  6697. Apply 2D deconvolution of video stream in frequency domain using second stream
  6698. as impulse.
  6699. The filter accepts the following options:
  6700. @table @option
  6701. @item planes
  6702. Set which planes to process.
  6703. @item impulse
  6704. Set which impulse video frames will be processed, can be @var{first}
  6705. or @var{all}. Default is @var{all}.
  6706. @item noise
  6707. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6708. and height are not same and not power of 2 or if stream prior to convolving
  6709. had noise.
  6710. @end table
  6711. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6712. @section dedot
  6713. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6714. It accepts the following options:
  6715. @table @option
  6716. @item m
  6717. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6718. @var{rainbows} for cross-color reduction.
  6719. @item lt
  6720. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6721. @item tl
  6722. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6723. @item tc
  6724. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6725. @item ct
  6726. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6727. @end table
  6728. @section deflate
  6729. Apply deflate effect to the video.
  6730. This filter replaces the pixel by the local(3x3) average by taking into account
  6731. only values lower than the pixel.
  6732. It accepts the following options:
  6733. @table @option
  6734. @item threshold0
  6735. @item threshold1
  6736. @item threshold2
  6737. @item threshold3
  6738. Limit the maximum change for each plane, default is 65535.
  6739. If 0, plane will remain unchanged.
  6740. @end table
  6741. @subsection Commands
  6742. This filter supports the all above options as @ref{commands}.
  6743. @section deflicker
  6744. Remove temporal frame luminance variations.
  6745. It accepts the following options:
  6746. @table @option
  6747. @item size, s
  6748. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6749. @item mode, m
  6750. Set averaging mode to smooth temporal luminance variations.
  6751. Available values are:
  6752. @table @samp
  6753. @item am
  6754. Arithmetic mean
  6755. @item gm
  6756. Geometric mean
  6757. @item hm
  6758. Harmonic mean
  6759. @item qm
  6760. Quadratic mean
  6761. @item cm
  6762. Cubic mean
  6763. @item pm
  6764. Power mean
  6765. @item median
  6766. Median
  6767. @end table
  6768. @item bypass
  6769. Do not actually modify frame. Useful when one only wants metadata.
  6770. @end table
  6771. @section dejudder
  6772. Remove judder produced by partially interlaced telecined content.
  6773. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6774. source was partially telecined content then the output of @code{pullup,dejudder}
  6775. will have a variable frame rate. May change the recorded frame rate of the
  6776. container. Aside from that change, this filter will not affect constant frame
  6777. rate video.
  6778. The option available in this filter is:
  6779. @table @option
  6780. @item cycle
  6781. Specify the length of the window over which the judder repeats.
  6782. Accepts any integer greater than 1. Useful values are:
  6783. @table @samp
  6784. @item 4
  6785. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6786. @item 5
  6787. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6788. @item 20
  6789. If a mixture of the two.
  6790. @end table
  6791. The default is @samp{4}.
  6792. @end table
  6793. @section delogo
  6794. Suppress a TV station logo by a simple interpolation of the surrounding
  6795. pixels. Just set a rectangle covering the logo and watch it disappear
  6796. (and sometimes something even uglier appear - your mileage may vary).
  6797. It accepts the following parameters:
  6798. @table @option
  6799. @item x
  6800. @item y
  6801. Specify the top left corner coordinates of the logo. They must be
  6802. specified.
  6803. @item w
  6804. @item h
  6805. Specify the width and height of the logo to clear. They must be
  6806. specified.
  6807. @item band, t
  6808. Specify the thickness of the fuzzy edge of the rectangle (added to
  6809. @var{w} and @var{h}). The default value is 1. This option is
  6810. deprecated, setting higher values should no longer be necessary and
  6811. is not recommended.
  6812. @item show
  6813. When set to 1, a green rectangle is drawn on the screen to simplify
  6814. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6815. The default value is 0.
  6816. The rectangle is drawn on the outermost pixels which will be (partly)
  6817. replaced with interpolated values. The values of the next pixels
  6818. immediately outside this rectangle in each direction will be used to
  6819. compute the interpolated pixel values inside the rectangle.
  6820. @end table
  6821. @subsection Examples
  6822. @itemize
  6823. @item
  6824. Set a rectangle covering the area with top left corner coordinates 0,0
  6825. and size 100x77, and a band of size 10:
  6826. @example
  6827. delogo=x=0:y=0:w=100:h=77:band=10
  6828. @end example
  6829. @end itemize
  6830. @anchor{derain}
  6831. @section derain
  6832. Remove the rain in the input image/video by applying the derain methods based on
  6833. convolutional neural networks. Supported models:
  6834. @itemize
  6835. @item
  6836. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6837. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6838. @end itemize
  6839. Training as well as model generation scripts are provided in
  6840. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6841. Native model files (.model) can be generated from TensorFlow model
  6842. files (.pb) by using tools/python/convert.py
  6843. The filter accepts the following options:
  6844. @table @option
  6845. @item filter_type
  6846. Specify which filter to use. This option accepts the following values:
  6847. @table @samp
  6848. @item derain
  6849. Derain filter. To conduct derain filter, you need to use a derain model.
  6850. @item dehaze
  6851. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6852. @end table
  6853. Default value is @samp{derain}.
  6854. @item dnn_backend
  6855. Specify which DNN backend to use for model loading and execution. This option accepts
  6856. the following values:
  6857. @table @samp
  6858. @item native
  6859. Native implementation of DNN loading and execution.
  6860. @item tensorflow
  6861. TensorFlow backend. To enable this backend you
  6862. need to install the TensorFlow for C library (see
  6863. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6864. @code{--enable-libtensorflow}
  6865. @end table
  6866. Default value is @samp{native}.
  6867. @item model
  6868. Set path to model file specifying network architecture and its parameters.
  6869. Note that different backends use different file formats. TensorFlow and native
  6870. backend can load files for only its format.
  6871. @end table
  6872. It can also be finished with @ref{dnn_processing} filter.
  6873. @section deshake
  6874. Attempt to fix small changes in horizontal and/or vertical shift. This
  6875. filter helps remove camera shake from hand-holding a camera, bumping a
  6876. tripod, moving on a vehicle, etc.
  6877. The filter accepts the following options:
  6878. @table @option
  6879. @item x
  6880. @item y
  6881. @item w
  6882. @item h
  6883. Specify a rectangular area where to limit the search for motion
  6884. vectors.
  6885. If desired the search for motion vectors can be limited to a
  6886. rectangular area of the frame defined by its top left corner, width
  6887. and height. These parameters have the same meaning as the drawbox
  6888. filter which can be used to visualise the position of the bounding
  6889. box.
  6890. This is useful when simultaneous movement of subjects within the frame
  6891. might be confused for camera motion by the motion vector search.
  6892. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6893. then the full frame is used. This allows later options to be set
  6894. without specifying the bounding box for the motion vector search.
  6895. Default - search the whole frame.
  6896. @item rx
  6897. @item ry
  6898. Specify the maximum extent of movement in x and y directions in the
  6899. range 0-64 pixels. Default 16.
  6900. @item edge
  6901. Specify how to generate pixels to fill blanks at the edge of the
  6902. frame. Available values are:
  6903. @table @samp
  6904. @item blank, 0
  6905. Fill zeroes at blank locations
  6906. @item original, 1
  6907. Original image at blank locations
  6908. @item clamp, 2
  6909. Extruded edge value at blank locations
  6910. @item mirror, 3
  6911. Mirrored edge at blank locations
  6912. @end table
  6913. Default value is @samp{mirror}.
  6914. @item blocksize
  6915. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6916. default 8.
  6917. @item contrast
  6918. Specify the contrast threshold for blocks. Only blocks with more than
  6919. the specified contrast (difference between darkest and lightest
  6920. pixels) will be considered. Range 1-255, default 125.
  6921. @item search
  6922. Specify the search strategy. Available values are:
  6923. @table @samp
  6924. @item exhaustive, 0
  6925. Set exhaustive search
  6926. @item less, 1
  6927. Set less exhaustive search.
  6928. @end table
  6929. Default value is @samp{exhaustive}.
  6930. @item filename
  6931. If set then a detailed log of the motion search is written to the
  6932. specified file.
  6933. @end table
  6934. @section despill
  6935. Remove unwanted contamination of foreground colors, caused by reflected color of
  6936. greenscreen or bluescreen.
  6937. This filter accepts the following options:
  6938. @table @option
  6939. @item type
  6940. Set what type of despill to use.
  6941. @item mix
  6942. Set how spillmap will be generated.
  6943. @item expand
  6944. Set how much to get rid of still remaining spill.
  6945. @item red
  6946. Controls amount of red in spill area.
  6947. @item green
  6948. Controls amount of green in spill area.
  6949. Should be -1 for greenscreen.
  6950. @item blue
  6951. Controls amount of blue in spill area.
  6952. Should be -1 for bluescreen.
  6953. @item brightness
  6954. Controls brightness of spill area, preserving colors.
  6955. @item alpha
  6956. Modify alpha from generated spillmap.
  6957. @end table
  6958. @section detelecine
  6959. Apply an exact inverse of the telecine operation. It requires a predefined
  6960. pattern specified using the pattern option which must be the same as that passed
  6961. to the telecine filter.
  6962. This filter accepts the following options:
  6963. @table @option
  6964. @item first_field
  6965. @table @samp
  6966. @item top, t
  6967. top field first
  6968. @item bottom, b
  6969. bottom field first
  6970. The default value is @code{top}.
  6971. @end table
  6972. @item pattern
  6973. A string of numbers representing the pulldown pattern you wish to apply.
  6974. The default value is @code{23}.
  6975. @item start_frame
  6976. A number representing position of the first frame with respect to the telecine
  6977. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6978. @end table
  6979. @section dilation
  6980. Apply dilation effect to the video.
  6981. This filter replaces the pixel by the local(3x3) maximum.
  6982. It accepts the following options:
  6983. @table @option
  6984. @item threshold0
  6985. @item threshold1
  6986. @item threshold2
  6987. @item threshold3
  6988. Limit the maximum change for each plane, default is 65535.
  6989. If 0, plane will remain unchanged.
  6990. @item coordinates
  6991. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6992. pixels are used.
  6993. Flags to local 3x3 coordinates maps like this:
  6994. 1 2 3
  6995. 4 5
  6996. 6 7 8
  6997. @end table
  6998. @subsection Commands
  6999. This filter supports the all above options as @ref{commands}.
  7000. @section displace
  7001. Displace pixels as indicated by second and third input stream.
  7002. It takes three input streams and outputs one stream, the first input is the
  7003. source, and second and third input are displacement maps.
  7004. The second input specifies how much to displace pixels along the
  7005. x-axis, while the third input specifies how much to displace pixels
  7006. along the y-axis.
  7007. If one of displacement map streams terminates, last frame from that
  7008. displacement map will be used.
  7009. Note that once generated, displacements maps can be reused over and over again.
  7010. A description of the accepted options follows.
  7011. @table @option
  7012. @item edge
  7013. Set displace behavior for pixels that are out of range.
  7014. Available values are:
  7015. @table @samp
  7016. @item blank
  7017. Missing pixels are replaced by black pixels.
  7018. @item smear
  7019. Adjacent pixels will spread out to replace missing pixels.
  7020. @item wrap
  7021. Out of range pixels are wrapped so they point to pixels of other side.
  7022. @item mirror
  7023. Out of range pixels will be replaced with mirrored pixels.
  7024. @end table
  7025. Default is @samp{smear}.
  7026. @end table
  7027. @subsection Examples
  7028. @itemize
  7029. @item
  7030. Add ripple effect to rgb input of video size hd720:
  7031. @example
  7032. 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
  7033. @end example
  7034. @item
  7035. Add wave effect to rgb input of video size hd720:
  7036. @example
  7037. 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
  7038. @end example
  7039. @end itemize
  7040. @anchor{dnn_processing}
  7041. @section dnn_processing
  7042. Do image processing with deep neural networks. It works together with another filter
  7043. which converts the pixel format of the Frame to what the dnn network requires.
  7044. The filter accepts the following options:
  7045. @table @option
  7046. @item dnn_backend
  7047. Specify which DNN backend to use for model loading and execution. This option accepts
  7048. the following values:
  7049. @table @samp
  7050. @item native
  7051. Native implementation of DNN loading and execution.
  7052. @item tensorflow
  7053. TensorFlow backend. To enable this backend you
  7054. need to install the TensorFlow for C library (see
  7055. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7056. @code{--enable-libtensorflow}
  7057. @end table
  7058. Default value is @samp{native}.
  7059. @item model
  7060. Set path to model file specifying network architecture and its parameters.
  7061. Note that different backends use different file formats. TensorFlow and native
  7062. backend can load files for only its format.
  7063. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7064. @item input
  7065. Set the input name of the dnn network.
  7066. @item output
  7067. Set the output name of the dnn network.
  7068. @end table
  7069. @subsection Examples
  7070. @itemize
  7071. @item
  7072. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7073. @example
  7074. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7075. @end example
  7076. @item
  7077. Halve the pixel value of the frame with format gray32f:
  7078. @example
  7079. 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
  7080. @end example
  7081. @item
  7082. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7083. @example
  7084. ./ffmpeg -i 480p.jpg -vf format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=tensorflow:model=srcnn.pb:input=x:output=y -y srcnn.jpg
  7085. @end example
  7086. @item
  7087. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7088. @example
  7089. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7090. @end example
  7091. @end itemize
  7092. @section drawbox
  7093. Draw a colored box on the input image.
  7094. It accepts the following parameters:
  7095. @table @option
  7096. @item x
  7097. @item y
  7098. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7099. @item width, w
  7100. @item height, h
  7101. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7102. the input width and height. It defaults to 0.
  7103. @item color, c
  7104. Specify the color of the box to write. For the general syntax of this option,
  7105. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7106. value @code{invert} is used, the box edge color is the same as the
  7107. video with inverted luma.
  7108. @item thickness, t
  7109. The expression which sets the thickness of the box edge.
  7110. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7111. See below for the list of accepted constants.
  7112. @item replace
  7113. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7114. will overwrite the video's color and alpha pixels.
  7115. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7116. @end table
  7117. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7118. following constants:
  7119. @table @option
  7120. @item dar
  7121. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7122. @item hsub
  7123. @item vsub
  7124. horizontal and vertical chroma subsample values. For example for the
  7125. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7126. @item in_h, ih
  7127. @item in_w, iw
  7128. The input width and height.
  7129. @item sar
  7130. The input sample aspect ratio.
  7131. @item x
  7132. @item y
  7133. The x and y offset coordinates where the box is drawn.
  7134. @item w
  7135. @item h
  7136. The width and height of the drawn box.
  7137. @item t
  7138. The thickness of the drawn box.
  7139. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7140. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7141. @end table
  7142. @subsection Examples
  7143. @itemize
  7144. @item
  7145. Draw a black box around the edge of the input image:
  7146. @example
  7147. drawbox
  7148. @end example
  7149. @item
  7150. Draw a box with color red and an opacity of 50%:
  7151. @example
  7152. drawbox=10:20:200:60:red@@0.5
  7153. @end example
  7154. The previous example can be specified as:
  7155. @example
  7156. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7157. @end example
  7158. @item
  7159. Fill the box with pink color:
  7160. @example
  7161. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7162. @end example
  7163. @item
  7164. Draw a 2-pixel red 2.40:1 mask:
  7165. @example
  7166. 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
  7167. @end example
  7168. @end itemize
  7169. @subsection Commands
  7170. This filter supports same commands as options.
  7171. The command accepts the same syntax of the corresponding option.
  7172. If the specified expression is not valid, it is kept at its current
  7173. value.
  7174. @anchor{drawgraph}
  7175. @section drawgraph
  7176. Draw a graph using input video metadata.
  7177. It accepts the following parameters:
  7178. @table @option
  7179. @item m1
  7180. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7181. @item fg1
  7182. Set 1st foreground color expression.
  7183. @item m2
  7184. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7185. @item fg2
  7186. Set 2nd foreground color expression.
  7187. @item m3
  7188. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7189. @item fg3
  7190. Set 3rd foreground color expression.
  7191. @item m4
  7192. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7193. @item fg4
  7194. Set 4th foreground color expression.
  7195. @item min
  7196. Set minimal value of metadata value.
  7197. @item max
  7198. Set maximal value of metadata value.
  7199. @item bg
  7200. Set graph background color. Default is white.
  7201. @item mode
  7202. Set graph mode.
  7203. Available values for mode is:
  7204. @table @samp
  7205. @item bar
  7206. @item dot
  7207. @item line
  7208. @end table
  7209. Default is @code{line}.
  7210. @item slide
  7211. Set slide mode.
  7212. Available values for slide is:
  7213. @table @samp
  7214. @item frame
  7215. Draw new frame when right border is reached.
  7216. @item replace
  7217. Replace old columns with new ones.
  7218. @item scroll
  7219. Scroll from right to left.
  7220. @item rscroll
  7221. Scroll from left to right.
  7222. @item picture
  7223. Draw single picture.
  7224. @end table
  7225. Default is @code{frame}.
  7226. @item size
  7227. Set size of graph video. For the syntax of this option, check the
  7228. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7229. The default value is @code{900x256}.
  7230. @item rate, r
  7231. Set the output frame rate. Default value is @code{25}.
  7232. The foreground color expressions can use the following variables:
  7233. @table @option
  7234. @item MIN
  7235. Minimal value of metadata value.
  7236. @item MAX
  7237. Maximal value of metadata value.
  7238. @item VAL
  7239. Current metadata key value.
  7240. @end table
  7241. The color is defined as 0xAABBGGRR.
  7242. @end table
  7243. Example using metadata from @ref{signalstats} filter:
  7244. @example
  7245. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7246. @end example
  7247. Example using metadata from @ref{ebur128} filter:
  7248. @example
  7249. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7250. @end example
  7251. @section drawgrid
  7252. Draw a grid on the input image.
  7253. It accepts the following parameters:
  7254. @table @option
  7255. @item x
  7256. @item y
  7257. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7258. @item width, w
  7259. @item height, h
  7260. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7261. input width and height, respectively, minus @code{thickness}, so image gets
  7262. framed. Default to 0.
  7263. @item color, c
  7264. Specify the color of the grid. For the general syntax of this option,
  7265. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7266. value @code{invert} is used, the grid color is the same as the
  7267. video with inverted luma.
  7268. @item thickness, t
  7269. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7270. See below for the list of accepted constants.
  7271. @item replace
  7272. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7273. will overwrite the video's color and alpha pixels.
  7274. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7275. @end table
  7276. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7277. following constants:
  7278. @table @option
  7279. @item dar
  7280. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7281. @item hsub
  7282. @item vsub
  7283. horizontal and vertical chroma subsample values. For example for the
  7284. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7285. @item in_h, ih
  7286. @item in_w, iw
  7287. The input grid cell width and height.
  7288. @item sar
  7289. The input sample aspect ratio.
  7290. @item x
  7291. @item y
  7292. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7293. @item w
  7294. @item h
  7295. The width and height of the drawn cell.
  7296. @item t
  7297. The thickness of the drawn cell.
  7298. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7299. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7300. @end table
  7301. @subsection Examples
  7302. @itemize
  7303. @item
  7304. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7305. @example
  7306. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7307. @end example
  7308. @item
  7309. Draw a white 3x3 grid with an opacity of 50%:
  7310. @example
  7311. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7312. @end example
  7313. @end itemize
  7314. @subsection Commands
  7315. This filter supports same commands as options.
  7316. The command accepts the same syntax of the corresponding option.
  7317. If the specified expression is not valid, it is kept at its current
  7318. value.
  7319. @anchor{drawtext}
  7320. @section drawtext
  7321. Draw a text string or text from a specified file on top of a video, using the
  7322. libfreetype library.
  7323. To enable compilation of this filter, you need to configure FFmpeg with
  7324. @code{--enable-libfreetype}.
  7325. To enable default font fallback and the @var{font} option you need to
  7326. configure FFmpeg with @code{--enable-libfontconfig}.
  7327. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7328. @code{--enable-libfribidi}.
  7329. @subsection Syntax
  7330. It accepts the following parameters:
  7331. @table @option
  7332. @item box
  7333. Used to draw a box around text using the background color.
  7334. The value must be either 1 (enable) or 0 (disable).
  7335. The default value of @var{box} is 0.
  7336. @item boxborderw
  7337. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7338. The default value of @var{boxborderw} is 0.
  7339. @item boxcolor
  7340. The color to be used for drawing box around text. For the syntax of this
  7341. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7342. The default value of @var{boxcolor} is "white".
  7343. @item line_spacing
  7344. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7345. The default value of @var{line_spacing} is 0.
  7346. @item borderw
  7347. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7348. The default value of @var{borderw} is 0.
  7349. @item bordercolor
  7350. Set the color to be used for drawing border around text. For the syntax of this
  7351. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7352. The default value of @var{bordercolor} is "black".
  7353. @item expansion
  7354. Select how the @var{text} is expanded. Can be either @code{none},
  7355. @code{strftime} (deprecated) or
  7356. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7357. below for details.
  7358. @item basetime
  7359. Set a start time for the count. Value is in microseconds. Only applied
  7360. in the deprecated strftime expansion mode. To emulate in normal expansion
  7361. mode use the @code{pts} function, supplying the start time (in seconds)
  7362. as the second argument.
  7363. @item fix_bounds
  7364. If true, check and fix text coords to avoid clipping.
  7365. @item fontcolor
  7366. The color to be used for drawing fonts. For the syntax of this option, check
  7367. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7368. The default value of @var{fontcolor} is "black".
  7369. @item fontcolor_expr
  7370. String which is expanded the same way as @var{text} to obtain dynamic
  7371. @var{fontcolor} value. By default this option has empty value and is not
  7372. processed. When this option is set, it overrides @var{fontcolor} option.
  7373. @item font
  7374. The font family to be used for drawing text. By default Sans.
  7375. @item fontfile
  7376. The font file to be used for drawing text. The path must be included.
  7377. This parameter is mandatory if the fontconfig support is disabled.
  7378. @item alpha
  7379. Draw the text applying alpha blending. The value can
  7380. be a number between 0.0 and 1.0.
  7381. The expression accepts the same variables @var{x, y} as well.
  7382. The default value is 1.
  7383. Please see @var{fontcolor_expr}.
  7384. @item fontsize
  7385. The font size to be used for drawing text.
  7386. The default value of @var{fontsize} is 16.
  7387. @item text_shaping
  7388. If set to 1, attempt to shape the text (for example, reverse the order of
  7389. right-to-left text and join Arabic characters) before drawing it.
  7390. Otherwise, just draw the text exactly as given.
  7391. By default 1 (if supported).
  7392. @item ft_load_flags
  7393. The flags to be used for loading the fonts.
  7394. The flags map the corresponding flags supported by libfreetype, and are
  7395. a combination of the following values:
  7396. @table @var
  7397. @item default
  7398. @item no_scale
  7399. @item no_hinting
  7400. @item render
  7401. @item no_bitmap
  7402. @item vertical_layout
  7403. @item force_autohint
  7404. @item crop_bitmap
  7405. @item pedantic
  7406. @item ignore_global_advance_width
  7407. @item no_recurse
  7408. @item ignore_transform
  7409. @item monochrome
  7410. @item linear_design
  7411. @item no_autohint
  7412. @end table
  7413. Default value is "default".
  7414. For more information consult the documentation for the FT_LOAD_*
  7415. libfreetype flags.
  7416. @item shadowcolor
  7417. The color to be used for drawing a shadow behind the drawn text. For the
  7418. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7419. ffmpeg-utils manual,ffmpeg-utils}.
  7420. The default value of @var{shadowcolor} is "black".
  7421. @item shadowx
  7422. @item shadowy
  7423. The x and y offsets for the text shadow position with respect to the
  7424. position of the text. They can be either positive or negative
  7425. values. The default value for both is "0".
  7426. @item start_number
  7427. The starting frame number for the n/frame_num variable. The default value
  7428. is "0".
  7429. @item tabsize
  7430. The size in number of spaces to use for rendering the tab.
  7431. Default value is 4.
  7432. @item timecode
  7433. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7434. format. It can be used with or without text parameter. @var{timecode_rate}
  7435. option must be specified.
  7436. @item timecode_rate, rate, r
  7437. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7438. integer. Minimum value is "1".
  7439. Drop-frame timecode is supported for frame rates 30 & 60.
  7440. @item tc24hmax
  7441. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7442. Default is 0 (disabled).
  7443. @item text
  7444. The text string to be drawn. The text must be a sequence of UTF-8
  7445. encoded characters.
  7446. This parameter is mandatory if no file is specified with the parameter
  7447. @var{textfile}.
  7448. @item textfile
  7449. A text file containing text to be drawn. The text must be a sequence
  7450. of UTF-8 encoded characters.
  7451. This parameter is mandatory if no text string is specified with the
  7452. parameter @var{text}.
  7453. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7454. @item reload
  7455. If set to 1, the @var{textfile} will be reloaded before each frame.
  7456. Be sure to update it atomically, or it may be read partially, or even fail.
  7457. @item x
  7458. @item y
  7459. The expressions which specify the offsets where text will be drawn
  7460. within the video frame. They are relative to the top/left border of the
  7461. output image.
  7462. The default value of @var{x} and @var{y} is "0".
  7463. See below for the list of accepted constants and functions.
  7464. @end table
  7465. The parameters for @var{x} and @var{y} are expressions containing the
  7466. following constants and functions:
  7467. @table @option
  7468. @item dar
  7469. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7470. @item hsub
  7471. @item vsub
  7472. horizontal and vertical chroma subsample values. For example for the
  7473. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7474. @item line_h, lh
  7475. the height of each text line
  7476. @item main_h, h, H
  7477. the input height
  7478. @item main_w, w, W
  7479. the input width
  7480. @item max_glyph_a, ascent
  7481. the maximum distance from the baseline to the highest/upper grid
  7482. coordinate used to place a glyph outline point, for all the rendered
  7483. glyphs.
  7484. It is a positive value, due to the grid's orientation with the Y axis
  7485. upwards.
  7486. @item max_glyph_d, descent
  7487. the maximum distance from the baseline to the lowest grid coordinate
  7488. used to place a glyph outline point, for all the rendered glyphs.
  7489. This is a negative value, due to the grid's orientation, with the Y axis
  7490. upwards.
  7491. @item max_glyph_h
  7492. maximum glyph height, that is the maximum height for all the glyphs
  7493. contained in the rendered text, it is equivalent to @var{ascent} -
  7494. @var{descent}.
  7495. @item max_glyph_w
  7496. maximum glyph width, that is the maximum width for all the glyphs
  7497. contained in the rendered text
  7498. @item n
  7499. the number of input frame, starting from 0
  7500. @item rand(min, max)
  7501. return a random number included between @var{min} and @var{max}
  7502. @item sar
  7503. The input sample aspect ratio.
  7504. @item t
  7505. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7506. @item text_h, th
  7507. the height of the rendered text
  7508. @item text_w, tw
  7509. the width of the rendered text
  7510. @item x
  7511. @item y
  7512. the x and y offset coordinates where the text is drawn.
  7513. These parameters allow the @var{x} and @var{y} expressions to refer
  7514. to each other, so you can for example specify @code{y=x/dar}.
  7515. @item pict_type
  7516. A one character description of the current frame's picture type.
  7517. @item pkt_pos
  7518. The current packet's position in the input file or stream
  7519. (in bytes, from the start of the input). A value of -1 indicates
  7520. this info is not available.
  7521. @item pkt_duration
  7522. The current packet's duration, in seconds.
  7523. @item pkt_size
  7524. The current packet's size (in bytes).
  7525. @end table
  7526. @anchor{drawtext_expansion}
  7527. @subsection Text expansion
  7528. If @option{expansion} is set to @code{strftime},
  7529. the filter recognizes strftime() sequences in the provided text and
  7530. expands them accordingly. Check the documentation of strftime(). This
  7531. feature is deprecated.
  7532. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7533. If @option{expansion} is set to @code{normal} (which is the default),
  7534. the following expansion mechanism is used.
  7535. The backslash character @samp{\}, followed by any character, always expands to
  7536. the second character.
  7537. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7538. braces is a function name, possibly followed by arguments separated by ':'.
  7539. If the arguments contain special characters or delimiters (':' or '@}'),
  7540. they should be escaped.
  7541. Note that they probably must also be escaped as the value for the
  7542. @option{text} option in the filter argument string and as the filter
  7543. argument in the filtergraph description, and possibly also for the shell,
  7544. that makes up to four levels of escaping; using a text file avoids these
  7545. problems.
  7546. The following functions are available:
  7547. @table @command
  7548. @item expr, e
  7549. The expression evaluation result.
  7550. It must take one argument specifying the expression to be evaluated,
  7551. which accepts the same constants and functions as the @var{x} and
  7552. @var{y} values. Note that not all constants should be used, for
  7553. example the text size is not known when evaluating the expression, so
  7554. the constants @var{text_w} and @var{text_h} will have an undefined
  7555. value.
  7556. @item expr_int_format, eif
  7557. Evaluate the expression's value and output as formatted integer.
  7558. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7559. The second argument specifies the output format. Allowed values are @samp{x},
  7560. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7561. @code{printf} function.
  7562. The third parameter is optional and sets the number of positions taken by the output.
  7563. It can be used to add padding with zeros from the left.
  7564. @item gmtime
  7565. The time at which the filter is running, expressed in UTC.
  7566. It can accept an argument: a strftime() format string.
  7567. @item localtime
  7568. The time at which the filter is running, expressed in the local time zone.
  7569. It can accept an argument: a strftime() format string.
  7570. @item metadata
  7571. Frame metadata. Takes one or two arguments.
  7572. The first argument is mandatory and specifies the metadata key.
  7573. The second argument is optional and specifies a default value, used when the
  7574. metadata key is not found or empty.
  7575. Available metadata can be identified by inspecting entries
  7576. starting with TAG included within each frame section
  7577. printed by running @code{ffprobe -show_frames}.
  7578. String metadata generated in filters leading to
  7579. the drawtext filter are also available.
  7580. @item n, frame_num
  7581. The frame number, starting from 0.
  7582. @item pict_type
  7583. A one character description of the current picture type.
  7584. @item pts
  7585. The timestamp of the current frame.
  7586. It can take up to three arguments.
  7587. The first argument is the format of the timestamp; it defaults to @code{flt}
  7588. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7589. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7590. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7591. @code{localtime} stands for the timestamp of the frame formatted as
  7592. local time zone time.
  7593. The second argument is an offset added to the timestamp.
  7594. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7595. supplied to present the hour part of the formatted timestamp in 24h format
  7596. (00-23).
  7597. If the format is set to @code{localtime} or @code{gmtime},
  7598. a third argument may be supplied: a strftime() format string.
  7599. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7600. @end table
  7601. @subsection Commands
  7602. This filter supports altering parameters via commands:
  7603. @table @option
  7604. @item reinit
  7605. Alter existing filter parameters.
  7606. Syntax for the argument is the same as for filter invocation, e.g.
  7607. @example
  7608. fontsize=56:fontcolor=green:text='Hello World'
  7609. @end example
  7610. Full filter invocation with sendcmd would look like this:
  7611. @example
  7612. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7613. @end example
  7614. @end table
  7615. If the entire argument can't be parsed or applied as valid values then the filter will
  7616. continue with its existing parameters.
  7617. @subsection Examples
  7618. @itemize
  7619. @item
  7620. Draw "Test Text" with font FreeSerif, using the default values for the
  7621. optional parameters.
  7622. @example
  7623. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7624. @end example
  7625. @item
  7626. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7627. and y=50 (counting from the top-left corner of the screen), text is
  7628. yellow with a red box around it. Both the text and the box have an
  7629. opacity of 20%.
  7630. @example
  7631. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7632. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7633. @end example
  7634. Note that the double quotes are not necessary if spaces are not used
  7635. within the parameter list.
  7636. @item
  7637. Show the text at the center of the video frame:
  7638. @example
  7639. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7640. @end example
  7641. @item
  7642. Show the text at a random position, switching to a new position every 30 seconds:
  7643. @example
  7644. 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)"
  7645. @end example
  7646. @item
  7647. Show a text line sliding from right to left in the last row of the video
  7648. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7649. with no newlines.
  7650. @example
  7651. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7652. @end example
  7653. @item
  7654. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7655. @example
  7656. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7657. @end example
  7658. @item
  7659. Draw a single green letter "g", at the center of the input video.
  7660. The glyph baseline is placed at half screen height.
  7661. @example
  7662. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7663. @end example
  7664. @item
  7665. Show text for 1 second every 3 seconds:
  7666. @example
  7667. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7668. @end example
  7669. @item
  7670. Use fontconfig to set the font. Note that the colons need to be escaped.
  7671. @example
  7672. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7673. @end example
  7674. @item
  7675. Print the date of a real-time encoding (see strftime(3)):
  7676. @example
  7677. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7678. @end example
  7679. @item
  7680. Show text fading in and out (appearing/disappearing):
  7681. @example
  7682. #!/bin/sh
  7683. DS=1.0 # display start
  7684. DE=10.0 # display end
  7685. FID=1.5 # fade in duration
  7686. FOD=5 # fade out duration
  7687. 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 @}"
  7688. @end example
  7689. @item
  7690. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7691. and the @option{fontsize} value are included in the @option{y} offset.
  7692. @example
  7693. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7694. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7695. @end example
  7696. @item
  7697. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7698. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7699. must have option @option{-export_path_metadata 1} for the special metadata fields
  7700. to be available for filters.
  7701. @example
  7702. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7703. @end example
  7704. @end itemize
  7705. For more information about libfreetype, check:
  7706. @url{http://www.freetype.org/}.
  7707. For more information about fontconfig, check:
  7708. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7709. For more information about libfribidi, check:
  7710. @url{http://fribidi.org/}.
  7711. @section edgedetect
  7712. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7713. The filter accepts the following options:
  7714. @table @option
  7715. @item low
  7716. @item high
  7717. Set low and high threshold values used by the Canny thresholding
  7718. algorithm.
  7719. The high threshold selects the "strong" edge pixels, which are then
  7720. connected through 8-connectivity with the "weak" edge pixels selected
  7721. by the low threshold.
  7722. @var{low} and @var{high} threshold values must be chosen in the range
  7723. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7724. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7725. is @code{50/255}.
  7726. @item mode
  7727. Define the drawing mode.
  7728. @table @samp
  7729. @item wires
  7730. Draw white/gray wires on black background.
  7731. @item colormix
  7732. Mix the colors to create a paint/cartoon effect.
  7733. @item canny
  7734. Apply Canny edge detector on all selected planes.
  7735. @end table
  7736. Default value is @var{wires}.
  7737. @item planes
  7738. Select planes for filtering. By default all available planes are filtered.
  7739. @end table
  7740. @subsection Examples
  7741. @itemize
  7742. @item
  7743. Standard edge detection with custom values for the hysteresis thresholding:
  7744. @example
  7745. edgedetect=low=0.1:high=0.4
  7746. @end example
  7747. @item
  7748. Painting effect without thresholding:
  7749. @example
  7750. edgedetect=mode=colormix:high=0
  7751. @end example
  7752. @end itemize
  7753. @section elbg
  7754. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7755. For each input image, the filter will compute the optimal mapping from
  7756. the input to the output given the codebook length, that is the number
  7757. of distinct output colors.
  7758. This filter accepts the following options.
  7759. @table @option
  7760. @item codebook_length, l
  7761. Set codebook length. The value must be a positive integer, and
  7762. represents the number of distinct output colors. Default value is 256.
  7763. @item nb_steps, n
  7764. Set the maximum number of iterations to apply for computing the optimal
  7765. mapping. The higher the value the better the result and the higher the
  7766. computation time. Default value is 1.
  7767. @item seed, s
  7768. Set a random seed, must be an integer included between 0 and
  7769. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7770. will try to use a good random seed on a best effort basis.
  7771. @item pal8
  7772. Set pal8 output pixel format. This option does not work with codebook
  7773. length greater than 256.
  7774. @end table
  7775. @section entropy
  7776. Measure graylevel entropy in histogram of color channels of video frames.
  7777. It accepts the following parameters:
  7778. @table @option
  7779. @item mode
  7780. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7781. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7782. between neighbour histogram values.
  7783. @end table
  7784. @section eq
  7785. Set brightness, contrast, saturation and approximate gamma adjustment.
  7786. The filter accepts the following options:
  7787. @table @option
  7788. @item contrast
  7789. Set the contrast expression. The value must be a float value in range
  7790. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7791. @item brightness
  7792. Set the brightness expression. The value must be a float value in
  7793. range @code{-1.0} to @code{1.0}. The default value is "0".
  7794. @item saturation
  7795. Set the saturation expression. The value must be a float in
  7796. range @code{0.0} to @code{3.0}. The default value is "1".
  7797. @item gamma
  7798. Set the gamma expression. The value must be a float in range
  7799. @code{0.1} to @code{10.0}. The default value is "1".
  7800. @item gamma_r
  7801. Set the gamma expression for red. The value must be a float in
  7802. range @code{0.1} to @code{10.0}. The default value is "1".
  7803. @item gamma_g
  7804. Set the gamma expression for green. The value must be a float in range
  7805. @code{0.1} to @code{10.0}. The default value is "1".
  7806. @item gamma_b
  7807. Set the gamma expression for blue. The value must be a float in range
  7808. @code{0.1} to @code{10.0}. The default value is "1".
  7809. @item gamma_weight
  7810. Set the gamma weight expression. It can be used to reduce the effect
  7811. of a high gamma value on bright image areas, e.g. keep them from
  7812. getting overamplified and just plain white. The value must be a float
  7813. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7814. gamma correction all the way down while @code{1.0} leaves it at its
  7815. full strength. Default is "1".
  7816. @item eval
  7817. Set when the expressions for brightness, contrast, saturation and
  7818. gamma expressions are evaluated.
  7819. It accepts the following values:
  7820. @table @samp
  7821. @item init
  7822. only evaluate expressions once during the filter initialization or
  7823. when a command is processed
  7824. @item frame
  7825. evaluate expressions for each incoming frame
  7826. @end table
  7827. Default value is @samp{init}.
  7828. @end table
  7829. The expressions accept the following parameters:
  7830. @table @option
  7831. @item n
  7832. frame count of the input frame starting from 0
  7833. @item pos
  7834. byte position of the corresponding packet in the input file, NAN if
  7835. unspecified
  7836. @item r
  7837. frame rate of the input video, NAN if the input frame rate is unknown
  7838. @item t
  7839. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7840. @end table
  7841. @subsection Commands
  7842. The filter supports the following commands:
  7843. @table @option
  7844. @item contrast
  7845. Set the contrast expression.
  7846. @item brightness
  7847. Set the brightness expression.
  7848. @item saturation
  7849. Set the saturation expression.
  7850. @item gamma
  7851. Set the gamma expression.
  7852. @item gamma_r
  7853. Set the gamma_r expression.
  7854. @item gamma_g
  7855. Set gamma_g expression.
  7856. @item gamma_b
  7857. Set gamma_b expression.
  7858. @item gamma_weight
  7859. Set gamma_weight expression.
  7860. The command accepts the same syntax of the corresponding option.
  7861. If the specified expression is not valid, it is kept at its current
  7862. value.
  7863. @end table
  7864. @section erosion
  7865. Apply erosion effect to the video.
  7866. This filter replaces the pixel by the local(3x3) minimum.
  7867. It accepts the following options:
  7868. @table @option
  7869. @item threshold0
  7870. @item threshold1
  7871. @item threshold2
  7872. @item threshold3
  7873. Limit the maximum change for each plane, default is 65535.
  7874. If 0, plane will remain unchanged.
  7875. @item coordinates
  7876. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7877. pixels are used.
  7878. Flags to local 3x3 coordinates maps like this:
  7879. 1 2 3
  7880. 4 5
  7881. 6 7 8
  7882. @end table
  7883. @subsection Commands
  7884. This filter supports the all above options as @ref{commands}.
  7885. @section extractplanes
  7886. Extract color channel components from input video stream into
  7887. separate grayscale video streams.
  7888. The filter accepts the following option:
  7889. @table @option
  7890. @item planes
  7891. Set plane(s) to extract.
  7892. Available values for planes are:
  7893. @table @samp
  7894. @item y
  7895. @item u
  7896. @item v
  7897. @item a
  7898. @item r
  7899. @item g
  7900. @item b
  7901. @end table
  7902. Choosing planes not available in the input will result in an error.
  7903. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7904. with @code{y}, @code{u}, @code{v} planes at same time.
  7905. @end table
  7906. @subsection Examples
  7907. @itemize
  7908. @item
  7909. Extract luma, u and v color channel component from input video frame
  7910. into 3 grayscale outputs:
  7911. @example
  7912. 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
  7913. @end example
  7914. @end itemize
  7915. @section fade
  7916. Apply a fade-in/out effect to the input video.
  7917. It accepts the following parameters:
  7918. @table @option
  7919. @item type, t
  7920. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7921. effect.
  7922. Default is @code{in}.
  7923. @item start_frame, s
  7924. Specify the number of the frame to start applying the fade
  7925. effect at. Default is 0.
  7926. @item nb_frames, n
  7927. The number of frames that the fade effect lasts. At the end of the
  7928. fade-in effect, the output video will have the same intensity as the input video.
  7929. At the end of the fade-out transition, the output video will be filled with the
  7930. selected @option{color}.
  7931. Default is 25.
  7932. @item alpha
  7933. If set to 1, fade only alpha channel, if one exists on the input.
  7934. Default value is 0.
  7935. @item start_time, st
  7936. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7937. effect. If both start_frame and start_time are specified, the fade will start at
  7938. whichever comes last. Default is 0.
  7939. @item duration, d
  7940. The number of seconds for which the fade effect has to last. At the end of the
  7941. fade-in effect the output video will have the same intensity as the input video,
  7942. at the end of the fade-out transition the output video will be filled with the
  7943. selected @option{color}.
  7944. If both duration and nb_frames are specified, duration is used. Default is 0
  7945. (nb_frames is used by default).
  7946. @item color, c
  7947. Specify the color of the fade. Default is "black".
  7948. @end table
  7949. @subsection Examples
  7950. @itemize
  7951. @item
  7952. Fade in the first 30 frames of video:
  7953. @example
  7954. fade=in:0:30
  7955. @end example
  7956. The command above is equivalent to:
  7957. @example
  7958. fade=t=in:s=0:n=30
  7959. @end example
  7960. @item
  7961. Fade out the last 45 frames of a 200-frame video:
  7962. @example
  7963. fade=out:155:45
  7964. fade=type=out:start_frame=155:nb_frames=45
  7965. @end example
  7966. @item
  7967. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7968. @example
  7969. fade=in:0:25, fade=out:975:25
  7970. @end example
  7971. @item
  7972. Make the first 5 frames yellow, then fade in from frame 5-24:
  7973. @example
  7974. fade=in:5:20:color=yellow
  7975. @end example
  7976. @item
  7977. Fade in alpha over first 25 frames of video:
  7978. @example
  7979. fade=in:0:25:alpha=1
  7980. @end example
  7981. @item
  7982. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7983. @example
  7984. fade=t=in:st=5.5:d=0.5
  7985. @end example
  7986. @end itemize
  7987. @section fftdnoiz
  7988. Denoise frames using 3D FFT (frequency domain filtering).
  7989. The filter accepts the following options:
  7990. @table @option
  7991. @item sigma
  7992. Set the noise sigma constant. This sets denoising strength.
  7993. Default value is 1. Allowed range is from 0 to 30.
  7994. Using very high sigma with low overlap may give blocking artifacts.
  7995. @item amount
  7996. Set amount of denoising. By default all detected noise is reduced.
  7997. Default value is 1. Allowed range is from 0 to 1.
  7998. @item block
  7999. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8000. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8001. block size in pixels is 2^4 which is 16.
  8002. @item overlap
  8003. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8004. @item prev
  8005. Set number of previous frames to use for denoising. By default is set to 0.
  8006. @item next
  8007. Set number of next frames to to use for denoising. By default is set to 0.
  8008. @item planes
  8009. Set planes which will be filtered, by default are all available filtered
  8010. except alpha.
  8011. @end table
  8012. @section fftfilt
  8013. Apply arbitrary expressions to samples in frequency domain
  8014. @table @option
  8015. @item dc_Y
  8016. Adjust the dc value (gain) of the luma plane of the image. The filter
  8017. accepts an integer value in range @code{0} to @code{1000}. The default
  8018. value is set to @code{0}.
  8019. @item dc_U
  8020. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8021. filter accepts an integer value in range @code{0} to @code{1000}. The
  8022. default value is set to @code{0}.
  8023. @item dc_V
  8024. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8025. filter accepts an integer value in range @code{0} to @code{1000}. The
  8026. default value is set to @code{0}.
  8027. @item weight_Y
  8028. Set the frequency domain weight expression for the luma plane.
  8029. @item weight_U
  8030. Set the frequency domain weight expression for the 1st chroma plane.
  8031. @item weight_V
  8032. Set the frequency domain weight expression for the 2nd chroma plane.
  8033. @item eval
  8034. Set when the expressions are evaluated.
  8035. It accepts the following values:
  8036. @table @samp
  8037. @item init
  8038. Only evaluate expressions once during the filter initialization.
  8039. @item frame
  8040. Evaluate expressions for each incoming frame.
  8041. @end table
  8042. Default value is @samp{init}.
  8043. The filter accepts the following variables:
  8044. @item X
  8045. @item Y
  8046. The coordinates of the current sample.
  8047. @item W
  8048. @item H
  8049. The width and height of the image.
  8050. @item N
  8051. The number of input frame, starting from 0.
  8052. @end table
  8053. @subsection Examples
  8054. @itemize
  8055. @item
  8056. High-pass:
  8057. @example
  8058. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8059. @end example
  8060. @item
  8061. Low-pass:
  8062. @example
  8063. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8064. @end example
  8065. @item
  8066. Sharpen:
  8067. @example
  8068. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8069. @end example
  8070. @item
  8071. Blur:
  8072. @example
  8073. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8074. @end example
  8075. @end itemize
  8076. @section field
  8077. Extract a single field from an interlaced image using stride
  8078. arithmetic to avoid wasting CPU time. The output frames are marked as
  8079. non-interlaced.
  8080. The filter accepts the following options:
  8081. @table @option
  8082. @item type
  8083. Specify whether to extract the top (if the value is @code{0} or
  8084. @code{top}) or the bottom field (if the value is @code{1} or
  8085. @code{bottom}).
  8086. @end table
  8087. @section fieldhint
  8088. Create new frames by copying the top and bottom fields from surrounding frames
  8089. supplied as numbers by the hint file.
  8090. @table @option
  8091. @item hint
  8092. Set file containing hints: absolute/relative frame numbers.
  8093. There must be one line for each frame in a clip. Each line must contain two
  8094. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8095. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8096. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8097. for @code{relative} mode. First number tells from which frame to pick up top
  8098. field and second number tells from which frame to pick up bottom field.
  8099. If optionally followed by @code{+} output frame will be marked as interlaced,
  8100. else if followed by @code{-} output frame will be marked as progressive, else
  8101. it will be marked same as input frame.
  8102. If optionally followed by @code{t} output frame will use only top field, or in
  8103. case of @code{b} it will use only bottom field.
  8104. If line starts with @code{#} or @code{;} that line is skipped.
  8105. @item mode
  8106. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8107. @end table
  8108. Example of first several lines of @code{hint} file for @code{relative} mode:
  8109. @example
  8110. 0,0 - # first frame
  8111. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8112. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8113. 1,0 -
  8114. 0,0 -
  8115. 0,0 -
  8116. 1,0 -
  8117. 1,0 -
  8118. 1,0 -
  8119. 0,0 -
  8120. 0,0 -
  8121. 1,0 -
  8122. 1,0 -
  8123. 1,0 -
  8124. 0,0 -
  8125. @end example
  8126. @section fieldmatch
  8127. Field matching filter for inverse telecine. It is meant to reconstruct the
  8128. progressive frames from a telecined stream. The filter does not drop duplicated
  8129. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8130. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8131. The separation of the field matching and the decimation is notably motivated by
  8132. the possibility of inserting a de-interlacing filter fallback between the two.
  8133. If the source has mixed telecined and real interlaced content,
  8134. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8135. But these remaining combed frames will be marked as interlaced, and thus can be
  8136. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8137. In addition to the various configuration options, @code{fieldmatch} can take an
  8138. optional second stream, activated through the @option{ppsrc} option. If
  8139. enabled, the frames reconstruction will be based on the fields and frames from
  8140. this second stream. This allows the first input to be pre-processed in order to
  8141. help the various algorithms of the filter, while keeping the output lossless
  8142. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8143. or brightness/contrast adjustments can help.
  8144. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8145. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8146. which @code{fieldmatch} is based on. While the semantic and usage are very
  8147. close, some behaviour and options names can differ.
  8148. The @ref{decimate} filter currently only works for constant frame rate input.
  8149. If your input has mixed telecined (30fps) and progressive content with a lower
  8150. framerate like 24fps use the following filterchain to produce the necessary cfr
  8151. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8152. The filter accepts the following options:
  8153. @table @option
  8154. @item order
  8155. Specify the assumed field order of the input stream. Available values are:
  8156. @table @samp
  8157. @item auto
  8158. Auto detect parity (use FFmpeg's internal parity value).
  8159. @item bff
  8160. Assume bottom field first.
  8161. @item tff
  8162. Assume top field first.
  8163. @end table
  8164. Note that it is sometimes recommended not to trust the parity announced by the
  8165. stream.
  8166. Default value is @var{auto}.
  8167. @item mode
  8168. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8169. sense that it won't risk creating jerkiness due to duplicate frames when
  8170. possible, but if there are bad edits or blended fields it will end up
  8171. outputting combed frames when a good match might actually exist. On the other
  8172. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8173. but will almost always find a good frame if there is one. The other values are
  8174. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8175. jerkiness and creating duplicate frames versus finding good matches in sections
  8176. with bad edits, orphaned fields, blended fields, etc.
  8177. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8178. Available values are:
  8179. @table @samp
  8180. @item pc
  8181. 2-way matching (p/c)
  8182. @item pc_n
  8183. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8184. @item pc_u
  8185. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8186. @item pc_n_ub
  8187. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8188. still combed (p/c + n + u/b)
  8189. @item pcn
  8190. 3-way matching (p/c/n)
  8191. @item pcn_ub
  8192. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8193. detected as combed (p/c/n + u/b)
  8194. @end table
  8195. The parenthesis at the end indicate the matches that would be used for that
  8196. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8197. @var{top}).
  8198. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8199. the slowest.
  8200. Default value is @var{pc_n}.
  8201. @item ppsrc
  8202. Mark the main input stream as a pre-processed input, and enable the secondary
  8203. input stream as the clean source to pick the fields from. See the filter
  8204. introduction for more details. It is similar to the @option{clip2} feature from
  8205. VFM/TFM.
  8206. Default value is @code{0} (disabled).
  8207. @item field
  8208. Set the field to match from. It is recommended to set this to the same value as
  8209. @option{order} unless you experience matching failures with that setting. In
  8210. certain circumstances changing the field that is used to match from can have a
  8211. large impact on matching performance. Available values are:
  8212. @table @samp
  8213. @item auto
  8214. Automatic (same value as @option{order}).
  8215. @item bottom
  8216. Match from the bottom field.
  8217. @item top
  8218. Match from the top field.
  8219. @end table
  8220. Default value is @var{auto}.
  8221. @item mchroma
  8222. Set whether or not chroma is included during the match comparisons. In most
  8223. cases it is recommended to leave this enabled. You should set this to @code{0}
  8224. only if your clip has bad chroma problems such as heavy rainbowing or other
  8225. artifacts. Setting this to @code{0} could also be used to speed things up at
  8226. the cost of some accuracy.
  8227. Default value is @code{1}.
  8228. @item y0
  8229. @item y1
  8230. These define an exclusion band which excludes the lines between @option{y0} and
  8231. @option{y1} from being included in the field matching decision. An exclusion
  8232. band can be used to ignore subtitles, a logo, or other things that may
  8233. interfere with the matching. @option{y0} sets the starting scan line and
  8234. @option{y1} sets the ending line; all lines in between @option{y0} and
  8235. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8236. @option{y0} and @option{y1} to the same value will disable the feature.
  8237. @option{y0} and @option{y1} defaults to @code{0}.
  8238. @item scthresh
  8239. Set the scene change detection threshold as a percentage of maximum change on
  8240. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8241. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8242. @option{scthresh} is @code{[0.0, 100.0]}.
  8243. Default value is @code{12.0}.
  8244. @item combmatch
  8245. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8246. account the combed scores of matches when deciding what match to use as the
  8247. final match. Available values are:
  8248. @table @samp
  8249. @item none
  8250. No final matching based on combed scores.
  8251. @item sc
  8252. Combed scores are only used when a scene change is detected.
  8253. @item full
  8254. Use combed scores all the time.
  8255. @end table
  8256. Default is @var{sc}.
  8257. @item combdbg
  8258. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8259. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8260. Available values are:
  8261. @table @samp
  8262. @item none
  8263. No forced calculation.
  8264. @item pcn
  8265. Force p/c/n calculations.
  8266. @item pcnub
  8267. Force p/c/n/u/b calculations.
  8268. @end table
  8269. Default value is @var{none}.
  8270. @item cthresh
  8271. This is the area combing threshold used for combed frame detection. This
  8272. essentially controls how "strong" or "visible" combing must be to be detected.
  8273. Larger values mean combing must be more visible and smaller values mean combing
  8274. can be less visible or strong and still be detected. Valid settings are from
  8275. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8276. be detected as combed). This is basically a pixel difference value. A good
  8277. range is @code{[8, 12]}.
  8278. Default value is @code{9}.
  8279. @item chroma
  8280. Sets whether or not chroma is considered in the combed frame decision. Only
  8281. disable this if your source has chroma problems (rainbowing, etc.) that are
  8282. causing problems for the combed frame detection with chroma enabled. Actually,
  8283. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8284. where there is chroma only combing in the source.
  8285. Default value is @code{0}.
  8286. @item blockx
  8287. @item blocky
  8288. Respectively set the x-axis and y-axis size of the window used during combed
  8289. frame detection. This has to do with the size of the area in which
  8290. @option{combpel} pixels are required to be detected as combed for a frame to be
  8291. declared combed. See the @option{combpel} parameter description for more info.
  8292. Possible values are any number that is a power of 2 starting at 4 and going up
  8293. to 512.
  8294. Default value is @code{16}.
  8295. @item combpel
  8296. The number of combed pixels inside any of the @option{blocky} by
  8297. @option{blockx} size blocks on the frame for the frame to be detected as
  8298. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8299. setting controls "how much" combing there must be in any localized area (a
  8300. window defined by the @option{blockx} and @option{blocky} settings) on the
  8301. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8302. which point no frames will ever be detected as combed). This setting is known
  8303. as @option{MI} in TFM/VFM vocabulary.
  8304. Default value is @code{80}.
  8305. @end table
  8306. @anchor{p/c/n/u/b meaning}
  8307. @subsection p/c/n/u/b meaning
  8308. @subsubsection p/c/n
  8309. We assume the following telecined stream:
  8310. @example
  8311. Top fields: 1 2 2 3 4
  8312. Bottom fields: 1 2 3 4 4
  8313. @end example
  8314. The numbers correspond to the progressive frame the fields relate to. Here, the
  8315. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8316. When @code{fieldmatch} is configured to run a matching from bottom
  8317. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8318. @example
  8319. Input stream:
  8320. T 1 2 2 3 4
  8321. B 1 2 3 4 4 <-- matching reference
  8322. Matches: c c n n c
  8323. Output stream:
  8324. T 1 2 3 4 4
  8325. B 1 2 3 4 4
  8326. @end example
  8327. As a result of the field matching, we can see that some frames get duplicated.
  8328. To perform a complete inverse telecine, you need to rely on a decimation filter
  8329. after this operation. See for instance the @ref{decimate} filter.
  8330. The same operation now matching from top fields (@option{field}=@var{top})
  8331. looks like this:
  8332. @example
  8333. Input stream:
  8334. T 1 2 2 3 4 <-- matching reference
  8335. B 1 2 3 4 4
  8336. Matches: c c p p c
  8337. Output stream:
  8338. T 1 2 2 3 4
  8339. B 1 2 2 3 4
  8340. @end example
  8341. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8342. basically, they refer to the frame and field of the opposite parity:
  8343. @itemize
  8344. @item @var{p} matches the field of the opposite parity in the previous frame
  8345. @item @var{c} matches the field of the opposite parity in the current frame
  8346. @item @var{n} matches the field of the opposite parity in the next frame
  8347. @end itemize
  8348. @subsubsection u/b
  8349. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8350. from the opposite parity flag. In the following examples, we assume that we are
  8351. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8352. 'x' is placed above and below each matched fields.
  8353. With bottom matching (@option{field}=@var{bottom}):
  8354. @example
  8355. Match: c p n b u
  8356. x x x x x
  8357. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8358. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8359. x x x x x
  8360. Output frames:
  8361. 2 1 2 2 2
  8362. 2 2 2 1 3
  8363. @end example
  8364. With top matching (@option{field}=@var{top}):
  8365. @example
  8366. Match: c p n b u
  8367. x x x x x
  8368. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8369. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8370. x x x x x
  8371. Output frames:
  8372. 2 2 2 1 2
  8373. 2 1 3 2 2
  8374. @end example
  8375. @subsection Examples
  8376. Simple IVTC of a top field first telecined stream:
  8377. @example
  8378. fieldmatch=order=tff:combmatch=none, decimate
  8379. @end example
  8380. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8381. @example
  8382. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8383. @end example
  8384. @section fieldorder
  8385. Transform the field order of the input video.
  8386. It accepts the following parameters:
  8387. @table @option
  8388. @item order
  8389. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8390. for bottom field first.
  8391. @end table
  8392. The default value is @samp{tff}.
  8393. The transformation is done by shifting the picture content up or down
  8394. by one line, and filling the remaining line with appropriate picture content.
  8395. This method is consistent with most broadcast field order converters.
  8396. If the input video is not flagged as being interlaced, or it is already
  8397. flagged as being of the required output field order, then this filter does
  8398. not alter the incoming video.
  8399. It is very useful when converting to or from PAL DV material,
  8400. which is bottom field first.
  8401. For example:
  8402. @example
  8403. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8404. @end example
  8405. @section fifo, afifo
  8406. Buffer input images and send them when they are requested.
  8407. It is mainly useful when auto-inserted by the libavfilter
  8408. framework.
  8409. It does not take parameters.
  8410. @section fillborders
  8411. Fill borders of the input video, without changing video stream dimensions.
  8412. Sometimes video can have garbage at the four edges and you may not want to
  8413. crop video input to keep size multiple of some number.
  8414. This filter accepts the following options:
  8415. @table @option
  8416. @item left
  8417. Number of pixels to fill from left border.
  8418. @item right
  8419. Number of pixels to fill from right border.
  8420. @item top
  8421. Number of pixels to fill from top border.
  8422. @item bottom
  8423. Number of pixels to fill from bottom border.
  8424. @item mode
  8425. Set fill mode.
  8426. It accepts the following values:
  8427. @table @samp
  8428. @item smear
  8429. fill pixels using outermost pixels
  8430. @item mirror
  8431. fill pixels using mirroring
  8432. @item fixed
  8433. fill pixels with constant value
  8434. @end table
  8435. Default is @var{smear}.
  8436. @item color
  8437. Set color for pixels in fixed mode. Default is @var{black}.
  8438. @end table
  8439. @subsection Commands
  8440. This filter supports same @ref{commands} as options.
  8441. The command accepts the same syntax of the corresponding option.
  8442. If the specified expression is not valid, it is kept at its current
  8443. value.
  8444. @section find_rect
  8445. Find a rectangular object
  8446. It accepts the following options:
  8447. @table @option
  8448. @item object
  8449. Filepath of the object image, needs to be in gray8.
  8450. @item threshold
  8451. Detection threshold, default is 0.5.
  8452. @item mipmaps
  8453. Number of mipmaps, default is 3.
  8454. @item xmin, ymin, xmax, ymax
  8455. Specifies the rectangle in which to search.
  8456. @end table
  8457. @subsection Examples
  8458. @itemize
  8459. @item
  8460. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8461. @example
  8462. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8463. @end example
  8464. @end itemize
  8465. @section floodfill
  8466. Flood area with values of same pixel components with another values.
  8467. It accepts the following options:
  8468. @table @option
  8469. @item x
  8470. Set pixel x coordinate.
  8471. @item y
  8472. Set pixel y coordinate.
  8473. @item s0
  8474. Set source #0 component value.
  8475. @item s1
  8476. Set source #1 component value.
  8477. @item s2
  8478. Set source #2 component value.
  8479. @item s3
  8480. Set source #3 component value.
  8481. @item d0
  8482. Set destination #0 component value.
  8483. @item d1
  8484. Set destination #1 component value.
  8485. @item d2
  8486. Set destination #2 component value.
  8487. @item d3
  8488. Set destination #3 component value.
  8489. @end table
  8490. @anchor{format}
  8491. @section format
  8492. Convert the input video to one of the specified pixel formats.
  8493. Libavfilter will try to pick one that is suitable as input to
  8494. the next filter.
  8495. It accepts the following parameters:
  8496. @table @option
  8497. @item pix_fmts
  8498. A '|'-separated list of pixel format names, such as
  8499. "pix_fmts=yuv420p|monow|rgb24".
  8500. @end table
  8501. @subsection Examples
  8502. @itemize
  8503. @item
  8504. Convert the input video to the @var{yuv420p} format
  8505. @example
  8506. format=pix_fmts=yuv420p
  8507. @end example
  8508. Convert the input video to any of the formats in the list
  8509. @example
  8510. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8511. @end example
  8512. @end itemize
  8513. @anchor{fps}
  8514. @section fps
  8515. Convert the video to specified constant frame rate by duplicating or dropping
  8516. frames as necessary.
  8517. It accepts the following parameters:
  8518. @table @option
  8519. @item fps
  8520. The desired output frame rate. The default is @code{25}.
  8521. @item start_time
  8522. Assume the first PTS should be the given value, in seconds. This allows for
  8523. padding/trimming at the start of stream. By default, no assumption is made
  8524. about the first frame's expected PTS, so no padding or trimming is done.
  8525. For example, this could be set to 0 to pad the beginning with duplicates of
  8526. the first frame if a video stream starts after the audio stream or to trim any
  8527. frames with a negative PTS.
  8528. @item round
  8529. Timestamp (PTS) rounding method.
  8530. Possible values are:
  8531. @table @option
  8532. @item zero
  8533. round towards 0
  8534. @item inf
  8535. round away from 0
  8536. @item down
  8537. round towards -infinity
  8538. @item up
  8539. round towards +infinity
  8540. @item near
  8541. round to nearest
  8542. @end table
  8543. The default is @code{near}.
  8544. @item eof_action
  8545. Action performed when reading the last frame.
  8546. Possible values are:
  8547. @table @option
  8548. @item round
  8549. Use same timestamp rounding method as used for other frames.
  8550. @item pass
  8551. Pass through last frame if input duration has not been reached yet.
  8552. @end table
  8553. The default is @code{round}.
  8554. @end table
  8555. Alternatively, the options can be specified as a flat string:
  8556. @var{fps}[:@var{start_time}[:@var{round}]].
  8557. See also the @ref{setpts} filter.
  8558. @subsection Examples
  8559. @itemize
  8560. @item
  8561. A typical usage in order to set the fps to 25:
  8562. @example
  8563. fps=fps=25
  8564. @end example
  8565. @item
  8566. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8567. @example
  8568. fps=fps=film:round=near
  8569. @end example
  8570. @end itemize
  8571. @section framepack
  8572. Pack two different video streams into a stereoscopic video, setting proper
  8573. metadata on supported codecs. The two views should have the same size and
  8574. framerate and processing will stop when the shorter video ends. Please note
  8575. that you may conveniently adjust view properties with the @ref{scale} and
  8576. @ref{fps} filters.
  8577. It accepts the following parameters:
  8578. @table @option
  8579. @item format
  8580. The desired packing format. Supported values are:
  8581. @table @option
  8582. @item sbs
  8583. The views are next to each other (default).
  8584. @item tab
  8585. The views are on top of each other.
  8586. @item lines
  8587. The views are packed by line.
  8588. @item columns
  8589. The views are packed by column.
  8590. @item frameseq
  8591. The views are temporally interleaved.
  8592. @end table
  8593. @end table
  8594. Some examples:
  8595. @example
  8596. # Convert left and right views into a frame-sequential video
  8597. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8598. # Convert views into a side-by-side video with the same output resolution as the input
  8599. 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
  8600. @end example
  8601. @section framerate
  8602. Change the frame rate by interpolating new video output frames from the source
  8603. frames.
  8604. This filter is not designed to function correctly with interlaced media. If
  8605. you wish to change the frame rate of interlaced media then you are required
  8606. to deinterlace before this filter and re-interlace after this filter.
  8607. A description of the accepted options follows.
  8608. @table @option
  8609. @item fps
  8610. Specify the output frames per second. This option can also be specified
  8611. as a value alone. The default is @code{50}.
  8612. @item interp_start
  8613. Specify the start of a range where the output frame will be created as a
  8614. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8615. the default is @code{15}.
  8616. @item interp_end
  8617. Specify the end of a range where the output frame will be created as a
  8618. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8619. the default is @code{240}.
  8620. @item scene
  8621. Specify the level at which a scene change is detected as a value between
  8622. 0 and 100 to indicate a new scene; a low value reflects a low
  8623. probability for the current frame to introduce a new scene, while a higher
  8624. value means the current frame is more likely to be one.
  8625. The default is @code{8.2}.
  8626. @item flags
  8627. Specify flags influencing the filter process.
  8628. Available value for @var{flags} is:
  8629. @table @option
  8630. @item scene_change_detect, scd
  8631. Enable scene change detection using the value of the option @var{scene}.
  8632. This flag is enabled by default.
  8633. @end table
  8634. @end table
  8635. @section framestep
  8636. Select one frame every N-th frame.
  8637. This filter accepts the following option:
  8638. @table @option
  8639. @item step
  8640. Select frame after every @code{step} frames.
  8641. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8642. @end table
  8643. @section freezedetect
  8644. Detect frozen video.
  8645. This filter logs a message and sets frame metadata when it detects that the
  8646. input video has no significant change in content during a specified duration.
  8647. Video freeze detection calculates the mean average absolute difference of all
  8648. the components of video frames and compares it to a noise floor.
  8649. The printed times and duration are expressed in seconds. The
  8650. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8651. whose timestamp equals or exceeds the detection duration and it contains the
  8652. timestamp of the first frame of the freeze. The
  8653. @code{lavfi.freezedetect.freeze_duration} and
  8654. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8655. after the freeze.
  8656. The filter accepts the following options:
  8657. @table @option
  8658. @item noise, n
  8659. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8660. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8661. 0.001.
  8662. @item duration, d
  8663. Set freeze duration until notification (default is 2 seconds).
  8664. @end table
  8665. @section freezeframes
  8666. Freeze video frames.
  8667. This filter freezes video frames using frame from 2nd input.
  8668. The filter accepts the following options:
  8669. @table @option
  8670. @item first
  8671. Set number of first frame from which to start freeze.
  8672. @item last
  8673. Set number of last frame from which to end freeze.
  8674. @item replace
  8675. Set number of frame from 2nd input which will be used instead of replaced frames.
  8676. @end table
  8677. @anchor{frei0r}
  8678. @section frei0r
  8679. Apply a frei0r effect to the input video.
  8680. To enable the compilation of this filter, you need to install the frei0r
  8681. header and configure FFmpeg with @code{--enable-frei0r}.
  8682. It accepts the following parameters:
  8683. @table @option
  8684. @item filter_name
  8685. The name of the frei0r effect to load. If the environment variable
  8686. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8687. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8688. Otherwise, the standard frei0r paths are searched, in this order:
  8689. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8690. @file{/usr/lib/frei0r-1/}.
  8691. @item filter_params
  8692. A '|'-separated list of parameters to pass to the frei0r effect.
  8693. @end table
  8694. A frei0r effect parameter can be a boolean (its value is either
  8695. "y" or "n"), a double, a color (specified as
  8696. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8697. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8698. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8699. a position (specified as @var{X}/@var{Y}, where
  8700. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8701. The number and types of parameters depend on the loaded effect. If an
  8702. effect parameter is not specified, the default value is set.
  8703. @subsection Examples
  8704. @itemize
  8705. @item
  8706. Apply the distort0r effect, setting the first two double parameters:
  8707. @example
  8708. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8709. @end example
  8710. @item
  8711. Apply the colordistance effect, taking a color as the first parameter:
  8712. @example
  8713. frei0r=colordistance:0.2/0.3/0.4
  8714. frei0r=colordistance:violet
  8715. frei0r=colordistance:0x112233
  8716. @end example
  8717. @item
  8718. Apply the perspective effect, specifying the top left and top right image
  8719. positions:
  8720. @example
  8721. frei0r=perspective:0.2/0.2|0.8/0.2
  8722. @end example
  8723. @end itemize
  8724. For more information, see
  8725. @url{http://frei0r.dyne.org}
  8726. @section fspp
  8727. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8728. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8729. processing filter, one of them is performed once per block, not per pixel.
  8730. This allows for much higher speed.
  8731. The filter accepts the following options:
  8732. @table @option
  8733. @item quality
  8734. Set quality. This option defines the number of levels for averaging. It accepts
  8735. an integer in the range 4-5. Default value is @code{4}.
  8736. @item qp
  8737. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8738. If not set, the filter will use the QP from the video stream (if available).
  8739. @item strength
  8740. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8741. more details but also more artifacts, while higher values make the image smoother
  8742. but also blurrier. Default value is @code{0} − PSNR optimal.
  8743. @item use_bframe_qp
  8744. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8745. option may cause flicker since the B-Frames have often larger QP. Default is
  8746. @code{0} (not enabled).
  8747. @end table
  8748. @section gblur
  8749. Apply Gaussian blur filter.
  8750. The filter accepts the following options:
  8751. @table @option
  8752. @item sigma
  8753. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8754. @item steps
  8755. Set number of steps for Gaussian approximation. Default is @code{1}.
  8756. @item planes
  8757. Set which planes to filter. By default all planes are filtered.
  8758. @item sigmaV
  8759. Set vertical sigma, if negative it will be same as @code{sigma}.
  8760. Default is @code{-1}.
  8761. @end table
  8762. @subsection Commands
  8763. This filter supports same commands as options.
  8764. The command accepts the same syntax of the corresponding option.
  8765. If the specified expression is not valid, it is kept at its current
  8766. value.
  8767. @section geq
  8768. Apply generic equation to each pixel.
  8769. The filter accepts the following options:
  8770. @table @option
  8771. @item lum_expr, lum
  8772. Set the luminance expression.
  8773. @item cb_expr, cb
  8774. Set the chrominance blue expression.
  8775. @item cr_expr, cr
  8776. Set the chrominance red expression.
  8777. @item alpha_expr, a
  8778. Set the alpha expression.
  8779. @item red_expr, r
  8780. Set the red expression.
  8781. @item green_expr, g
  8782. Set the green expression.
  8783. @item blue_expr, b
  8784. Set the blue expression.
  8785. @end table
  8786. The colorspace is selected according to the specified options. If one
  8787. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8788. options is specified, the filter will automatically select a YCbCr
  8789. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8790. @option{blue_expr} options is specified, it will select an RGB
  8791. colorspace.
  8792. If one of the chrominance expression is not defined, it falls back on the other
  8793. one. If no alpha expression is specified it will evaluate to opaque value.
  8794. If none of chrominance expressions are specified, they will evaluate
  8795. to the luminance expression.
  8796. The expressions can use the following variables and functions:
  8797. @table @option
  8798. @item N
  8799. The sequential number of the filtered frame, starting from @code{0}.
  8800. @item X
  8801. @item Y
  8802. The coordinates of the current sample.
  8803. @item W
  8804. @item H
  8805. The width and height of the image.
  8806. @item SW
  8807. @item SH
  8808. Width and height scale depending on the currently filtered plane. It is the
  8809. ratio between the corresponding luma plane number of pixels and the current
  8810. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8811. @code{0.5,0.5} for chroma planes.
  8812. @item T
  8813. Time of the current frame, expressed in seconds.
  8814. @item p(x, y)
  8815. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8816. plane.
  8817. @item lum(x, y)
  8818. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8819. plane.
  8820. @item cb(x, y)
  8821. Return the value of the pixel at location (@var{x},@var{y}) of the
  8822. blue-difference chroma plane. Return 0 if there is no such plane.
  8823. @item cr(x, y)
  8824. Return the value of the pixel at location (@var{x},@var{y}) of the
  8825. red-difference chroma plane. Return 0 if there is no such plane.
  8826. @item r(x, y)
  8827. @item g(x, y)
  8828. @item b(x, y)
  8829. Return the value of the pixel at location (@var{x},@var{y}) of the
  8830. red/green/blue component. Return 0 if there is no such component.
  8831. @item alpha(x, y)
  8832. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8833. plane. Return 0 if there is no such plane.
  8834. @item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), bsum(x,y), alphasum(x,y)
  8835. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  8836. sums of samples within a rectangle. See the functions without the sum postfix.
  8837. @item interpolation
  8838. Set one of interpolation methods:
  8839. @table @option
  8840. @item nearest, n
  8841. @item bilinear, b
  8842. @end table
  8843. Default is bilinear.
  8844. @end table
  8845. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8846. automatically clipped to the closer edge.
  8847. Please note that this filter can use multiple threads in which case each slice
  8848. will have its own expression state. If you want to use only a single expression
  8849. state because your expressions depend on previous state then you should limit
  8850. the number of filter threads to 1.
  8851. @subsection Examples
  8852. @itemize
  8853. @item
  8854. Flip the image horizontally:
  8855. @example
  8856. geq=p(W-X\,Y)
  8857. @end example
  8858. @item
  8859. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8860. wavelength of 100 pixels:
  8861. @example
  8862. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8863. @end example
  8864. @item
  8865. Generate a fancy enigmatic moving light:
  8866. @example
  8867. 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
  8868. @end example
  8869. @item
  8870. Generate a quick emboss effect:
  8871. @example
  8872. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8873. @end example
  8874. @item
  8875. Modify RGB components depending on pixel position:
  8876. @example
  8877. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8878. @end example
  8879. @item
  8880. Create a radial gradient that is the same size as the input (also see
  8881. the @ref{vignette} filter):
  8882. @example
  8883. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8884. @end example
  8885. @end itemize
  8886. @section gradfun
  8887. Fix the banding artifacts that are sometimes introduced into nearly flat
  8888. regions by truncation to 8-bit color depth.
  8889. Interpolate the gradients that should go where the bands are, and
  8890. dither them.
  8891. It is designed for playback only. Do not use it prior to
  8892. lossy compression, because compression tends to lose the dither and
  8893. bring back the bands.
  8894. It accepts the following parameters:
  8895. @table @option
  8896. @item strength
  8897. The maximum amount by which the filter will change any one pixel. This is also
  8898. the threshold for detecting nearly flat regions. Acceptable values range from
  8899. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8900. valid range.
  8901. @item radius
  8902. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8903. gradients, but also prevents the filter from modifying the pixels near detailed
  8904. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8905. values will be clipped to the valid range.
  8906. @end table
  8907. Alternatively, the options can be specified as a flat string:
  8908. @var{strength}[:@var{radius}]
  8909. @subsection Examples
  8910. @itemize
  8911. @item
  8912. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8913. @example
  8914. gradfun=3.5:8
  8915. @end example
  8916. @item
  8917. Specify radius, omitting the strength (which will fall-back to the default
  8918. value):
  8919. @example
  8920. gradfun=radius=8
  8921. @end example
  8922. @end itemize
  8923. @anchor{graphmonitor}
  8924. @section graphmonitor
  8925. Show various filtergraph stats.
  8926. With this filter one can debug complete filtergraph.
  8927. Especially issues with links filling with queued frames.
  8928. The filter accepts the following options:
  8929. @table @option
  8930. @item size, s
  8931. Set video output size. Default is @var{hd720}.
  8932. @item opacity, o
  8933. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8934. @item mode, m
  8935. Set output mode, can be @var{fulll} or @var{compact}.
  8936. In @var{compact} mode only filters with some queued frames have displayed stats.
  8937. @item flags, f
  8938. Set flags which enable which stats are shown in video.
  8939. Available values for flags are:
  8940. @table @samp
  8941. @item queue
  8942. Display number of queued frames in each link.
  8943. @item frame_count_in
  8944. Display number of frames taken from filter.
  8945. @item frame_count_out
  8946. Display number of frames given out from filter.
  8947. @item pts
  8948. Display current filtered frame pts.
  8949. @item time
  8950. Display current filtered frame time.
  8951. @item timebase
  8952. Display time base for filter link.
  8953. @item format
  8954. Display used format for filter link.
  8955. @item size
  8956. Display video size or number of audio channels in case of audio used by filter link.
  8957. @item rate
  8958. Display video frame rate or sample rate in case of audio used by filter link.
  8959. @end table
  8960. @item rate, r
  8961. Set upper limit for video rate of output stream, Default value is @var{25}.
  8962. This guarantee that output video frame rate will not be higher than this value.
  8963. @end table
  8964. @section greyedge
  8965. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8966. and corrects the scene colors accordingly.
  8967. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8968. The filter accepts the following options:
  8969. @table @option
  8970. @item difford
  8971. The order of differentiation to be applied on the scene. Must be chosen in the range
  8972. [0,2] and default value is 1.
  8973. @item minknorm
  8974. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8975. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8976. max value instead of calculating Minkowski distance.
  8977. @item sigma
  8978. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8979. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8980. can't be equal to 0 if @var{difford} is greater than 0.
  8981. @end table
  8982. @subsection Examples
  8983. @itemize
  8984. @item
  8985. Grey Edge:
  8986. @example
  8987. greyedge=difford=1:minknorm=5:sigma=2
  8988. @end example
  8989. @item
  8990. Max Edge:
  8991. @example
  8992. greyedge=difford=1:minknorm=0:sigma=2
  8993. @end example
  8994. @end itemize
  8995. @anchor{haldclut}
  8996. @section haldclut
  8997. Apply a Hald CLUT to a video stream.
  8998. First input is the video stream to process, and second one is the Hald CLUT.
  8999. The Hald CLUT input can be a simple picture or a complete video stream.
  9000. The filter accepts the following options:
  9001. @table @option
  9002. @item shortest
  9003. Force termination when the shortest input terminates. Default is @code{0}.
  9004. @item repeatlast
  9005. Continue applying the last CLUT after the end of the stream. A value of
  9006. @code{0} disable the filter after the last frame of the CLUT is reached.
  9007. Default is @code{1}.
  9008. @end table
  9009. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9010. filters share the same internals).
  9011. This filter also supports the @ref{framesync} options.
  9012. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9013. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9014. @subsection Workflow examples
  9015. @subsubsection Hald CLUT video stream
  9016. Generate an identity Hald CLUT stream altered with various effects:
  9017. @example
  9018. 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
  9019. @end example
  9020. Note: make sure you use a lossless codec.
  9021. Then use it with @code{haldclut} to apply it on some random stream:
  9022. @example
  9023. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9024. @end example
  9025. The Hald CLUT will be applied to the 10 first seconds (duration of
  9026. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9027. to the remaining frames of the @code{mandelbrot} stream.
  9028. @subsubsection Hald CLUT with preview
  9029. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9030. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9031. biggest possible square starting at the top left of the picture. The remaining
  9032. padding pixels (bottom or right) will be ignored. This area can be used to add
  9033. a preview of the Hald CLUT.
  9034. Typically, the following generated Hald CLUT will be supported by the
  9035. @code{haldclut} filter:
  9036. @example
  9037. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9038. pad=iw+320 [padded_clut];
  9039. smptebars=s=320x256, split [a][b];
  9040. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9041. [main][b] overlay=W-320" -frames:v 1 clut.png
  9042. @end example
  9043. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9044. bars are displayed on the right-top, and below the same color bars processed by
  9045. the color changes.
  9046. Then, the effect of this Hald CLUT can be visualized with:
  9047. @example
  9048. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9049. @end example
  9050. @section hflip
  9051. Flip the input video horizontally.
  9052. For example, to horizontally flip the input video with @command{ffmpeg}:
  9053. @example
  9054. ffmpeg -i in.avi -vf "hflip" out.avi
  9055. @end example
  9056. @section histeq
  9057. This filter applies a global color histogram equalization on a
  9058. per-frame basis.
  9059. It can be used to correct video that has a compressed range of pixel
  9060. intensities. The filter redistributes the pixel intensities to
  9061. equalize their distribution across the intensity range. It may be
  9062. viewed as an "automatically adjusting contrast filter". This filter is
  9063. useful only for correcting degraded or poorly captured source
  9064. video.
  9065. The filter accepts the following options:
  9066. @table @option
  9067. @item strength
  9068. Determine the amount of equalization to be applied. As the strength
  9069. is reduced, the distribution of pixel intensities more-and-more
  9070. approaches that of the input frame. The value must be a float number
  9071. in the range [0,1] and defaults to 0.200.
  9072. @item intensity
  9073. Set the maximum intensity that can generated and scale the output
  9074. values appropriately. The strength should be set as desired and then
  9075. the intensity can be limited if needed to avoid washing-out. The value
  9076. must be a float number in the range [0,1] and defaults to 0.210.
  9077. @item antibanding
  9078. Set the antibanding level. If enabled the filter will randomly vary
  9079. the luminance of output pixels by a small amount to avoid banding of
  9080. the histogram. Possible values are @code{none}, @code{weak} or
  9081. @code{strong}. It defaults to @code{none}.
  9082. @end table
  9083. @anchor{histogram}
  9084. @section histogram
  9085. Compute and draw a color distribution histogram for the input video.
  9086. The computed histogram is a representation of the color component
  9087. distribution in an image.
  9088. Standard histogram displays the color components distribution in an image.
  9089. Displays color graph for each color component. Shows distribution of
  9090. the Y, U, V, A or R, G, B components, depending on input format, in the
  9091. current frame. Below each graph a color component scale meter is shown.
  9092. The filter accepts the following options:
  9093. @table @option
  9094. @item level_height
  9095. Set height of level. Default value is @code{200}.
  9096. Allowed range is [50, 2048].
  9097. @item scale_height
  9098. Set height of color scale. Default value is @code{12}.
  9099. Allowed range is [0, 40].
  9100. @item display_mode
  9101. Set display mode.
  9102. It accepts the following values:
  9103. @table @samp
  9104. @item stack
  9105. Per color component graphs are placed below each other.
  9106. @item parade
  9107. Per color component graphs are placed side by side.
  9108. @item overlay
  9109. Presents information identical to that in the @code{parade}, except
  9110. that the graphs representing color components are superimposed directly
  9111. over one another.
  9112. @end table
  9113. Default is @code{stack}.
  9114. @item levels_mode
  9115. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9116. Default is @code{linear}.
  9117. @item components
  9118. Set what color components to display.
  9119. Default is @code{7}.
  9120. @item fgopacity
  9121. Set foreground opacity. Default is @code{0.7}.
  9122. @item bgopacity
  9123. Set background opacity. Default is @code{0.5}.
  9124. @end table
  9125. @subsection Examples
  9126. @itemize
  9127. @item
  9128. Calculate and draw histogram:
  9129. @example
  9130. ffplay -i input -vf histogram
  9131. @end example
  9132. @end itemize
  9133. @anchor{hqdn3d}
  9134. @section hqdn3d
  9135. This is a high precision/quality 3d denoise filter. It aims to reduce
  9136. image noise, producing smooth images and making still images really
  9137. still. It should enhance compressibility.
  9138. It accepts the following optional parameters:
  9139. @table @option
  9140. @item luma_spatial
  9141. A non-negative floating point number which specifies spatial luma strength.
  9142. It defaults to 4.0.
  9143. @item chroma_spatial
  9144. A non-negative floating point number which specifies spatial chroma strength.
  9145. It defaults to 3.0*@var{luma_spatial}/4.0.
  9146. @item luma_tmp
  9147. A floating point number which specifies luma temporal strength. It defaults to
  9148. 6.0*@var{luma_spatial}/4.0.
  9149. @item chroma_tmp
  9150. A floating point number which specifies chroma temporal strength. It defaults to
  9151. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9152. @end table
  9153. @subsection Commands
  9154. This filter supports same @ref{commands} as options.
  9155. The command accepts the same syntax of the corresponding option.
  9156. If the specified expression is not valid, it is kept at its current
  9157. value.
  9158. @anchor{hwdownload}
  9159. @section hwdownload
  9160. Download hardware frames to system memory.
  9161. The input must be in hardware frames, and the output a non-hardware format.
  9162. Not all formats will be supported on the output - it may be necessary to insert
  9163. an additional @option{format} filter immediately following in the graph to get
  9164. the output in a supported format.
  9165. @section hwmap
  9166. Map hardware frames to system memory or to another device.
  9167. This filter has several different modes of operation; which one is used depends
  9168. on the input and output formats:
  9169. @itemize
  9170. @item
  9171. Hardware frame input, normal frame output
  9172. Map the input frames to system memory and pass them to the output. If the
  9173. original hardware frame is later required (for example, after overlaying
  9174. something else on part of it), the @option{hwmap} filter can be used again
  9175. in the next mode to retrieve it.
  9176. @item
  9177. Normal frame input, hardware frame output
  9178. If the input is actually a software-mapped hardware frame, then unmap it -
  9179. that is, return the original hardware frame.
  9180. Otherwise, a device must be provided. Create new hardware surfaces on that
  9181. device for the output, then map them back to the software format at the input
  9182. and give those frames to the preceding filter. This will then act like the
  9183. @option{hwupload} filter, but may be able to avoid an additional copy when
  9184. the input is already in a compatible format.
  9185. @item
  9186. Hardware frame input and output
  9187. A device must be supplied for the output, either directly or with the
  9188. @option{derive_device} option. The input and output devices must be of
  9189. different types and compatible - the exact meaning of this is
  9190. system-dependent, but typically it means that they must refer to the same
  9191. underlying hardware context (for example, refer to the same graphics card).
  9192. If the input frames were originally created on the output device, then unmap
  9193. to retrieve the original frames.
  9194. Otherwise, map the frames to the output device - create new hardware frames
  9195. on the output corresponding to the frames on the input.
  9196. @end itemize
  9197. The following additional parameters are accepted:
  9198. @table @option
  9199. @item mode
  9200. Set the frame mapping mode. Some combination of:
  9201. @table @var
  9202. @item read
  9203. The mapped frame should be readable.
  9204. @item write
  9205. The mapped frame should be writeable.
  9206. @item overwrite
  9207. The mapping will always overwrite the entire frame.
  9208. This may improve performance in some cases, as the original contents of the
  9209. frame need not be loaded.
  9210. @item direct
  9211. The mapping must not involve any copying.
  9212. Indirect mappings to copies of frames are created in some cases where either
  9213. direct mapping is not possible or it would have unexpected properties.
  9214. Setting this flag ensures that the mapping is direct and will fail if that is
  9215. not possible.
  9216. @end table
  9217. Defaults to @var{read+write} if not specified.
  9218. @item derive_device @var{type}
  9219. Rather than using the device supplied at initialisation, instead derive a new
  9220. device of type @var{type} from the device the input frames exist on.
  9221. @item reverse
  9222. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9223. and map them back to the source. This may be necessary in some cases where
  9224. a mapping in one direction is required but only the opposite direction is
  9225. supported by the devices being used.
  9226. This option is dangerous - it may break the preceding filter in undefined
  9227. ways if there are any additional constraints on that filter's output.
  9228. Do not use it without fully understanding the implications of its use.
  9229. @end table
  9230. @anchor{hwupload}
  9231. @section hwupload
  9232. Upload system memory frames to hardware surfaces.
  9233. The device to upload to must be supplied when the filter is initialised. If
  9234. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9235. option or with the @option{derive_device} option. The input and output devices
  9236. must be of different types and compatible - the exact meaning of this is
  9237. system-dependent, but typically it means that they must refer to the same
  9238. underlying hardware context (for example, refer to the same graphics card).
  9239. The following additional parameters are accepted:
  9240. @table @option
  9241. @item derive_device @var{type}
  9242. Rather than using the device supplied at initialisation, instead derive a new
  9243. device of type @var{type} from the device the input frames exist on.
  9244. @end table
  9245. @anchor{hwupload_cuda}
  9246. @section hwupload_cuda
  9247. Upload system memory frames to a CUDA device.
  9248. It accepts the following optional parameters:
  9249. @table @option
  9250. @item device
  9251. The number of the CUDA device to use
  9252. @end table
  9253. @section hqx
  9254. Apply a high-quality magnification filter designed for pixel art. This filter
  9255. was originally created by Maxim Stepin.
  9256. It accepts the following option:
  9257. @table @option
  9258. @item n
  9259. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9260. @code{hq3x} and @code{4} for @code{hq4x}.
  9261. Default is @code{3}.
  9262. @end table
  9263. @section hstack
  9264. Stack input videos horizontally.
  9265. All streams must be of same pixel format and of same height.
  9266. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9267. to create same output.
  9268. The filter accepts the following option:
  9269. @table @option
  9270. @item inputs
  9271. Set number of input streams. Default is 2.
  9272. @item shortest
  9273. If set to 1, force the output to terminate when the shortest input
  9274. terminates. Default value is 0.
  9275. @end table
  9276. @section hue
  9277. Modify the hue and/or the saturation of the input.
  9278. It accepts the following parameters:
  9279. @table @option
  9280. @item h
  9281. Specify the hue angle as a number of degrees. It accepts an expression,
  9282. and defaults to "0".
  9283. @item s
  9284. Specify the saturation in the [-10,10] range. It accepts an expression and
  9285. defaults to "1".
  9286. @item H
  9287. Specify the hue angle as a number of radians. It accepts an
  9288. expression, and defaults to "0".
  9289. @item b
  9290. Specify the brightness in the [-10,10] range. It accepts an expression and
  9291. defaults to "0".
  9292. @end table
  9293. @option{h} and @option{H} are mutually exclusive, and can't be
  9294. specified at the same time.
  9295. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9296. expressions containing the following constants:
  9297. @table @option
  9298. @item n
  9299. frame count of the input frame starting from 0
  9300. @item pts
  9301. presentation timestamp of the input frame expressed in time base units
  9302. @item r
  9303. frame rate of the input video, NAN if the input frame rate is unknown
  9304. @item t
  9305. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9306. @item tb
  9307. time base of the input video
  9308. @end table
  9309. @subsection Examples
  9310. @itemize
  9311. @item
  9312. Set the hue to 90 degrees and the saturation to 1.0:
  9313. @example
  9314. hue=h=90:s=1
  9315. @end example
  9316. @item
  9317. Same command but expressing the hue in radians:
  9318. @example
  9319. hue=H=PI/2:s=1
  9320. @end example
  9321. @item
  9322. Rotate hue and make the saturation swing between 0
  9323. and 2 over a period of 1 second:
  9324. @example
  9325. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9326. @end example
  9327. @item
  9328. Apply a 3 seconds saturation fade-in effect starting at 0:
  9329. @example
  9330. hue="s=min(t/3\,1)"
  9331. @end example
  9332. The general fade-in expression can be written as:
  9333. @example
  9334. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9335. @end example
  9336. @item
  9337. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9338. @example
  9339. hue="s=max(0\, min(1\, (8-t)/3))"
  9340. @end example
  9341. The general fade-out expression can be written as:
  9342. @example
  9343. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9344. @end example
  9345. @end itemize
  9346. @subsection Commands
  9347. This filter supports the following commands:
  9348. @table @option
  9349. @item b
  9350. @item s
  9351. @item h
  9352. @item H
  9353. Modify the hue and/or the saturation and/or brightness of the input video.
  9354. The command accepts the same syntax of the corresponding option.
  9355. If the specified expression is not valid, it is kept at its current
  9356. value.
  9357. @end table
  9358. @section hysteresis
  9359. Grow first stream into second stream by connecting components.
  9360. This makes it possible to build more robust edge masks.
  9361. This filter accepts the following options:
  9362. @table @option
  9363. @item planes
  9364. Set which planes will be processed as bitmap, unprocessed planes will be
  9365. copied from first stream.
  9366. By default value 0xf, all planes will be processed.
  9367. @item threshold
  9368. Set threshold which is used in filtering. If pixel component value is higher than
  9369. this value filter algorithm for connecting components is activated.
  9370. By default value is 0.
  9371. @end table
  9372. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9373. @section idet
  9374. Detect video interlacing type.
  9375. This filter tries to detect if the input frames are interlaced, progressive,
  9376. top or bottom field first. It will also try to detect fields that are
  9377. repeated between adjacent frames (a sign of telecine).
  9378. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9379. Multiple frame detection incorporates the classification history of previous frames.
  9380. The filter will log these metadata values:
  9381. @table @option
  9382. @item single.current_frame
  9383. Detected type of current frame using single-frame detection. One of:
  9384. ``tff'' (top field first), ``bff'' (bottom field first),
  9385. ``progressive'', or ``undetermined''
  9386. @item single.tff
  9387. Cumulative number of frames detected as top field first using single-frame detection.
  9388. @item multiple.tff
  9389. Cumulative number of frames detected as top field first using multiple-frame detection.
  9390. @item single.bff
  9391. Cumulative number of frames detected as bottom field first using single-frame detection.
  9392. @item multiple.current_frame
  9393. Detected type of current frame using multiple-frame detection. One of:
  9394. ``tff'' (top field first), ``bff'' (bottom field first),
  9395. ``progressive'', or ``undetermined''
  9396. @item multiple.bff
  9397. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9398. @item single.progressive
  9399. Cumulative number of frames detected as progressive using single-frame detection.
  9400. @item multiple.progressive
  9401. Cumulative number of frames detected as progressive using multiple-frame detection.
  9402. @item single.undetermined
  9403. Cumulative number of frames that could not be classified using single-frame detection.
  9404. @item multiple.undetermined
  9405. Cumulative number of frames that could not be classified using multiple-frame detection.
  9406. @item repeated.current_frame
  9407. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9408. @item repeated.neither
  9409. Cumulative number of frames with no repeated field.
  9410. @item repeated.top
  9411. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9412. @item repeated.bottom
  9413. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9414. @end table
  9415. The filter accepts the following options:
  9416. @table @option
  9417. @item intl_thres
  9418. Set interlacing threshold.
  9419. @item prog_thres
  9420. Set progressive threshold.
  9421. @item rep_thres
  9422. Threshold for repeated field detection.
  9423. @item half_life
  9424. Number of frames after which a given frame's contribution to the
  9425. statistics is halved (i.e., it contributes only 0.5 to its
  9426. classification). The default of 0 means that all frames seen are given
  9427. full weight of 1.0 forever.
  9428. @item analyze_interlaced_flag
  9429. When this is not 0 then idet will use the specified number of frames to determine
  9430. if the interlaced flag is accurate, it will not count undetermined frames.
  9431. If the flag is found to be accurate it will be used without any further
  9432. computations, if it is found to be inaccurate it will be cleared without any
  9433. further computations. This allows inserting the idet filter as a low computational
  9434. method to clean up the interlaced flag
  9435. @end table
  9436. @section il
  9437. Deinterleave or interleave fields.
  9438. This filter allows one to process interlaced images fields without
  9439. deinterlacing them. Deinterleaving splits the input frame into 2
  9440. fields (so called half pictures). Odd lines are moved to the top
  9441. half of the output image, even lines to the bottom half.
  9442. You can process (filter) them independently and then re-interleave them.
  9443. The filter accepts the following options:
  9444. @table @option
  9445. @item luma_mode, l
  9446. @item chroma_mode, c
  9447. @item alpha_mode, a
  9448. Available values for @var{luma_mode}, @var{chroma_mode} and
  9449. @var{alpha_mode} are:
  9450. @table @samp
  9451. @item none
  9452. Do nothing.
  9453. @item deinterleave, d
  9454. Deinterleave fields, placing one above the other.
  9455. @item interleave, i
  9456. Interleave fields. Reverse the effect of deinterleaving.
  9457. @end table
  9458. Default value is @code{none}.
  9459. @item luma_swap, ls
  9460. @item chroma_swap, cs
  9461. @item alpha_swap, as
  9462. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9463. @end table
  9464. @subsection Commands
  9465. This filter supports the all above options as @ref{commands}.
  9466. @section inflate
  9467. Apply inflate effect to the video.
  9468. This filter replaces the pixel by the local(3x3) average by taking into account
  9469. only values higher than the pixel.
  9470. It accepts the following options:
  9471. @table @option
  9472. @item threshold0
  9473. @item threshold1
  9474. @item threshold2
  9475. @item threshold3
  9476. Limit the maximum change for each plane, default is 65535.
  9477. If 0, plane will remain unchanged.
  9478. @end table
  9479. @subsection Commands
  9480. This filter supports the all above options as @ref{commands}.
  9481. @section interlace
  9482. Simple interlacing filter from progressive contents. This interleaves upper (or
  9483. lower) lines from odd frames with lower (or upper) lines from even frames,
  9484. halving the frame rate and preserving image height.
  9485. @example
  9486. Original Original New Frame
  9487. Frame 'j' Frame 'j+1' (tff)
  9488. ========== =========== ==================
  9489. Line 0 --------------------> Frame 'j' Line 0
  9490. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9491. Line 2 ---------------------> Frame 'j' Line 2
  9492. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9493. ... ... ...
  9494. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9495. @end example
  9496. It accepts the following optional parameters:
  9497. @table @option
  9498. @item scan
  9499. This determines whether the interlaced frame is taken from the even
  9500. (tff - default) or odd (bff) lines of the progressive frame.
  9501. @item lowpass
  9502. Vertical lowpass filter to avoid twitter interlacing and
  9503. reduce moire patterns.
  9504. @table @samp
  9505. @item 0, off
  9506. Disable vertical lowpass filter
  9507. @item 1, linear
  9508. Enable linear filter (default)
  9509. @item 2, complex
  9510. Enable complex filter. This will slightly less reduce twitter and moire
  9511. but better retain detail and subjective sharpness impression.
  9512. @end table
  9513. @end table
  9514. @section kerndeint
  9515. Deinterlace input video by applying Donald Graft's adaptive kernel
  9516. deinterling. Work on interlaced parts of a video to produce
  9517. progressive frames.
  9518. The description of the accepted parameters follows.
  9519. @table @option
  9520. @item thresh
  9521. Set the threshold which affects the filter's tolerance when
  9522. determining if a pixel line must be processed. It must be an integer
  9523. in the range [0,255] and defaults to 10. A value of 0 will result in
  9524. applying the process on every pixels.
  9525. @item map
  9526. Paint pixels exceeding the threshold value to white if set to 1.
  9527. Default is 0.
  9528. @item order
  9529. Set the fields order. Swap fields if set to 1, leave fields alone if
  9530. 0. Default is 0.
  9531. @item sharp
  9532. Enable additional sharpening if set to 1. Default is 0.
  9533. @item twoway
  9534. Enable twoway sharpening if set to 1. Default is 0.
  9535. @end table
  9536. @subsection Examples
  9537. @itemize
  9538. @item
  9539. Apply default values:
  9540. @example
  9541. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9542. @end example
  9543. @item
  9544. Enable additional sharpening:
  9545. @example
  9546. kerndeint=sharp=1
  9547. @end example
  9548. @item
  9549. Paint processed pixels in white:
  9550. @example
  9551. kerndeint=map=1
  9552. @end example
  9553. @end itemize
  9554. @section lagfun
  9555. Slowly update darker pixels.
  9556. This filter makes short flashes of light appear longer.
  9557. This filter accepts the following options:
  9558. @table @option
  9559. @item decay
  9560. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9561. @item planes
  9562. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9563. @end table
  9564. @section lenscorrection
  9565. Correct radial lens distortion
  9566. This filter can be used to correct for radial distortion as can result from the use
  9567. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9568. one can use tools available for example as part of opencv or simply trial-and-error.
  9569. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9570. and extract the k1 and k2 coefficients from the resulting matrix.
  9571. Note that effectively the same filter is available in the open-source tools Krita and
  9572. Digikam from the KDE project.
  9573. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9574. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9575. brightness distribution, so you may want to use both filters together in certain
  9576. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9577. be applied before or after lens correction.
  9578. @subsection Options
  9579. The filter accepts the following options:
  9580. @table @option
  9581. @item cx
  9582. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9583. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9584. width. Default is 0.5.
  9585. @item cy
  9586. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9587. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9588. height. Default is 0.5.
  9589. @item k1
  9590. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9591. no correction. Default is 0.
  9592. @item k2
  9593. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9594. 0 means no correction. Default is 0.
  9595. @end table
  9596. The formula that generates the correction is:
  9597. @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)
  9598. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9599. distances from the focal point in the source and target images, respectively.
  9600. @section lensfun
  9601. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9602. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9603. to apply the lens correction. The filter will load the lensfun database and
  9604. query it to find the corresponding camera and lens entries in the database. As
  9605. long as these entries can be found with the given options, the filter can
  9606. perform corrections on frames. Note that incomplete strings will result in the
  9607. filter choosing the best match with the given options, and the filter will
  9608. output the chosen camera and lens models (logged with level "info"). You must
  9609. provide the make, camera model, and lens model as they are required.
  9610. The filter accepts the following options:
  9611. @table @option
  9612. @item make
  9613. The make of the camera (for example, "Canon"). This option is required.
  9614. @item model
  9615. The model of the camera (for example, "Canon EOS 100D"). This option is
  9616. required.
  9617. @item lens_model
  9618. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9619. option is required.
  9620. @item mode
  9621. The type of correction to apply. The following values are valid options:
  9622. @table @samp
  9623. @item vignetting
  9624. Enables fixing lens vignetting.
  9625. @item geometry
  9626. Enables fixing lens geometry. This is the default.
  9627. @item subpixel
  9628. Enables fixing chromatic aberrations.
  9629. @item vig_geo
  9630. Enables fixing lens vignetting and lens geometry.
  9631. @item vig_subpixel
  9632. Enables fixing lens vignetting and chromatic aberrations.
  9633. @item distortion
  9634. Enables fixing both lens geometry and chromatic aberrations.
  9635. @item all
  9636. Enables all possible corrections.
  9637. @end table
  9638. @item focal_length
  9639. The focal length of the image/video (zoom; expected constant for video). For
  9640. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9641. range should be chosen when using that lens. Default 18.
  9642. @item aperture
  9643. The aperture of the image/video (expected constant for video). Note that
  9644. aperture is only used for vignetting correction. Default 3.5.
  9645. @item focus_distance
  9646. The focus distance of the image/video (expected constant for video). Note that
  9647. focus distance is only used for vignetting and only slightly affects the
  9648. vignetting correction process. If unknown, leave it at the default value (which
  9649. is 1000).
  9650. @item scale
  9651. The scale factor which is applied after transformation. After correction the
  9652. video is no longer necessarily rectangular. This parameter controls how much of
  9653. the resulting image is visible. The value 0 means that a value will be chosen
  9654. automatically such that there is little or no unmapped area in the output
  9655. image. 1.0 means that no additional scaling is done. Lower values may result
  9656. in more of the corrected image being visible, while higher values may avoid
  9657. unmapped areas in the output.
  9658. @item target_geometry
  9659. The target geometry of the output image/video. The following values are valid
  9660. options:
  9661. @table @samp
  9662. @item rectilinear (default)
  9663. @item fisheye
  9664. @item panoramic
  9665. @item equirectangular
  9666. @item fisheye_orthographic
  9667. @item fisheye_stereographic
  9668. @item fisheye_equisolid
  9669. @item fisheye_thoby
  9670. @end table
  9671. @item reverse
  9672. Apply the reverse of image correction (instead of correcting distortion, apply
  9673. it).
  9674. @item interpolation
  9675. The type of interpolation used when correcting distortion. The following values
  9676. are valid options:
  9677. @table @samp
  9678. @item nearest
  9679. @item linear (default)
  9680. @item lanczos
  9681. @end table
  9682. @end table
  9683. @subsection Examples
  9684. @itemize
  9685. @item
  9686. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9687. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9688. aperture of "8.0".
  9689. @example
  9690. 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
  9691. @end example
  9692. @item
  9693. Apply the same as before, but only for the first 5 seconds of video.
  9694. @example
  9695. 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
  9696. @end example
  9697. @end itemize
  9698. @section libvmaf
  9699. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9700. score between two input videos.
  9701. The obtained VMAF score is printed through the logging system.
  9702. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9703. After installing the library it can be enabled using:
  9704. @code{./configure --enable-libvmaf --enable-version3}.
  9705. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9706. The filter has following options:
  9707. @table @option
  9708. @item model_path
  9709. Set the model path which is to be used for SVM.
  9710. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9711. @item log_path
  9712. Set the file path to be used to store logs.
  9713. @item log_fmt
  9714. Set the format of the log file (xml or json).
  9715. @item enable_transform
  9716. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9717. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9718. Default value: @code{false}
  9719. @item phone_model
  9720. Invokes the phone model which will generate VMAF scores higher than in the
  9721. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9722. Default value: @code{false}
  9723. @item psnr
  9724. Enables computing psnr along with vmaf.
  9725. Default value: @code{false}
  9726. @item ssim
  9727. Enables computing ssim along with vmaf.
  9728. Default value: @code{false}
  9729. @item ms_ssim
  9730. Enables computing ms_ssim along with vmaf.
  9731. Default value: @code{false}
  9732. @item pool
  9733. Set the pool method to be used for computing vmaf.
  9734. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9735. @item n_threads
  9736. Set number of threads to be used when computing vmaf.
  9737. Default value: @code{0}, which makes use of all available logical processors.
  9738. @item n_subsample
  9739. Set interval for frame subsampling used when computing vmaf.
  9740. Default value: @code{1}
  9741. @item enable_conf_interval
  9742. Enables confidence interval.
  9743. Default value: @code{false}
  9744. @end table
  9745. This filter also supports the @ref{framesync} options.
  9746. @subsection Examples
  9747. @itemize
  9748. @item
  9749. On the below examples the input file @file{main.mpg} being processed is
  9750. compared with the reference file @file{ref.mpg}.
  9751. @example
  9752. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9753. @end example
  9754. @item
  9755. Example with options:
  9756. @example
  9757. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9758. @end example
  9759. @item
  9760. Example with options and different containers:
  9761. @example
  9762. 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 -
  9763. @end example
  9764. @end itemize
  9765. @section limiter
  9766. Limits the pixel components values to the specified range [min, max].
  9767. The filter accepts the following options:
  9768. @table @option
  9769. @item min
  9770. Lower bound. Defaults to the lowest allowed value for the input.
  9771. @item max
  9772. Upper bound. Defaults to the highest allowed value for the input.
  9773. @item planes
  9774. Specify which planes will be processed. Defaults to all available.
  9775. @end table
  9776. @section loop
  9777. Loop video frames.
  9778. The filter accepts the following options:
  9779. @table @option
  9780. @item loop
  9781. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9782. Default is 0.
  9783. @item size
  9784. Set maximal size in number of frames. Default is 0.
  9785. @item start
  9786. Set first frame of loop. Default is 0.
  9787. @end table
  9788. @subsection Examples
  9789. @itemize
  9790. @item
  9791. Loop single first frame infinitely:
  9792. @example
  9793. loop=loop=-1:size=1:start=0
  9794. @end example
  9795. @item
  9796. Loop single first frame 10 times:
  9797. @example
  9798. loop=loop=10:size=1:start=0
  9799. @end example
  9800. @item
  9801. Loop 10 first frames 5 times:
  9802. @example
  9803. loop=loop=5:size=10:start=0
  9804. @end example
  9805. @end itemize
  9806. @section lut1d
  9807. Apply a 1D LUT to an input video.
  9808. The filter accepts the following options:
  9809. @table @option
  9810. @item file
  9811. Set the 1D LUT file name.
  9812. Currently supported formats:
  9813. @table @samp
  9814. @item cube
  9815. Iridas
  9816. @item csp
  9817. cineSpace
  9818. @end table
  9819. @item interp
  9820. Select interpolation mode.
  9821. Available values are:
  9822. @table @samp
  9823. @item nearest
  9824. Use values from the nearest defined point.
  9825. @item linear
  9826. Interpolate values using the linear interpolation.
  9827. @item cosine
  9828. Interpolate values using the cosine interpolation.
  9829. @item cubic
  9830. Interpolate values using the cubic interpolation.
  9831. @item spline
  9832. Interpolate values using the spline interpolation.
  9833. @end table
  9834. @end table
  9835. @anchor{lut3d}
  9836. @section lut3d
  9837. Apply a 3D LUT to an input video.
  9838. The filter accepts the following options:
  9839. @table @option
  9840. @item file
  9841. Set the 3D LUT file name.
  9842. Currently supported formats:
  9843. @table @samp
  9844. @item 3dl
  9845. AfterEffects
  9846. @item cube
  9847. Iridas
  9848. @item dat
  9849. DaVinci
  9850. @item m3d
  9851. Pandora
  9852. @item csp
  9853. cineSpace
  9854. @end table
  9855. @item interp
  9856. Select interpolation mode.
  9857. Available values are:
  9858. @table @samp
  9859. @item nearest
  9860. Use values from the nearest defined point.
  9861. @item trilinear
  9862. Interpolate values using the 8 points defining a cube.
  9863. @item tetrahedral
  9864. Interpolate values using a tetrahedron.
  9865. @end table
  9866. @end table
  9867. @section lumakey
  9868. Turn certain luma values into transparency.
  9869. The filter accepts the following options:
  9870. @table @option
  9871. @item threshold
  9872. Set the luma which will be used as base for transparency.
  9873. Default value is @code{0}.
  9874. @item tolerance
  9875. Set the range of luma values to be keyed out.
  9876. Default value is @code{0.01}.
  9877. @item softness
  9878. Set the range of softness. Default value is @code{0}.
  9879. Use this to control gradual transition from zero to full transparency.
  9880. @end table
  9881. @subsection Commands
  9882. This filter supports same @ref{commands} as options.
  9883. The command accepts the same syntax of the corresponding option.
  9884. If the specified expression is not valid, it is kept at its current
  9885. value.
  9886. @section lut, lutrgb, lutyuv
  9887. Compute a look-up table for binding each pixel component input value
  9888. to an output value, and apply it to the input video.
  9889. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9890. to an RGB input video.
  9891. These filters accept 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 r
  9902. set red component expression
  9903. @item g
  9904. set green component expression
  9905. @item b
  9906. set blue component expression
  9907. @item a
  9908. alpha component expression
  9909. @item y
  9910. set Y/luminance component expression
  9911. @item u
  9912. set U/Cb component expression
  9913. @item v
  9914. set V/Cr component expression
  9915. @end table
  9916. Each of them specifies the expression to use for computing the lookup table for
  9917. the corresponding pixel component values.
  9918. The exact component associated to each of the @var{c*} options depends on the
  9919. format in input.
  9920. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9921. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9922. The expressions can contain the following constants and functions:
  9923. @table @option
  9924. @item w
  9925. @item h
  9926. The input width and height.
  9927. @item val
  9928. The input value for the pixel component.
  9929. @item clipval
  9930. The input value, clipped to the @var{minval}-@var{maxval} range.
  9931. @item maxval
  9932. The maximum value for the pixel component.
  9933. @item minval
  9934. The minimum value for the pixel component.
  9935. @item negval
  9936. The negated value for the pixel component value, clipped to the
  9937. @var{minval}-@var{maxval} range; it corresponds to the expression
  9938. "maxval-clipval+minval".
  9939. @item clip(val)
  9940. The computed value in @var{val}, clipped to the
  9941. @var{minval}-@var{maxval} range.
  9942. @item gammaval(gamma)
  9943. The computed gamma correction value of the pixel component value,
  9944. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9945. expression
  9946. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9947. @end table
  9948. All expressions default to "val".
  9949. @subsection Examples
  9950. @itemize
  9951. @item
  9952. Negate input video:
  9953. @example
  9954. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9955. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9956. @end example
  9957. The above is the same as:
  9958. @example
  9959. lutrgb="r=negval:g=negval:b=negval"
  9960. lutyuv="y=negval:u=negval:v=negval"
  9961. @end example
  9962. @item
  9963. Negate luminance:
  9964. @example
  9965. lutyuv=y=negval
  9966. @end example
  9967. @item
  9968. Remove chroma components, turning the video into a graytone image:
  9969. @example
  9970. lutyuv="u=128:v=128"
  9971. @end example
  9972. @item
  9973. Apply a luma burning effect:
  9974. @example
  9975. lutyuv="y=2*val"
  9976. @end example
  9977. @item
  9978. Remove green and blue components:
  9979. @example
  9980. lutrgb="g=0:b=0"
  9981. @end example
  9982. @item
  9983. Set a constant alpha channel value on input:
  9984. @example
  9985. format=rgba,lutrgb=a="maxval-minval/2"
  9986. @end example
  9987. @item
  9988. Correct luminance gamma by a factor of 0.5:
  9989. @example
  9990. lutyuv=y=gammaval(0.5)
  9991. @end example
  9992. @item
  9993. Discard least significant bits of luma:
  9994. @example
  9995. lutyuv=y='bitand(val, 128+64+32)'
  9996. @end example
  9997. @item
  9998. Technicolor like effect:
  9999. @example
  10000. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10001. @end example
  10002. @end itemize
  10003. @section lut2, tlut2
  10004. The @code{lut2} filter takes two input streams and outputs one
  10005. stream.
  10006. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10007. from one single stream.
  10008. This filter accepts the following parameters:
  10009. @table @option
  10010. @item c0
  10011. set first pixel component expression
  10012. @item c1
  10013. set second pixel component expression
  10014. @item c2
  10015. set third pixel component expression
  10016. @item c3
  10017. set fourth pixel component expression, corresponds to the alpha component
  10018. @item d
  10019. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10020. which means bit depth is automatically picked from first input format.
  10021. @end table
  10022. The @code{lut2} filter also supports the @ref{framesync} options.
  10023. Each of them specifies the expression to use for computing the lookup table for
  10024. the corresponding pixel component values.
  10025. The exact component associated to each of the @var{c*} options depends on the
  10026. format in inputs.
  10027. The expressions can contain the following constants:
  10028. @table @option
  10029. @item w
  10030. @item h
  10031. The input width and height.
  10032. @item x
  10033. The first input value for the pixel component.
  10034. @item y
  10035. The second input value for the pixel component.
  10036. @item bdx
  10037. The first input video bit depth.
  10038. @item bdy
  10039. The second input video bit depth.
  10040. @end table
  10041. All expressions default to "x".
  10042. @subsection Examples
  10043. @itemize
  10044. @item
  10045. Highlight differences between two RGB video streams:
  10046. @example
  10047. 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)'
  10048. @end example
  10049. @item
  10050. Highlight differences between two YUV video streams:
  10051. @example
  10052. 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)'
  10053. @end example
  10054. @item
  10055. Show max difference between two video streams:
  10056. @example
  10057. 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)))'
  10058. @end example
  10059. @end itemize
  10060. @section maskedclamp
  10061. Clamp the first input stream with the second input and third input stream.
  10062. Returns the value of first stream to be between second input
  10063. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10064. This filter accepts the following options:
  10065. @table @option
  10066. @item undershoot
  10067. Default value is @code{0}.
  10068. @item overshoot
  10069. Default value is @code{0}.
  10070. @item planes
  10071. Set which planes will be processed as bitmap, unprocessed planes will be
  10072. copied from first stream.
  10073. By default value 0xf, all planes will be processed.
  10074. @end table
  10075. @section maskedmax
  10076. Merge the second and third input stream into output stream using absolute differences
  10077. between second input stream and first input stream and absolute difference between
  10078. third input stream and first input stream. The picked value will be from second input
  10079. stream if second absolute difference is greater than first one or from third input stream
  10080. otherwise.
  10081. This filter accepts the following options:
  10082. @table @option
  10083. @item planes
  10084. Set which planes will be processed as bitmap, unprocessed planes will be
  10085. copied from first stream.
  10086. By default value 0xf, all planes will be processed.
  10087. @end table
  10088. @section maskedmerge
  10089. Merge the first input stream with the second input stream using per pixel
  10090. weights in the third input stream.
  10091. A value of 0 in the third stream pixel component means that pixel component
  10092. from first stream is returned unchanged, while maximum value (eg. 255 for
  10093. 8-bit videos) means that pixel component from second stream is returned
  10094. unchanged. Intermediate values define the amount of merging between both
  10095. input stream's pixel components.
  10096. This filter accepts the following options:
  10097. @table @option
  10098. @item planes
  10099. Set which planes will be processed as bitmap, unprocessed planes will be
  10100. copied from first stream.
  10101. By default value 0xf, all planes will be processed.
  10102. @end table
  10103. @section maskedmin
  10104. Merge the second and third input stream into output stream using absolute differences
  10105. between second input stream and first input stream and absolute difference between
  10106. third input stream and first input stream. The picked value will be from second input
  10107. stream if second absolute difference is less than first one or from third input stream
  10108. otherwise.
  10109. This filter accepts the following options:
  10110. @table @option
  10111. @item planes
  10112. Set which planes will be processed as bitmap, unprocessed planes will be
  10113. copied from first stream.
  10114. By default value 0xf, all planes will be processed.
  10115. @end table
  10116. @section maskfun
  10117. Create mask from input video.
  10118. For example it is useful to create motion masks after @code{tblend} filter.
  10119. This filter accepts the following options:
  10120. @table @option
  10121. @item low
  10122. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10123. @item high
  10124. Set high threshold. Any pixel component higher than this value will be set to max value
  10125. allowed for current pixel format.
  10126. @item planes
  10127. Set planes to filter, by default all available planes are filtered.
  10128. @item fill
  10129. Fill all frame pixels with this value.
  10130. @item sum
  10131. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10132. average, output frame will be completely filled with value set by @var{fill} option.
  10133. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10134. @end table
  10135. @section mcdeint
  10136. Apply motion-compensation deinterlacing.
  10137. It needs one field per frame as input and must thus be used together
  10138. with yadif=1/3 or equivalent.
  10139. This filter accepts the following options:
  10140. @table @option
  10141. @item mode
  10142. Set the deinterlacing mode.
  10143. It accepts one of the following values:
  10144. @table @samp
  10145. @item fast
  10146. @item medium
  10147. @item slow
  10148. use iterative motion estimation
  10149. @item extra_slow
  10150. like @samp{slow}, but use multiple reference frames.
  10151. @end table
  10152. Default value is @samp{fast}.
  10153. @item parity
  10154. Set the picture field parity assumed for the input video. It must be
  10155. one of the following values:
  10156. @table @samp
  10157. @item 0, tff
  10158. assume top field first
  10159. @item 1, bff
  10160. assume bottom field first
  10161. @end table
  10162. Default value is @samp{bff}.
  10163. @item qp
  10164. Set per-block quantization parameter (QP) used by the internal
  10165. encoder.
  10166. Higher values should result in a smoother motion vector field but less
  10167. optimal individual vectors. Default value is 1.
  10168. @end table
  10169. @section median
  10170. Pick median pixel from certain rectangle defined by radius.
  10171. This filter accepts the following options:
  10172. @table @option
  10173. @item radius
  10174. Set horizontal radius size. Default value is @code{1}.
  10175. Allowed range is integer from 1 to 127.
  10176. @item planes
  10177. Set which planes to process. Default is @code{15}, which is all available planes.
  10178. @item radiusV
  10179. Set vertical radius size. Default value is @code{0}.
  10180. Allowed range is integer from 0 to 127.
  10181. If it is 0, value will be picked from horizontal @code{radius} option.
  10182. @item percentile
  10183. Set median percentile. Default value is @code{0.5}.
  10184. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10185. minimum values, and @code{1} maximum values.
  10186. @end table
  10187. @subsection Commands
  10188. This filter supports same @ref{commands} as options.
  10189. The command accepts the same syntax of the corresponding option.
  10190. If the specified expression is not valid, it is kept at its current
  10191. value.
  10192. @section mergeplanes
  10193. Merge color channel components from several video streams.
  10194. The filter accepts up to 4 input streams, and merge selected input
  10195. planes to the output video.
  10196. This filter accepts the following options:
  10197. @table @option
  10198. @item mapping
  10199. Set input to output plane mapping. Default is @code{0}.
  10200. The mappings is specified as a bitmap. It should be specified as a
  10201. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10202. mapping for the first plane of the output stream. 'A' sets the number of
  10203. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10204. corresponding input to use (from 0 to 3). The rest of the mappings is
  10205. similar, 'Bb' describes the mapping for the output stream second
  10206. plane, 'Cc' describes the mapping for the output stream third plane and
  10207. 'Dd' describes the mapping for the output stream fourth plane.
  10208. @item format
  10209. Set output pixel format. Default is @code{yuva444p}.
  10210. @end table
  10211. @subsection Examples
  10212. @itemize
  10213. @item
  10214. Merge three gray video streams of same width and height into single video stream:
  10215. @example
  10216. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10217. @end example
  10218. @item
  10219. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10220. @example
  10221. [a0][a1]mergeplanes=0x00010210:yuva444p
  10222. @end example
  10223. @item
  10224. Swap Y and A plane in yuva444p stream:
  10225. @example
  10226. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10227. @end example
  10228. @item
  10229. Swap U and V plane in yuv420p stream:
  10230. @example
  10231. format=yuv420p,mergeplanes=0x000201:yuv420p
  10232. @end example
  10233. @item
  10234. Cast a rgb24 clip to yuv444p:
  10235. @example
  10236. format=rgb24,mergeplanes=0x000102:yuv444p
  10237. @end example
  10238. @end itemize
  10239. @section mestimate
  10240. Estimate and export motion vectors using block matching algorithms.
  10241. Motion vectors are stored in frame side data to be used by other filters.
  10242. This filter accepts the following options:
  10243. @table @option
  10244. @item method
  10245. Specify the motion estimation method. Accepts one of the following values:
  10246. @table @samp
  10247. @item esa
  10248. Exhaustive search algorithm.
  10249. @item tss
  10250. Three step search algorithm.
  10251. @item tdls
  10252. Two dimensional logarithmic search algorithm.
  10253. @item ntss
  10254. New three step search algorithm.
  10255. @item fss
  10256. Four step search algorithm.
  10257. @item ds
  10258. Diamond search algorithm.
  10259. @item hexbs
  10260. Hexagon-based search algorithm.
  10261. @item epzs
  10262. Enhanced predictive zonal search algorithm.
  10263. @item umh
  10264. Uneven multi-hexagon search algorithm.
  10265. @end table
  10266. Default value is @samp{esa}.
  10267. @item mb_size
  10268. Macroblock size. Default @code{16}.
  10269. @item search_param
  10270. Search parameter. Default @code{7}.
  10271. @end table
  10272. @section midequalizer
  10273. Apply Midway Image Equalization effect using two video streams.
  10274. Midway Image Equalization adjusts a pair of images to have the same
  10275. histogram, while maintaining their dynamics as much as possible. It's
  10276. useful for e.g. matching exposures from a pair of stereo cameras.
  10277. This filter has two inputs and one output, which must be of same pixel format, but
  10278. may be of different sizes. The output of filter is first input adjusted with
  10279. midway histogram of both inputs.
  10280. This filter accepts the following option:
  10281. @table @option
  10282. @item planes
  10283. Set which planes to process. Default is @code{15}, which is all available planes.
  10284. @end table
  10285. @section minterpolate
  10286. Convert the video to specified frame rate using motion interpolation.
  10287. This filter accepts the following options:
  10288. @table @option
  10289. @item fps
  10290. 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}.
  10291. @item mi_mode
  10292. Motion interpolation mode. Following values are accepted:
  10293. @table @samp
  10294. @item dup
  10295. Duplicate previous or next frame for interpolating new ones.
  10296. @item blend
  10297. Blend source frames. Interpolated frame is mean of previous and next frames.
  10298. @item mci
  10299. Motion compensated interpolation. Following options are effective when this mode is selected:
  10300. @table @samp
  10301. @item mc_mode
  10302. Motion compensation mode. Following values are accepted:
  10303. @table @samp
  10304. @item obmc
  10305. Overlapped block motion compensation.
  10306. @item aobmc
  10307. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10308. @end table
  10309. Default mode is @samp{obmc}.
  10310. @item me_mode
  10311. Motion estimation mode. Following values are accepted:
  10312. @table @samp
  10313. @item bidir
  10314. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10315. @item bilat
  10316. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10317. @end table
  10318. Default mode is @samp{bilat}.
  10319. @item me
  10320. The algorithm to be used for motion estimation. Following values are accepted:
  10321. @table @samp
  10322. @item esa
  10323. Exhaustive search algorithm.
  10324. @item tss
  10325. Three step search algorithm.
  10326. @item tdls
  10327. Two dimensional logarithmic search algorithm.
  10328. @item ntss
  10329. New three step search algorithm.
  10330. @item fss
  10331. Four step search algorithm.
  10332. @item ds
  10333. Diamond search algorithm.
  10334. @item hexbs
  10335. Hexagon-based search algorithm.
  10336. @item epzs
  10337. Enhanced predictive zonal search algorithm.
  10338. @item umh
  10339. Uneven multi-hexagon search algorithm.
  10340. @end table
  10341. Default algorithm is @samp{epzs}.
  10342. @item mb_size
  10343. Macroblock size. Default @code{16}.
  10344. @item search_param
  10345. Motion estimation search parameter. Default @code{32}.
  10346. @item vsbmc
  10347. 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).
  10348. @end table
  10349. @end table
  10350. @item scd
  10351. 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:
  10352. @table @samp
  10353. @item none
  10354. Disable scene change detection.
  10355. @item fdiff
  10356. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10357. @end table
  10358. Default method is @samp{fdiff}.
  10359. @item scd_threshold
  10360. Scene change detection threshold. Default is @code{5.0}.
  10361. @end table
  10362. @section mix
  10363. Mix several video input streams into one video stream.
  10364. A description of the accepted options follows.
  10365. @table @option
  10366. @item nb_inputs
  10367. The number of inputs. If unspecified, it defaults to 2.
  10368. @item weights
  10369. Specify weight of each input video stream as sequence.
  10370. Each weight is separated by space. If number of weights
  10371. is smaller than number of @var{frames} last specified
  10372. weight will be used for all remaining unset weights.
  10373. @item scale
  10374. Specify scale, if it is set it will be multiplied with sum
  10375. of each weight multiplied with pixel values to give final destination
  10376. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10377. @item duration
  10378. Specify how end of stream is determined.
  10379. @table @samp
  10380. @item longest
  10381. The duration of the longest input. (default)
  10382. @item shortest
  10383. The duration of the shortest input.
  10384. @item first
  10385. The duration of the first input.
  10386. @end table
  10387. @end table
  10388. @section mpdecimate
  10389. Drop frames that do not differ greatly from the previous frame in
  10390. order to reduce frame rate.
  10391. The main use of this filter is for very-low-bitrate encoding
  10392. (e.g. streaming over dialup modem), but it could in theory be used for
  10393. fixing movies that were inverse-telecined incorrectly.
  10394. A description of the accepted options follows.
  10395. @table @option
  10396. @item max
  10397. Set the maximum number of consecutive frames which can be dropped (if
  10398. positive), or the minimum interval between dropped frames (if
  10399. negative). If the value is 0, the frame is dropped disregarding the
  10400. number of previous sequentially dropped frames.
  10401. Default value is 0.
  10402. @item hi
  10403. @item lo
  10404. @item frac
  10405. Set the dropping threshold values.
  10406. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10407. represent actual pixel value differences, so a threshold of 64
  10408. corresponds to 1 unit of difference for each pixel, or the same spread
  10409. out differently over the block.
  10410. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10411. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10412. meaning the whole image) differ by more than a threshold of @option{lo}.
  10413. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10414. 64*5, and default value for @option{frac} is 0.33.
  10415. @end table
  10416. @section negate
  10417. Negate (invert) the input video.
  10418. It accepts the following option:
  10419. @table @option
  10420. @item negate_alpha
  10421. With value 1, it negates the alpha component, if present. Default value is 0.
  10422. @end table
  10423. @anchor{nlmeans}
  10424. @section nlmeans
  10425. Denoise frames using Non-Local Means algorithm.
  10426. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10427. context similarity is defined by comparing their surrounding patches of size
  10428. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10429. around the pixel.
  10430. Note that the research area defines centers for patches, which means some
  10431. patches will be made of pixels outside that research area.
  10432. The filter accepts the following options.
  10433. @table @option
  10434. @item s
  10435. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10436. @item p
  10437. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10438. @item pc
  10439. Same as @option{p} but for chroma planes.
  10440. The default value is @var{0} and means automatic.
  10441. @item r
  10442. Set research size. Default is 15. Must be odd number in range [0, 99].
  10443. @item rc
  10444. Same as @option{r} but for chroma planes.
  10445. The default value is @var{0} and means automatic.
  10446. @end table
  10447. @section nnedi
  10448. Deinterlace video using neural network edge directed interpolation.
  10449. This filter accepts the following options:
  10450. @table @option
  10451. @item weights
  10452. Mandatory option, without binary file filter can not work.
  10453. Currently file can be found here:
  10454. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10455. @item deint
  10456. Set which frames to deinterlace, by default it is @code{all}.
  10457. Can be @code{all} or @code{interlaced}.
  10458. @item field
  10459. Set mode of operation.
  10460. Can be one of the following:
  10461. @table @samp
  10462. @item af
  10463. Use frame flags, both fields.
  10464. @item a
  10465. Use frame flags, single field.
  10466. @item t
  10467. Use top field only.
  10468. @item b
  10469. Use bottom field only.
  10470. @item tf
  10471. Use both fields, top first.
  10472. @item bf
  10473. Use both fields, bottom first.
  10474. @end table
  10475. @item planes
  10476. Set which planes to process, by default filter process all frames.
  10477. @item nsize
  10478. Set size of local neighborhood around each pixel, used by the predictor neural
  10479. network.
  10480. Can be one of the following:
  10481. @table @samp
  10482. @item s8x6
  10483. @item s16x6
  10484. @item s32x6
  10485. @item s48x6
  10486. @item s8x4
  10487. @item s16x4
  10488. @item s32x4
  10489. @end table
  10490. @item nns
  10491. Set the number of neurons in predictor neural network.
  10492. Can be one of the following:
  10493. @table @samp
  10494. @item n16
  10495. @item n32
  10496. @item n64
  10497. @item n128
  10498. @item n256
  10499. @end table
  10500. @item qual
  10501. Controls the number of different neural network predictions that are blended
  10502. together to compute the final output value. Can be @code{fast}, default or
  10503. @code{slow}.
  10504. @item etype
  10505. Set which set of weights to use in the predictor.
  10506. Can be one of the following:
  10507. @table @samp
  10508. @item a
  10509. weights trained to minimize absolute error
  10510. @item s
  10511. weights trained to minimize squared error
  10512. @end table
  10513. @item pscrn
  10514. Controls whether or not the prescreener neural network is used to decide
  10515. which pixels should be processed by the predictor neural network and which
  10516. can be handled by simple cubic interpolation.
  10517. The prescreener is trained to know whether cubic interpolation will be
  10518. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10519. The computational complexity of the prescreener nn is much less than that of
  10520. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10521. using the prescreener generally results in much faster processing.
  10522. The prescreener is pretty accurate, so the difference between using it and not
  10523. using it is almost always unnoticeable.
  10524. Can be one of the following:
  10525. @table @samp
  10526. @item none
  10527. @item original
  10528. @item new
  10529. @end table
  10530. Default is @code{new}.
  10531. @item fapprox
  10532. Set various debugging flags.
  10533. @end table
  10534. @section noformat
  10535. Force libavfilter not to use any of the specified pixel formats for the
  10536. input to the next filter.
  10537. It accepts the following parameters:
  10538. @table @option
  10539. @item pix_fmts
  10540. A '|'-separated list of pixel format names, such as
  10541. pix_fmts=yuv420p|monow|rgb24".
  10542. @end table
  10543. @subsection Examples
  10544. @itemize
  10545. @item
  10546. Force libavfilter to use a format different from @var{yuv420p} for the
  10547. input to the vflip filter:
  10548. @example
  10549. noformat=pix_fmts=yuv420p,vflip
  10550. @end example
  10551. @item
  10552. Convert the input video to any of the formats not contained in the list:
  10553. @example
  10554. noformat=yuv420p|yuv444p|yuv410p
  10555. @end example
  10556. @end itemize
  10557. @section noise
  10558. Add noise on video input frame.
  10559. The filter accepts the following options:
  10560. @table @option
  10561. @item all_seed
  10562. @item c0_seed
  10563. @item c1_seed
  10564. @item c2_seed
  10565. @item c3_seed
  10566. Set noise seed for specific pixel component or all pixel components in case
  10567. of @var{all_seed}. Default value is @code{123457}.
  10568. @item all_strength, alls
  10569. @item c0_strength, c0s
  10570. @item c1_strength, c1s
  10571. @item c2_strength, c2s
  10572. @item c3_strength, c3s
  10573. Set noise strength for specific pixel component or all pixel components in case
  10574. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10575. @item all_flags, allf
  10576. @item c0_flags, c0f
  10577. @item c1_flags, c1f
  10578. @item c2_flags, c2f
  10579. @item c3_flags, c3f
  10580. Set pixel component flags or set flags for all components if @var{all_flags}.
  10581. Available values for component flags are:
  10582. @table @samp
  10583. @item a
  10584. averaged temporal noise (smoother)
  10585. @item p
  10586. mix random noise with a (semi)regular pattern
  10587. @item t
  10588. temporal noise (noise pattern changes between frames)
  10589. @item u
  10590. uniform noise (gaussian otherwise)
  10591. @end table
  10592. @end table
  10593. @subsection Examples
  10594. Add temporal and uniform noise to input video:
  10595. @example
  10596. noise=alls=20:allf=t+u
  10597. @end example
  10598. @section normalize
  10599. Normalize RGB video (aka histogram stretching, contrast stretching).
  10600. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10601. For each channel of each frame, the filter computes the input range and maps
  10602. it linearly to the user-specified output range. The output range defaults
  10603. to the full dynamic range from pure black to pure white.
  10604. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10605. changes in brightness) caused when small dark or bright objects enter or leave
  10606. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10607. video camera, and, like a video camera, it may cause a period of over- or
  10608. under-exposure of the video.
  10609. The R,G,B channels can be normalized independently, which may cause some
  10610. color shifting, or linked together as a single channel, which prevents
  10611. color shifting. Linked normalization preserves hue. Independent normalization
  10612. does not, so it can be used to remove some color casts. Independent and linked
  10613. normalization can be combined in any ratio.
  10614. The normalize filter accepts the following options:
  10615. @table @option
  10616. @item blackpt
  10617. @item whitept
  10618. Colors which define the output range. The minimum input value is mapped to
  10619. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10620. The defaults are black and white respectively. Specifying white for
  10621. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10622. normalized video. Shades of grey can be used to reduce the dynamic range
  10623. (contrast). Specifying saturated colors here can create some interesting
  10624. effects.
  10625. @item smoothing
  10626. The number of previous frames to use for temporal smoothing. The input range
  10627. of each channel is smoothed using a rolling average over the current frame
  10628. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10629. smoothing).
  10630. @item independence
  10631. Controls the ratio of independent (color shifting) channel normalization to
  10632. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10633. independent. Defaults to 1.0 (fully independent).
  10634. @item strength
  10635. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10636. expensive no-op. Defaults to 1.0 (full strength).
  10637. @end table
  10638. @subsection Commands
  10639. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10640. The command accepts the same syntax of the corresponding option.
  10641. If the specified expression is not valid, it is kept at its current
  10642. value.
  10643. @subsection Examples
  10644. Stretch video contrast to use the full dynamic range, with no temporal
  10645. smoothing; may flicker depending on the source content:
  10646. @example
  10647. normalize=blackpt=black:whitept=white:smoothing=0
  10648. @end example
  10649. As above, but with 50 frames of temporal smoothing; flicker should be
  10650. reduced, depending on the source content:
  10651. @example
  10652. normalize=blackpt=black:whitept=white:smoothing=50
  10653. @end example
  10654. As above, but with hue-preserving linked channel normalization:
  10655. @example
  10656. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10657. @end example
  10658. As above, but with half strength:
  10659. @example
  10660. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10661. @end example
  10662. Map the darkest input color to red, the brightest input color to cyan:
  10663. @example
  10664. normalize=blackpt=red:whitept=cyan
  10665. @end example
  10666. @section null
  10667. Pass the video source unchanged to the output.
  10668. @section ocr
  10669. Optical Character Recognition
  10670. This filter uses Tesseract for optical character recognition. To enable
  10671. compilation of this filter, you need to configure FFmpeg with
  10672. @code{--enable-libtesseract}.
  10673. It accepts the following options:
  10674. @table @option
  10675. @item datapath
  10676. Set datapath to tesseract data. Default is to use whatever was
  10677. set at installation.
  10678. @item language
  10679. Set language, default is "eng".
  10680. @item whitelist
  10681. Set character whitelist.
  10682. @item blacklist
  10683. Set character blacklist.
  10684. @end table
  10685. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10686. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10687. @section ocv
  10688. Apply a video transform using libopencv.
  10689. To enable this filter, install the libopencv library and headers and
  10690. configure FFmpeg with @code{--enable-libopencv}.
  10691. It accepts the following parameters:
  10692. @table @option
  10693. @item filter_name
  10694. The name of the libopencv filter to apply.
  10695. @item filter_params
  10696. The parameters to pass to the libopencv filter. If not specified, the default
  10697. values are assumed.
  10698. @end table
  10699. Refer to the official libopencv documentation for more precise
  10700. information:
  10701. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10702. Several libopencv filters are supported; see the following subsections.
  10703. @anchor{dilate}
  10704. @subsection dilate
  10705. Dilate an image by using a specific structuring element.
  10706. It corresponds to the libopencv function @code{cvDilate}.
  10707. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10708. @var{struct_el} represents a structuring element, and has the syntax:
  10709. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10710. @var{cols} and @var{rows} represent the number of columns and rows of
  10711. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10712. point, and @var{shape} the shape for the structuring element. @var{shape}
  10713. must be "rect", "cross", "ellipse", or "custom".
  10714. If the value for @var{shape} is "custom", it must be followed by a
  10715. string of the form "=@var{filename}". The file with name
  10716. @var{filename} is assumed to represent a binary image, with each
  10717. printable character corresponding to a bright pixel. When a custom
  10718. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10719. or columns and rows of the read file are assumed instead.
  10720. The default value for @var{struct_el} is "3x3+0x0/rect".
  10721. @var{nb_iterations} specifies the number of times the transform is
  10722. applied to the image, and defaults to 1.
  10723. Some examples:
  10724. @example
  10725. # Use the default values
  10726. ocv=dilate
  10727. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10728. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10729. # Read the shape from the file diamond.shape, iterating two times.
  10730. # The file diamond.shape may contain a pattern of characters like this
  10731. # *
  10732. # ***
  10733. # *****
  10734. # ***
  10735. # *
  10736. # The specified columns and rows are ignored
  10737. # but the anchor point coordinates are not
  10738. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10739. @end example
  10740. @subsection erode
  10741. Erode an image by using a specific structuring element.
  10742. It corresponds to the libopencv function @code{cvErode}.
  10743. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10744. with the same syntax and semantics as the @ref{dilate} filter.
  10745. @subsection smooth
  10746. Smooth the input video.
  10747. The filter takes the following parameters:
  10748. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10749. @var{type} is the type of smooth filter to apply, and must be one of
  10750. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10751. or "bilateral". The default value is "gaussian".
  10752. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10753. depends on the smooth type. @var{param1} and
  10754. @var{param2} accept integer positive values or 0. @var{param3} and
  10755. @var{param4} accept floating point values.
  10756. The default value for @var{param1} is 3. The default value for the
  10757. other parameters is 0.
  10758. These parameters correspond to the parameters assigned to the
  10759. libopencv function @code{cvSmooth}.
  10760. @section oscilloscope
  10761. 2D Video Oscilloscope.
  10762. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10763. It accepts the following parameters:
  10764. @table @option
  10765. @item x
  10766. Set scope center x position.
  10767. @item y
  10768. Set scope center y position.
  10769. @item s
  10770. Set scope size, relative to frame diagonal.
  10771. @item t
  10772. Set scope tilt/rotation.
  10773. @item o
  10774. Set trace opacity.
  10775. @item tx
  10776. Set trace center x position.
  10777. @item ty
  10778. Set trace center y position.
  10779. @item tw
  10780. Set trace width, relative to width of frame.
  10781. @item th
  10782. Set trace height, relative to height of frame.
  10783. @item c
  10784. Set which components to trace. By default it traces first three components.
  10785. @item g
  10786. Draw trace grid. By default is enabled.
  10787. @item st
  10788. Draw some statistics. By default is enabled.
  10789. @item sc
  10790. Draw scope. By default is enabled.
  10791. @end table
  10792. @subsection Commands
  10793. This filter supports same @ref{commands} as options.
  10794. The command accepts the same syntax of the corresponding option.
  10795. If the specified expression is not valid, it is kept at its current
  10796. value.
  10797. @subsection Examples
  10798. @itemize
  10799. @item
  10800. Inspect full first row of video frame.
  10801. @example
  10802. oscilloscope=x=0.5:y=0:s=1
  10803. @end example
  10804. @item
  10805. Inspect full last row of video frame.
  10806. @example
  10807. oscilloscope=x=0.5:y=1:s=1
  10808. @end example
  10809. @item
  10810. Inspect full 5th line of video frame of height 1080.
  10811. @example
  10812. oscilloscope=x=0.5:y=5/1080:s=1
  10813. @end example
  10814. @item
  10815. Inspect full last column of video frame.
  10816. @example
  10817. oscilloscope=x=1:y=0.5:s=1:t=1
  10818. @end example
  10819. @end itemize
  10820. @anchor{overlay}
  10821. @section overlay
  10822. Overlay one video on top of another.
  10823. It takes two inputs and has one output. The first input is the "main"
  10824. video on which the second input is overlaid.
  10825. It accepts the following parameters:
  10826. A description of the accepted options follows.
  10827. @table @option
  10828. @item x
  10829. @item y
  10830. Set the expression for the x and y coordinates of the overlaid video
  10831. on the main video. Default value is "0" for both expressions. In case
  10832. the expression is invalid, it is set to a huge value (meaning that the
  10833. overlay will not be displayed within the output visible area).
  10834. @item eof_action
  10835. See @ref{framesync}.
  10836. @item eval
  10837. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10838. It accepts the following values:
  10839. @table @samp
  10840. @item init
  10841. only evaluate expressions once during the filter initialization or
  10842. when a command is processed
  10843. @item frame
  10844. evaluate expressions for each incoming frame
  10845. @end table
  10846. Default value is @samp{frame}.
  10847. @item shortest
  10848. See @ref{framesync}.
  10849. @item format
  10850. Set the format for the output video.
  10851. It accepts the following values:
  10852. @table @samp
  10853. @item yuv420
  10854. force YUV420 output
  10855. @item yuv422
  10856. force YUV422 output
  10857. @item yuv444
  10858. force YUV444 output
  10859. @item rgb
  10860. force packed RGB output
  10861. @item gbrp
  10862. force planar RGB output
  10863. @item auto
  10864. automatically pick format
  10865. @end table
  10866. Default value is @samp{yuv420}.
  10867. @item repeatlast
  10868. See @ref{framesync}.
  10869. @item alpha
  10870. Set format of alpha of the overlaid video, it can be @var{straight} or
  10871. @var{premultiplied}. Default is @var{straight}.
  10872. @end table
  10873. The @option{x}, and @option{y} expressions can contain the following
  10874. parameters.
  10875. @table @option
  10876. @item main_w, W
  10877. @item main_h, H
  10878. The main input width and height.
  10879. @item overlay_w, w
  10880. @item overlay_h, h
  10881. The overlay input width and height.
  10882. @item x
  10883. @item y
  10884. The computed values for @var{x} and @var{y}. They are evaluated for
  10885. each new frame.
  10886. @item hsub
  10887. @item vsub
  10888. horizontal and vertical chroma subsample values of the output
  10889. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10890. @var{vsub} is 1.
  10891. @item n
  10892. the number of input frame, starting from 0
  10893. @item pos
  10894. the position in the file of the input frame, NAN if unknown
  10895. @item t
  10896. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10897. @end table
  10898. This filter also supports the @ref{framesync} options.
  10899. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10900. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10901. when @option{eval} is set to @samp{init}.
  10902. Be aware that frames are taken from each input video in timestamp
  10903. order, hence, if their initial timestamps differ, it is a good idea
  10904. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10905. have them begin in the same zero timestamp, as the example for
  10906. the @var{movie} filter does.
  10907. You can chain together more overlays but you should test the
  10908. efficiency of such approach.
  10909. @subsection Commands
  10910. This filter supports the following commands:
  10911. @table @option
  10912. @item x
  10913. @item y
  10914. Modify the x and y of the overlay input.
  10915. The command accepts the same syntax of the corresponding option.
  10916. If the specified expression is not valid, it is kept at its current
  10917. value.
  10918. @end table
  10919. @subsection Examples
  10920. @itemize
  10921. @item
  10922. Draw the overlay at 10 pixels from the bottom right corner of the main
  10923. video:
  10924. @example
  10925. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10926. @end example
  10927. Using named options the example above becomes:
  10928. @example
  10929. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10930. @end example
  10931. @item
  10932. Insert a transparent PNG logo in the bottom left corner of the input,
  10933. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10934. @example
  10935. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10936. @end example
  10937. @item
  10938. Insert 2 different transparent PNG logos (second logo on bottom
  10939. right corner) using the @command{ffmpeg} tool:
  10940. @example
  10941. 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
  10942. @end example
  10943. @item
  10944. Add a transparent color layer on top of the main video; @code{WxH}
  10945. must specify the size of the main input to the overlay filter:
  10946. @example
  10947. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10948. @end example
  10949. @item
  10950. Play an original video and a filtered version (here with the deshake
  10951. filter) side by side using the @command{ffplay} tool:
  10952. @example
  10953. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10954. @end example
  10955. The above command is the same as:
  10956. @example
  10957. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10958. @end example
  10959. @item
  10960. Make a sliding overlay appearing from the left to the right top part of the
  10961. screen starting since time 2:
  10962. @example
  10963. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10964. @end example
  10965. @item
  10966. Compose output by putting two input videos side to side:
  10967. @example
  10968. ffmpeg -i left.avi -i right.avi -filter_complex "
  10969. nullsrc=size=200x100 [background];
  10970. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10971. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10972. [background][left] overlay=shortest=1 [background+left];
  10973. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10974. "
  10975. @end example
  10976. @item
  10977. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10978. @example
  10979. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10980. -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]'
  10981. masked.avi
  10982. @end example
  10983. @item
  10984. Chain several overlays in cascade:
  10985. @example
  10986. nullsrc=s=200x200 [bg];
  10987. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10988. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10989. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10990. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10991. [in3] null, [mid2] overlay=100:100 [out0]
  10992. @end example
  10993. @end itemize
  10994. @anchor{overlay_cuda}
  10995. @section overlay_cuda
  10996. Overlay one video on top of another.
  10997. This is the CUDA cariant of the @ref{overlay} filter.
  10998. It only accepts CUDA frames. The underlying input pixel formats have to match.
  10999. It takes two inputs and has one output. The first input is the "main"
  11000. video on which the second input is overlaid.
  11001. It accepts the following parameters:
  11002. @table @option
  11003. @item x
  11004. @item y
  11005. Set the x and y coordinates of the overlaid video on the main video.
  11006. Default value is "0" for both expressions.
  11007. @item eof_action
  11008. See @ref{framesync}.
  11009. @item shortest
  11010. See @ref{framesync}.
  11011. @item repeatlast
  11012. See @ref{framesync}.
  11013. @end table
  11014. This filter also supports the @ref{framesync} options.
  11015. @section owdenoise
  11016. Apply Overcomplete Wavelet denoiser.
  11017. The filter accepts the following options:
  11018. @table @option
  11019. @item depth
  11020. Set depth.
  11021. Larger depth values will denoise lower frequency components more, but
  11022. slow down filtering.
  11023. Must be an int in the range 8-16, default is @code{8}.
  11024. @item luma_strength, ls
  11025. Set luma strength.
  11026. Must be a double value in the range 0-1000, default is @code{1.0}.
  11027. @item chroma_strength, cs
  11028. Set chroma strength.
  11029. Must be a double value in the range 0-1000, default is @code{1.0}.
  11030. @end table
  11031. @anchor{pad}
  11032. @section pad
  11033. Add paddings to the input image, and place the original input at the
  11034. provided @var{x}, @var{y} coordinates.
  11035. It accepts the following parameters:
  11036. @table @option
  11037. @item width, w
  11038. @item height, h
  11039. Specify an expression for the size of the output image with the
  11040. paddings added. If the value for @var{width} or @var{height} is 0, the
  11041. corresponding input size is used for the output.
  11042. The @var{width} expression can reference the value set by the
  11043. @var{height} expression, and vice versa.
  11044. The default value of @var{width} and @var{height} is 0.
  11045. @item x
  11046. @item y
  11047. Specify the offsets to place the input image at within the padded area,
  11048. with respect to the top/left border of the output image.
  11049. The @var{x} expression can reference the value set by the @var{y}
  11050. expression, and vice versa.
  11051. The default value of @var{x} and @var{y} is 0.
  11052. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11053. so the input image is centered on the padded area.
  11054. @item color
  11055. Specify the color of the padded area. For the syntax of this option,
  11056. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11057. manual,ffmpeg-utils}.
  11058. The default value of @var{color} is "black".
  11059. @item eval
  11060. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11061. It accepts the following values:
  11062. @table @samp
  11063. @item init
  11064. Only evaluate expressions once during the filter initialization or when
  11065. a command is processed.
  11066. @item frame
  11067. Evaluate expressions for each incoming frame.
  11068. @end table
  11069. Default value is @samp{init}.
  11070. @item aspect
  11071. Pad to aspect instead to a resolution.
  11072. @end table
  11073. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11074. options are expressions containing the following constants:
  11075. @table @option
  11076. @item in_w
  11077. @item in_h
  11078. The input video width and height.
  11079. @item iw
  11080. @item ih
  11081. These are the same as @var{in_w} and @var{in_h}.
  11082. @item out_w
  11083. @item out_h
  11084. The output width and height (the size of the padded area), as
  11085. specified by the @var{width} and @var{height} expressions.
  11086. @item ow
  11087. @item oh
  11088. These are the same as @var{out_w} and @var{out_h}.
  11089. @item x
  11090. @item y
  11091. The x and y offsets as specified by the @var{x} and @var{y}
  11092. expressions, or NAN if not yet specified.
  11093. @item a
  11094. same as @var{iw} / @var{ih}
  11095. @item sar
  11096. input sample aspect ratio
  11097. @item dar
  11098. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11099. @item hsub
  11100. @item vsub
  11101. The horizontal and vertical chroma subsample values. For example for the
  11102. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11103. @end table
  11104. @subsection Examples
  11105. @itemize
  11106. @item
  11107. Add paddings with the color "violet" to the input video. The output video
  11108. size is 640x480, and the top-left corner of the input video is placed at
  11109. column 0, row 40
  11110. @example
  11111. pad=640:480:0:40:violet
  11112. @end example
  11113. The example above is equivalent to the following command:
  11114. @example
  11115. pad=width=640:height=480:x=0:y=40:color=violet
  11116. @end example
  11117. @item
  11118. Pad the input to get an output with dimensions increased by 3/2,
  11119. and put the input video at the center of the padded area:
  11120. @example
  11121. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11122. @end example
  11123. @item
  11124. Pad the input to get a squared output with size equal to the maximum
  11125. value between the input width and height, and put the input video at
  11126. the center of the padded area:
  11127. @example
  11128. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11129. @end example
  11130. @item
  11131. Pad the input to get a final w/h ratio of 16:9:
  11132. @example
  11133. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11134. @end example
  11135. @item
  11136. In case of anamorphic video, in order to set the output display aspect
  11137. correctly, it is necessary to use @var{sar} in the expression,
  11138. according to the relation:
  11139. @example
  11140. (ih * X / ih) * sar = output_dar
  11141. X = output_dar / sar
  11142. @end example
  11143. Thus the previous example needs to be modified to:
  11144. @example
  11145. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11146. @end example
  11147. @item
  11148. Double the output size and put the input video in the bottom-right
  11149. corner of the output padded area:
  11150. @example
  11151. pad="2*iw:2*ih:ow-iw:oh-ih"
  11152. @end example
  11153. @end itemize
  11154. @anchor{palettegen}
  11155. @section palettegen
  11156. Generate one palette for a whole video stream.
  11157. It accepts the following options:
  11158. @table @option
  11159. @item max_colors
  11160. Set the maximum number of colors to quantize in the palette.
  11161. Note: the palette will still contain 256 colors; the unused palette entries
  11162. will be black.
  11163. @item reserve_transparent
  11164. Create a palette of 255 colors maximum and reserve the last one for
  11165. transparency. Reserving the transparency color is useful for GIF optimization.
  11166. If not set, the maximum of colors in the palette will be 256. You probably want
  11167. to disable this option for a standalone image.
  11168. Set by default.
  11169. @item transparency_color
  11170. Set the color that will be used as background for transparency.
  11171. @item stats_mode
  11172. Set statistics mode.
  11173. It accepts the following values:
  11174. @table @samp
  11175. @item full
  11176. Compute full frame histograms.
  11177. @item diff
  11178. Compute histograms only for the part that differs from previous frame. This
  11179. might be relevant to give more importance to the moving part of your input if
  11180. the background is static.
  11181. @item single
  11182. Compute new histogram for each frame.
  11183. @end table
  11184. Default value is @var{full}.
  11185. @end table
  11186. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11187. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11188. color quantization of the palette. This information is also visible at
  11189. @var{info} logging level.
  11190. @subsection Examples
  11191. @itemize
  11192. @item
  11193. Generate a representative palette of a given video using @command{ffmpeg}:
  11194. @example
  11195. ffmpeg -i input.mkv -vf palettegen palette.png
  11196. @end example
  11197. @end itemize
  11198. @section paletteuse
  11199. Use a palette to downsample an input video stream.
  11200. The filter takes two inputs: one video stream and a palette. The palette must
  11201. be a 256 pixels image.
  11202. It accepts the following options:
  11203. @table @option
  11204. @item dither
  11205. Select dithering mode. Available algorithms are:
  11206. @table @samp
  11207. @item bayer
  11208. Ordered 8x8 bayer dithering (deterministic)
  11209. @item heckbert
  11210. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11211. Note: this dithering is sometimes considered "wrong" and is included as a
  11212. reference.
  11213. @item floyd_steinberg
  11214. Floyd and Steingberg dithering (error diffusion)
  11215. @item sierra2
  11216. Frankie Sierra dithering v2 (error diffusion)
  11217. @item sierra2_4a
  11218. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11219. @end table
  11220. Default is @var{sierra2_4a}.
  11221. @item bayer_scale
  11222. When @var{bayer} dithering is selected, this option defines the scale of the
  11223. pattern (how much the crosshatch pattern is visible). A low value means more
  11224. visible pattern for less banding, and higher value means less visible pattern
  11225. at the cost of more banding.
  11226. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11227. @item diff_mode
  11228. If set, define the zone to process
  11229. @table @samp
  11230. @item rectangle
  11231. Only the changing rectangle will be reprocessed. This is similar to GIF
  11232. cropping/offsetting compression mechanism. This option can be useful for speed
  11233. if only a part of the image is changing, and has use cases such as limiting the
  11234. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11235. moving scene (it leads to more deterministic output if the scene doesn't change
  11236. much, and as a result less moving noise and better GIF compression).
  11237. @end table
  11238. Default is @var{none}.
  11239. @item new
  11240. Take new palette for each output frame.
  11241. @item alpha_threshold
  11242. Sets the alpha threshold for transparency. Alpha values above this threshold
  11243. will be treated as completely opaque, and values below this threshold will be
  11244. treated as completely transparent.
  11245. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11246. @end table
  11247. @subsection Examples
  11248. @itemize
  11249. @item
  11250. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11251. using @command{ffmpeg}:
  11252. @example
  11253. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11254. @end example
  11255. @end itemize
  11256. @section perspective
  11257. Correct perspective of video not recorded perpendicular to the screen.
  11258. A description of the accepted parameters follows.
  11259. @table @option
  11260. @item x0
  11261. @item y0
  11262. @item x1
  11263. @item y1
  11264. @item x2
  11265. @item y2
  11266. @item x3
  11267. @item y3
  11268. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11269. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11270. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11271. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11272. then the corners of the source will be sent to the specified coordinates.
  11273. The expressions can use the following variables:
  11274. @table @option
  11275. @item W
  11276. @item H
  11277. the width and height of video frame.
  11278. @item in
  11279. Input frame count.
  11280. @item on
  11281. Output frame count.
  11282. @end table
  11283. @item interpolation
  11284. Set interpolation for perspective correction.
  11285. It accepts the following values:
  11286. @table @samp
  11287. @item linear
  11288. @item cubic
  11289. @end table
  11290. Default value is @samp{linear}.
  11291. @item sense
  11292. Set interpretation of coordinate options.
  11293. It accepts the following values:
  11294. @table @samp
  11295. @item 0, source
  11296. Send point in the source specified by the given coordinates to
  11297. the corners of the destination.
  11298. @item 1, destination
  11299. Send the corners of the source to the point in the destination specified
  11300. by the given coordinates.
  11301. Default value is @samp{source}.
  11302. @end table
  11303. @item eval
  11304. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11305. It accepts the following values:
  11306. @table @samp
  11307. @item init
  11308. only evaluate expressions once during the filter initialization or
  11309. when a command is processed
  11310. @item frame
  11311. evaluate expressions for each incoming frame
  11312. @end table
  11313. Default value is @samp{init}.
  11314. @end table
  11315. @section phase
  11316. Delay interlaced video by one field time so that the field order changes.
  11317. The intended use is to fix PAL movies that have been captured with the
  11318. opposite field order to the film-to-video transfer.
  11319. A description of the accepted parameters follows.
  11320. @table @option
  11321. @item mode
  11322. Set phase mode.
  11323. It accepts the following values:
  11324. @table @samp
  11325. @item t
  11326. Capture field order top-first, transfer bottom-first.
  11327. Filter will delay the bottom field.
  11328. @item b
  11329. Capture field order bottom-first, transfer top-first.
  11330. Filter will delay the top field.
  11331. @item p
  11332. Capture and transfer with the same field order. This mode only exists
  11333. for the documentation of the other options to refer to, but if you
  11334. actually select it, the filter will faithfully do nothing.
  11335. @item a
  11336. Capture field order determined automatically by field flags, transfer
  11337. opposite.
  11338. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11339. basis using field flags. If no field information is available,
  11340. then this works just like @samp{u}.
  11341. @item u
  11342. Capture unknown or varying, transfer opposite.
  11343. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11344. analyzing the images and selecting the alternative that produces best
  11345. match between the fields.
  11346. @item T
  11347. Capture top-first, transfer unknown or varying.
  11348. Filter selects among @samp{t} and @samp{p} using image analysis.
  11349. @item B
  11350. Capture bottom-first, transfer unknown or varying.
  11351. Filter selects among @samp{b} and @samp{p} using image analysis.
  11352. @item A
  11353. Capture determined by field flags, transfer unknown or varying.
  11354. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11355. image analysis. If no field information is available, then this works just
  11356. like @samp{U}. This is the default mode.
  11357. @item U
  11358. Both capture and transfer unknown or varying.
  11359. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11360. @end table
  11361. @end table
  11362. @section photosensitivity
  11363. Reduce various flashes in video, so to help users with epilepsy.
  11364. It accepts the following options:
  11365. @table @option
  11366. @item frames, f
  11367. Set how many frames to use when filtering. Default is 30.
  11368. @item threshold, t
  11369. Set detection threshold factor. Default is 1.
  11370. Lower is stricter.
  11371. @item skip
  11372. Set how many pixels to skip when sampling frames. Default is 1.
  11373. Allowed range is from 1 to 1024.
  11374. @item bypass
  11375. Leave frames unchanged. Default is disabled.
  11376. @end table
  11377. @section pixdesctest
  11378. Pixel format descriptor test filter, mainly useful for internal
  11379. testing. The output video should be equal to the input video.
  11380. For example:
  11381. @example
  11382. format=monow, pixdesctest
  11383. @end example
  11384. can be used to test the monowhite pixel format descriptor definition.
  11385. @section pixscope
  11386. Display sample values of color channels. Mainly useful for checking color
  11387. and levels. Minimum supported resolution is 640x480.
  11388. The filters accept the following options:
  11389. @table @option
  11390. @item x
  11391. Set scope X position, relative offset on X axis.
  11392. @item y
  11393. Set scope Y position, relative offset on Y axis.
  11394. @item w
  11395. Set scope width.
  11396. @item h
  11397. Set scope height.
  11398. @item o
  11399. Set window opacity. This window also holds statistics about pixel area.
  11400. @item wx
  11401. Set window X position, relative offset on X axis.
  11402. @item wy
  11403. Set window Y position, relative offset on Y axis.
  11404. @end table
  11405. @section pp
  11406. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11407. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11408. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11409. Each subfilter and some options have a short and a long name that can be used
  11410. interchangeably, i.e. dr/dering are the same.
  11411. The filters accept the following options:
  11412. @table @option
  11413. @item subfilters
  11414. Set postprocessing subfilters string.
  11415. @end table
  11416. All subfilters share common options to determine their scope:
  11417. @table @option
  11418. @item a/autoq
  11419. Honor the quality commands for this subfilter.
  11420. @item c/chrom
  11421. Do chrominance filtering, too (default).
  11422. @item y/nochrom
  11423. Do luminance filtering only (no chrominance).
  11424. @item n/noluma
  11425. Do chrominance filtering only (no luminance).
  11426. @end table
  11427. These options can be appended after the subfilter name, separated by a '|'.
  11428. Available subfilters are:
  11429. @table @option
  11430. @item hb/hdeblock[|difference[|flatness]]
  11431. Horizontal deblocking filter
  11432. @table @option
  11433. @item difference
  11434. Difference factor where higher values mean more deblocking (default: @code{32}).
  11435. @item flatness
  11436. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11437. @end table
  11438. @item vb/vdeblock[|difference[|flatness]]
  11439. Vertical deblocking filter
  11440. @table @option
  11441. @item difference
  11442. Difference factor where higher values mean more deblocking (default: @code{32}).
  11443. @item flatness
  11444. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11445. @end table
  11446. @item ha/hadeblock[|difference[|flatness]]
  11447. Accurate horizontal deblocking filter
  11448. @table @option
  11449. @item difference
  11450. Difference factor where higher values mean more deblocking (default: @code{32}).
  11451. @item flatness
  11452. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11453. @end table
  11454. @item va/vadeblock[|difference[|flatness]]
  11455. Accurate vertical deblocking filter
  11456. @table @option
  11457. @item difference
  11458. Difference factor where higher values mean more deblocking (default: @code{32}).
  11459. @item flatness
  11460. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11461. @end table
  11462. @end table
  11463. The horizontal and vertical deblocking filters share the difference and
  11464. flatness values so you cannot set different horizontal and vertical
  11465. thresholds.
  11466. @table @option
  11467. @item h1/x1hdeblock
  11468. Experimental horizontal deblocking filter
  11469. @item v1/x1vdeblock
  11470. Experimental vertical deblocking filter
  11471. @item dr/dering
  11472. Deringing filter
  11473. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11474. @table @option
  11475. @item threshold1
  11476. larger -> stronger filtering
  11477. @item threshold2
  11478. larger -> stronger filtering
  11479. @item threshold3
  11480. larger -> stronger filtering
  11481. @end table
  11482. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11483. @table @option
  11484. @item f/fullyrange
  11485. Stretch luminance to @code{0-255}.
  11486. @end table
  11487. @item lb/linblenddeint
  11488. Linear blend deinterlacing filter that deinterlaces the given block by
  11489. filtering all lines with a @code{(1 2 1)} filter.
  11490. @item li/linipoldeint
  11491. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11492. linearly interpolating every second line.
  11493. @item ci/cubicipoldeint
  11494. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11495. cubically interpolating every second line.
  11496. @item md/mediandeint
  11497. Median deinterlacing filter that deinterlaces the given block by applying a
  11498. median filter to every second line.
  11499. @item fd/ffmpegdeint
  11500. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11501. second line with a @code{(-1 4 2 4 -1)} filter.
  11502. @item l5/lowpass5
  11503. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11504. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11505. @item fq/forceQuant[|quantizer]
  11506. Overrides the quantizer table from the input with the constant quantizer you
  11507. specify.
  11508. @table @option
  11509. @item quantizer
  11510. Quantizer to use
  11511. @end table
  11512. @item de/default
  11513. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11514. @item fa/fast
  11515. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11516. @item ac
  11517. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11518. @end table
  11519. @subsection Examples
  11520. @itemize
  11521. @item
  11522. Apply horizontal and vertical deblocking, deringing and automatic
  11523. brightness/contrast:
  11524. @example
  11525. pp=hb/vb/dr/al
  11526. @end example
  11527. @item
  11528. Apply default filters without brightness/contrast correction:
  11529. @example
  11530. pp=de/-al
  11531. @end example
  11532. @item
  11533. Apply default filters and temporal denoiser:
  11534. @example
  11535. pp=default/tmpnoise|1|2|3
  11536. @end example
  11537. @item
  11538. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11539. automatically depending on available CPU time:
  11540. @example
  11541. pp=hb|y/vb|a
  11542. @end example
  11543. @end itemize
  11544. @section pp7
  11545. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11546. similar to spp = 6 with 7 point DCT, where only the center sample is
  11547. used after IDCT.
  11548. The filter accepts the following options:
  11549. @table @option
  11550. @item qp
  11551. Force a constant quantization parameter. It accepts an integer in range
  11552. 0 to 63. If not set, the filter will use the QP from the video stream
  11553. (if available).
  11554. @item mode
  11555. Set thresholding mode. Available modes are:
  11556. @table @samp
  11557. @item hard
  11558. Set hard thresholding.
  11559. @item soft
  11560. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11561. @item medium
  11562. Set medium thresholding (good results, default).
  11563. @end table
  11564. @end table
  11565. @section premultiply
  11566. Apply alpha premultiply effect to input video stream using first plane
  11567. of second stream as alpha.
  11568. Both streams must have same dimensions and same pixel format.
  11569. The filter accepts the following option:
  11570. @table @option
  11571. @item planes
  11572. Set which planes will be processed, unprocessed planes will be copied.
  11573. By default value 0xf, all planes will be processed.
  11574. @item inplace
  11575. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11576. @end table
  11577. @section prewitt
  11578. Apply prewitt operator to input video stream.
  11579. The filter accepts the following option:
  11580. @table @option
  11581. @item planes
  11582. Set which planes will be processed, unprocessed planes will be copied.
  11583. By default value 0xf, all planes will be processed.
  11584. @item scale
  11585. Set value which will be multiplied with filtered result.
  11586. @item delta
  11587. Set value which will be added to filtered result.
  11588. @end table
  11589. @section pseudocolor
  11590. Alter frame colors in video with pseudocolors.
  11591. This filter accepts the following options:
  11592. @table @option
  11593. @item c0
  11594. set pixel first component expression
  11595. @item c1
  11596. set pixel second component expression
  11597. @item c2
  11598. set pixel third component expression
  11599. @item c3
  11600. set pixel fourth component expression, corresponds to the alpha component
  11601. @item i
  11602. set component to use as base for altering colors
  11603. @end table
  11604. Each of them specifies the expression to use for computing the lookup table for
  11605. the corresponding pixel component values.
  11606. The expressions can contain the following constants and functions:
  11607. @table @option
  11608. @item w
  11609. @item h
  11610. The input width and height.
  11611. @item val
  11612. The input value for the pixel component.
  11613. @item ymin, umin, vmin, amin
  11614. The minimum allowed component value.
  11615. @item ymax, umax, vmax, amax
  11616. The maximum allowed component value.
  11617. @end table
  11618. All expressions default to "val".
  11619. @subsection Examples
  11620. @itemize
  11621. @item
  11622. Change too high luma values to gradient:
  11623. @example
  11624. 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'"
  11625. @end example
  11626. @end itemize
  11627. @section psnr
  11628. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11629. Ratio) between two input videos.
  11630. This filter takes in input two input videos, the first input is
  11631. considered the "main" source and is passed unchanged to the
  11632. output. The second input is used as a "reference" video for computing
  11633. the PSNR.
  11634. Both video inputs must have the same resolution and pixel format for
  11635. this filter to work correctly. Also it assumes that both inputs
  11636. have the same number of frames, which are compared one by one.
  11637. The obtained average PSNR is printed through the logging system.
  11638. The filter stores the accumulated MSE (mean squared error) of each
  11639. frame, and at the end of the processing it is averaged across all frames
  11640. equally, and the following formula is applied to obtain the PSNR:
  11641. @example
  11642. PSNR = 10*log10(MAX^2/MSE)
  11643. @end example
  11644. Where MAX is the average of the maximum values of each component of the
  11645. image.
  11646. The description of the accepted parameters follows.
  11647. @table @option
  11648. @item stats_file, f
  11649. If specified the filter will use the named file to save the PSNR of
  11650. each individual frame. When filename equals "-" the data is sent to
  11651. standard output.
  11652. @item stats_version
  11653. Specifies which version of the stats file format to use. Details of
  11654. each format are written below.
  11655. Default value is 1.
  11656. @item stats_add_max
  11657. Determines whether the max value is output to the stats log.
  11658. Default value is 0.
  11659. Requires stats_version >= 2. If this is set and stats_version < 2,
  11660. the filter will return an error.
  11661. @end table
  11662. This filter also supports the @ref{framesync} options.
  11663. The file printed if @var{stats_file} is selected, contains a sequence of
  11664. key/value pairs of the form @var{key}:@var{value} for each compared
  11665. couple of frames.
  11666. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11667. the list of per-frame-pair stats, with key value pairs following the frame
  11668. format with the following parameters:
  11669. @table @option
  11670. @item psnr_log_version
  11671. The version of the log file format. Will match @var{stats_version}.
  11672. @item fields
  11673. A comma separated list of the per-frame-pair parameters included in
  11674. the log.
  11675. @end table
  11676. A description of each shown per-frame-pair parameter follows:
  11677. @table @option
  11678. @item n
  11679. sequential number of the input frame, starting from 1
  11680. @item mse_avg
  11681. Mean Square Error pixel-by-pixel average difference of the compared
  11682. frames, averaged over all the image components.
  11683. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11684. Mean Square Error pixel-by-pixel average difference of the compared
  11685. frames for the component specified by the suffix.
  11686. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11687. Peak Signal to Noise ratio of the compared frames for the component
  11688. specified by the suffix.
  11689. @item max_avg, max_y, max_u, max_v
  11690. Maximum allowed value for each channel, and average over all
  11691. channels.
  11692. @end table
  11693. @subsection Examples
  11694. @itemize
  11695. @item
  11696. For example:
  11697. @example
  11698. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11699. [main][ref] psnr="stats_file=stats.log" [out]
  11700. @end example
  11701. On this example the input file being processed is compared with the
  11702. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11703. is stored in @file{stats.log}.
  11704. @item
  11705. Another example with different containers:
  11706. @example
  11707. 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 -
  11708. @end example
  11709. @end itemize
  11710. @anchor{pullup}
  11711. @section pullup
  11712. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11713. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11714. content.
  11715. The pullup filter is designed to take advantage of future context in making
  11716. its decisions. This filter is stateless in the sense that it does not lock
  11717. onto a pattern to follow, but it instead looks forward to the following
  11718. fields in order to identify matches and rebuild progressive frames.
  11719. To produce content with an even framerate, insert the fps filter after
  11720. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11721. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11722. The filter accepts the following options:
  11723. @table @option
  11724. @item jl
  11725. @item jr
  11726. @item jt
  11727. @item jb
  11728. These options set the amount of "junk" to ignore at the left, right, top, and
  11729. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11730. while top and bottom are in units of 2 lines.
  11731. The default is 8 pixels on each side.
  11732. @item sb
  11733. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11734. filter generating an occasional mismatched frame, but it may also cause an
  11735. excessive number of frames to be dropped during high motion sequences.
  11736. Conversely, setting it to -1 will make filter match fields more easily.
  11737. This may help processing of video where there is slight blurring between
  11738. the fields, but may also cause there to be interlaced frames in the output.
  11739. Default value is @code{0}.
  11740. @item mp
  11741. Set the metric plane to use. It accepts the following values:
  11742. @table @samp
  11743. @item l
  11744. Use luma plane.
  11745. @item u
  11746. Use chroma blue plane.
  11747. @item v
  11748. Use chroma red plane.
  11749. @end table
  11750. This option may be set to use chroma plane instead of the default luma plane
  11751. for doing filter's computations. This may improve accuracy on very clean
  11752. source material, but more likely will decrease accuracy, especially if there
  11753. is chroma noise (rainbow effect) or any grayscale video.
  11754. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11755. load and make pullup usable in realtime on slow machines.
  11756. @end table
  11757. For best results (without duplicated frames in the output file) it is
  11758. necessary to change the output frame rate. For example, to inverse
  11759. telecine NTSC input:
  11760. @example
  11761. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11762. @end example
  11763. @section qp
  11764. Change video quantization parameters (QP).
  11765. The filter accepts the following option:
  11766. @table @option
  11767. @item qp
  11768. Set expression for quantization parameter.
  11769. @end table
  11770. The expression is evaluated through the eval API and can contain, among others,
  11771. the following constants:
  11772. @table @var
  11773. @item known
  11774. 1 if index is not 129, 0 otherwise.
  11775. @item qp
  11776. Sequential index starting from -129 to 128.
  11777. @end table
  11778. @subsection Examples
  11779. @itemize
  11780. @item
  11781. Some equation like:
  11782. @example
  11783. qp=2+2*sin(PI*qp)
  11784. @end example
  11785. @end itemize
  11786. @section random
  11787. Flush video frames from internal cache of frames into a random order.
  11788. No frame is discarded.
  11789. Inspired by @ref{frei0r} nervous filter.
  11790. @table @option
  11791. @item frames
  11792. Set size in number of frames of internal cache, in range from @code{2} to
  11793. @code{512}. Default is @code{30}.
  11794. @item seed
  11795. Set seed for random number generator, must be an integer included between
  11796. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11797. less than @code{0}, the filter will try to use a good random seed on a
  11798. best effort basis.
  11799. @end table
  11800. @section readeia608
  11801. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11802. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11803. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11804. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11805. @table @option
  11806. @item lavfi.readeia608.X.cc
  11807. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11808. @item lavfi.readeia608.X.line
  11809. The number of the line on which the EIA-608 data was identified and read.
  11810. @end table
  11811. This filter accepts the following options:
  11812. @table @option
  11813. @item scan_min
  11814. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11815. @item scan_max
  11816. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11817. @item spw
  11818. Set the ratio of width reserved for sync code detection.
  11819. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  11820. @item chp
  11821. Enable checking the parity bit. In the event of a parity error, the filter will output
  11822. @code{0x00} for that character. Default is false.
  11823. @item lp
  11824. Lowpass lines prior to further processing. Default is enabled.
  11825. @end table
  11826. @subsection Examples
  11827. @itemize
  11828. @item
  11829. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11830. @example
  11831. 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
  11832. @end example
  11833. @end itemize
  11834. @section readvitc
  11835. Read vertical interval timecode (VITC) information from the top lines of a
  11836. video frame.
  11837. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11838. timecode value, if a valid timecode has been detected. Further metadata key
  11839. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11840. timecode data has been found or not.
  11841. This filter accepts the following options:
  11842. @table @option
  11843. @item scan_max
  11844. Set the maximum number of lines to scan for VITC data. If the value is set to
  11845. @code{-1} the full video frame is scanned. Default is @code{45}.
  11846. @item thr_b
  11847. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11848. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11849. @item thr_w
  11850. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11851. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11852. @end table
  11853. @subsection Examples
  11854. @itemize
  11855. @item
  11856. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11857. draw @code{--:--:--:--} as a placeholder:
  11858. @example
  11859. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11860. @end example
  11861. @end itemize
  11862. @section remap
  11863. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11864. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11865. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11866. value for pixel will be used for destination pixel.
  11867. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11868. will have Xmap/Ymap video stream dimensions.
  11869. Xmap and Ymap input video streams are 16bit depth, single channel.
  11870. @table @option
  11871. @item format
  11872. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11873. Default is @code{color}.
  11874. @item fill
  11875. Specify the color of the unmapped pixels. For the syntax of this option,
  11876. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11877. manual,ffmpeg-utils}. Default color is @code{black}.
  11878. @end table
  11879. @section removegrain
  11880. The removegrain filter is a spatial denoiser for progressive video.
  11881. @table @option
  11882. @item m0
  11883. Set mode for the first plane.
  11884. @item m1
  11885. Set mode for the second plane.
  11886. @item m2
  11887. Set mode for the third plane.
  11888. @item m3
  11889. Set mode for the fourth plane.
  11890. @end table
  11891. Range of mode is from 0 to 24. Description of each mode follows:
  11892. @table @var
  11893. @item 0
  11894. Leave input plane unchanged. Default.
  11895. @item 1
  11896. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11897. @item 2
  11898. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11899. @item 3
  11900. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11901. @item 4
  11902. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11903. This is equivalent to a median filter.
  11904. @item 5
  11905. Line-sensitive clipping giving the minimal change.
  11906. @item 6
  11907. Line-sensitive clipping, intermediate.
  11908. @item 7
  11909. Line-sensitive clipping, intermediate.
  11910. @item 8
  11911. Line-sensitive clipping, intermediate.
  11912. @item 9
  11913. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11914. @item 10
  11915. Replaces the target pixel with the closest neighbour.
  11916. @item 11
  11917. [1 2 1] horizontal and vertical kernel blur.
  11918. @item 12
  11919. Same as mode 11.
  11920. @item 13
  11921. Bob mode, interpolates top field from the line where the neighbours
  11922. pixels are the closest.
  11923. @item 14
  11924. Bob mode, interpolates bottom field from the line where the neighbours
  11925. pixels are the closest.
  11926. @item 15
  11927. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11928. interpolation formula.
  11929. @item 16
  11930. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11931. interpolation formula.
  11932. @item 17
  11933. Clips the pixel with the minimum and maximum of respectively the maximum and
  11934. minimum of each pair of opposite neighbour pixels.
  11935. @item 18
  11936. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11937. the current pixel is minimal.
  11938. @item 19
  11939. Replaces the pixel with the average of its 8 neighbours.
  11940. @item 20
  11941. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11942. @item 21
  11943. Clips pixels using the averages of opposite neighbour.
  11944. @item 22
  11945. Same as mode 21 but simpler and faster.
  11946. @item 23
  11947. Small edge and halo removal, but reputed useless.
  11948. @item 24
  11949. Similar as 23.
  11950. @end table
  11951. @section removelogo
  11952. Suppress a TV station logo, using an image file to determine which
  11953. pixels comprise the logo. It works by filling in the pixels that
  11954. comprise the logo with neighboring pixels.
  11955. The filter accepts the following options:
  11956. @table @option
  11957. @item filename, f
  11958. Set the filter bitmap file, which can be any image format supported by
  11959. libavformat. The width and height of the image file must match those of the
  11960. video stream being processed.
  11961. @end table
  11962. Pixels in the provided bitmap image with a value of zero are not
  11963. considered part of the logo, non-zero pixels are considered part of
  11964. the logo. If you use white (255) for the logo and black (0) for the
  11965. rest, you will be safe. For making the filter bitmap, it is
  11966. recommended to take a screen capture of a black frame with the logo
  11967. visible, and then using a threshold filter followed by the erode
  11968. filter once or twice.
  11969. If needed, little splotches can be fixed manually. Remember that if
  11970. logo pixels are not covered, the filter quality will be much
  11971. reduced. Marking too many pixels as part of the logo does not hurt as
  11972. much, but it will increase the amount of blurring needed to cover over
  11973. the image and will destroy more information than necessary, and extra
  11974. pixels will slow things down on a large logo.
  11975. @section repeatfields
  11976. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11977. fields based on its value.
  11978. @section reverse
  11979. Reverse a video clip.
  11980. Warning: This filter requires memory to buffer the entire clip, so trimming
  11981. is suggested.
  11982. @subsection Examples
  11983. @itemize
  11984. @item
  11985. Take the first 5 seconds of a clip, and reverse it.
  11986. @example
  11987. trim=end=5,reverse
  11988. @end example
  11989. @end itemize
  11990. @section rgbashift
  11991. Shift R/G/B/A pixels horizontally and/or vertically.
  11992. The filter accepts the following options:
  11993. @table @option
  11994. @item rh
  11995. Set amount to shift red horizontally.
  11996. @item rv
  11997. Set amount to shift red vertically.
  11998. @item gh
  11999. Set amount to shift green horizontally.
  12000. @item gv
  12001. Set amount to shift green vertically.
  12002. @item bh
  12003. Set amount to shift blue horizontally.
  12004. @item bv
  12005. Set amount to shift blue vertically.
  12006. @item ah
  12007. Set amount to shift alpha horizontally.
  12008. @item av
  12009. Set amount to shift alpha vertically.
  12010. @item edge
  12011. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12012. @end table
  12013. @subsection Commands
  12014. This filter supports the all above options as @ref{commands}.
  12015. @section roberts
  12016. Apply roberts cross operator to input video stream.
  12017. The filter accepts the following option:
  12018. @table @option
  12019. @item planes
  12020. Set which planes will be processed, unprocessed planes will be copied.
  12021. By default value 0xf, all planes will be processed.
  12022. @item scale
  12023. Set value which will be multiplied with filtered result.
  12024. @item delta
  12025. Set value which will be added to filtered result.
  12026. @end table
  12027. @section rotate
  12028. Rotate video by an arbitrary angle expressed in radians.
  12029. The filter accepts the following options:
  12030. A description of the optional parameters follows.
  12031. @table @option
  12032. @item angle, a
  12033. Set an expression for the angle by which to rotate the input video
  12034. clockwise, expressed as a number of radians. A negative value will
  12035. result in a counter-clockwise rotation. By default it is set to "0".
  12036. This expression is evaluated for each frame.
  12037. @item out_w, ow
  12038. Set the output width expression, default value is "iw".
  12039. This expression is evaluated just once during configuration.
  12040. @item out_h, oh
  12041. Set the output height expression, default value is "ih".
  12042. This expression is evaluated just once during configuration.
  12043. @item bilinear
  12044. Enable bilinear interpolation if set to 1, a value of 0 disables
  12045. it. Default value is 1.
  12046. @item fillcolor, c
  12047. Set the color used to fill the output area not covered by the rotated
  12048. image. For the general syntax of this option, check the
  12049. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12050. If the special value "none" is selected then no
  12051. background is printed (useful for example if the background is never shown).
  12052. Default value is "black".
  12053. @end table
  12054. The expressions for the angle and the output size can contain the
  12055. following constants and functions:
  12056. @table @option
  12057. @item n
  12058. sequential number of the input frame, starting from 0. It is always NAN
  12059. before the first frame is filtered.
  12060. @item t
  12061. time in seconds of the input frame, it is set to 0 when the filter is
  12062. configured. It is always NAN before the first frame is filtered.
  12063. @item hsub
  12064. @item vsub
  12065. horizontal and vertical chroma subsample values. For example for the
  12066. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12067. @item in_w, iw
  12068. @item in_h, ih
  12069. the input video width and height
  12070. @item out_w, ow
  12071. @item out_h, oh
  12072. the output width and height, that is the size of the padded area as
  12073. specified by the @var{width} and @var{height} expressions
  12074. @item rotw(a)
  12075. @item roth(a)
  12076. the minimal width/height required for completely containing the input
  12077. video rotated by @var{a} radians.
  12078. These are only available when computing the @option{out_w} and
  12079. @option{out_h} expressions.
  12080. @end table
  12081. @subsection Examples
  12082. @itemize
  12083. @item
  12084. Rotate the input by PI/6 radians clockwise:
  12085. @example
  12086. rotate=PI/6
  12087. @end example
  12088. @item
  12089. Rotate the input by PI/6 radians counter-clockwise:
  12090. @example
  12091. rotate=-PI/6
  12092. @end example
  12093. @item
  12094. Rotate the input by 45 degrees clockwise:
  12095. @example
  12096. rotate=45*PI/180
  12097. @end example
  12098. @item
  12099. Apply a constant rotation with period T, starting from an angle of PI/3:
  12100. @example
  12101. rotate=PI/3+2*PI*t/T
  12102. @end example
  12103. @item
  12104. Make the input video rotation oscillating with a period of T
  12105. seconds and an amplitude of A radians:
  12106. @example
  12107. rotate=A*sin(2*PI/T*t)
  12108. @end example
  12109. @item
  12110. Rotate the video, output size is chosen so that the whole rotating
  12111. input video is always completely contained in the output:
  12112. @example
  12113. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12114. @end example
  12115. @item
  12116. Rotate the video, reduce the output size so that no background is ever
  12117. shown:
  12118. @example
  12119. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12120. @end example
  12121. @end itemize
  12122. @subsection Commands
  12123. The filter supports the following commands:
  12124. @table @option
  12125. @item a, angle
  12126. Set the angle expression.
  12127. The command accepts the same syntax of the corresponding option.
  12128. If the specified expression is not valid, it is kept at its current
  12129. value.
  12130. @end table
  12131. @section sab
  12132. Apply Shape Adaptive Blur.
  12133. The filter accepts the following options:
  12134. @table @option
  12135. @item luma_radius, lr
  12136. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12137. value is 1.0. A greater value will result in a more blurred image, and
  12138. in slower processing.
  12139. @item luma_pre_filter_radius, lpfr
  12140. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12141. value is 1.0.
  12142. @item luma_strength, ls
  12143. Set luma maximum difference between pixels to still be considered, must
  12144. be a value in the 0.1-100.0 range, default value is 1.0.
  12145. @item chroma_radius, cr
  12146. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12147. greater value will result in a more blurred image, and in slower
  12148. processing.
  12149. @item chroma_pre_filter_radius, cpfr
  12150. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12151. @item chroma_strength, cs
  12152. Set chroma maximum difference between pixels to still be considered,
  12153. must be a value in the -0.9-100.0 range.
  12154. @end table
  12155. Each chroma option value, if not explicitly specified, is set to the
  12156. corresponding luma option value.
  12157. @anchor{scale}
  12158. @section scale
  12159. Scale (resize) the input video, using the libswscale library.
  12160. The scale filter forces the output display aspect ratio to be the same
  12161. of the input, by changing the output sample aspect ratio.
  12162. If the input image format is different from the format requested by
  12163. the next filter, the scale filter will convert the input to the
  12164. requested format.
  12165. @subsection Options
  12166. The filter accepts the following options, or any of the options
  12167. supported by the libswscale scaler.
  12168. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12169. the complete list of scaler options.
  12170. @table @option
  12171. @item width, w
  12172. @item height, h
  12173. Set the output video dimension expression. Default value is the input
  12174. dimension.
  12175. If the @var{width} or @var{w} value is 0, the input width is used for
  12176. the output. If the @var{height} or @var{h} value is 0, the input height
  12177. is used for the output.
  12178. If one and only one of the values is -n with n >= 1, the scale filter
  12179. will use a value that maintains the aspect ratio of the input image,
  12180. calculated from the other specified dimension. After that it will,
  12181. however, make sure that the calculated dimension is divisible by n and
  12182. adjust the value if necessary.
  12183. If both values are -n with n >= 1, the behavior will be identical to
  12184. both values being set to 0 as previously detailed.
  12185. See below for the list of accepted constants for use in the dimension
  12186. expression.
  12187. @item eval
  12188. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12189. @table @samp
  12190. @item init
  12191. Only evaluate expressions once during the filter initialization or when a command is processed.
  12192. @item frame
  12193. Evaluate expressions for each incoming frame.
  12194. @end table
  12195. Default value is @samp{init}.
  12196. @item interl
  12197. Set the interlacing mode. It accepts the following values:
  12198. @table @samp
  12199. @item 1
  12200. Force interlaced aware scaling.
  12201. @item 0
  12202. Do not apply interlaced scaling.
  12203. @item -1
  12204. Select interlaced aware scaling depending on whether the source frames
  12205. are flagged as interlaced or not.
  12206. @end table
  12207. Default value is @samp{0}.
  12208. @item flags
  12209. Set libswscale scaling flags. See
  12210. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12211. complete list of values. If not explicitly specified the filter applies
  12212. the default flags.
  12213. @item param0, param1
  12214. Set libswscale input parameters for scaling algorithms that need them. See
  12215. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12216. complete documentation. If not explicitly specified the filter applies
  12217. empty parameters.
  12218. @item size, s
  12219. Set the video size. For the syntax of this option, check the
  12220. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12221. @item in_color_matrix
  12222. @item out_color_matrix
  12223. Set in/output YCbCr color space type.
  12224. This allows the autodetected value to be overridden as well as allows forcing
  12225. a specific value used for the output and encoder.
  12226. If not specified, the color space type depends on the pixel format.
  12227. Possible values:
  12228. @table @samp
  12229. @item auto
  12230. Choose automatically.
  12231. @item bt709
  12232. Format conforming to International Telecommunication Union (ITU)
  12233. Recommendation BT.709.
  12234. @item fcc
  12235. Set color space conforming to the United States Federal Communications
  12236. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12237. @item bt601
  12238. @item bt470
  12239. @item smpte170m
  12240. Set color space conforming to:
  12241. @itemize
  12242. @item
  12243. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12244. @item
  12245. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12246. @item
  12247. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12248. @end itemize
  12249. @item smpte240m
  12250. Set color space conforming to SMPTE ST 240:1999.
  12251. @item bt2020
  12252. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12253. @end table
  12254. @item in_range
  12255. @item out_range
  12256. Set in/output YCbCr sample range.
  12257. This allows the autodetected value to be overridden as well as allows forcing
  12258. a specific value used for the output and encoder. If not specified, the
  12259. range depends on the pixel format. Possible values:
  12260. @table @samp
  12261. @item auto/unknown
  12262. Choose automatically.
  12263. @item jpeg/full/pc
  12264. Set full range (0-255 in case of 8-bit luma).
  12265. @item mpeg/limited/tv
  12266. Set "MPEG" range (16-235 in case of 8-bit luma).
  12267. @end table
  12268. @item force_original_aspect_ratio
  12269. Enable decreasing or increasing output video width or height if necessary to
  12270. keep the original aspect ratio. Possible values:
  12271. @table @samp
  12272. @item disable
  12273. Scale the video as specified and disable this feature.
  12274. @item decrease
  12275. The output video dimensions will automatically be decreased if needed.
  12276. @item increase
  12277. The output video dimensions will automatically be increased if needed.
  12278. @end table
  12279. One useful instance of this option is that when you know a specific device's
  12280. maximum allowed resolution, you can use this to limit the output video to
  12281. that, while retaining the aspect ratio. For example, device A allows
  12282. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12283. decrease) and specifying 1280x720 to the command line makes the output
  12284. 1280x533.
  12285. Please note that this is a different thing than specifying -1 for @option{w}
  12286. or @option{h}, you still need to specify the output resolution for this option
  12287. to work.
  12288. @item force_divisible_by
  12289. Ensures that both the output dimensions, width and height, are divisible by the
  12290. given integer when used together with @option{force_original_aspect_ratio}. This
  12291. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12292. This option respects the value set for @option{force_original_aspect_ratio},
  12293. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12294. may be slightly modified.
  12295. This option can be handy if you need to have a video fit within or exceed
  12296. a defined resolution using @option{force_original_aspect_ratio} but also have
  12297. encoder restrictions on width or height divisibility.
  12298. @end table
  12299. The values of the @option{w} and @option{h} options are expressions
  12300. containing the following constants:
  12301. @table @var
  12302. @item in_w
  12303. @item in_h
  12304. The input width and height
  12305. @item iw
  12306. @item ih
  12307. These are the same as @var{in_w} and @var{in_h}.
  12308. @item out_w
  12309. @item out_h
  12310. The output (scaled) width and height
  12311. @item ow
  12312. @item oh
  12313. These are the same as @var{out_w} and @var{out_h}
  12314. @item a
  12315. The same as @var{iw} / @var{ih}
  12316. @item sar
  12317. input sample aspect ratio
  12318. @item dar
  12319. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12320. @item hsub
  12321. @item vsub
  12322. horizontal and vertical input chroma subsample values. For example for the
  12323. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12324. @item ohsub
  12325. @item ovsub
  12326. horizontal and vertical output chroma subsample values. For example for the
  12327. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12328. @item n
  12329. The (sequential) number of the input frame, starting from 0.
  12330. Only available with @code{eval=frame}.
  12331. @item t
  12332. The presentation timestamp of the input frame, expressed as a number of
  12333. seconds. Only available with @code{eval=frame}.
  12334. @item pos
  12335. The position (byte offset) of the frame in the input stream, or NaN if
  12336. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12337. Only available with @code{eval=frame}.
  12338. @end table
  12339. @subsection Examples
  12340. @itemize
  12341. @item
  12342. Scale the input video to a size of 200x100
  12343. @example
  12344. scale=w=200:h=100
  12345. @end example
  12346. This is equivalent to:
  12347. @example
  12348. scale=200:100
  12349. @end example
  12350. or:
  12351. @example
  12352. scale=200x100
  12353. @end example
  12354. @item
  12355. Specify a size abbreviation for the output size:
  12356. @example
  12357. scale=qcif
  12358. @end example
  12359. which can also be written as:
  12360. @example
  12361. scale=size=qcif
  12362. @end example
  12363. @item
  12364. Scale the input to 2x:
  12365. @example
  12366. scale=w=2*iw:h=2*ih
  12367. @end example
  12368. @item
  12369. The above is the same as:
  12370. @example
  12371. scale=2*in_w:2*in_h
  12372. @end example
  12373. @item
  12374. Scale the input to 2x with forced interlaced scaling:
  12375. @example
  12376. scale=2*iw:2*ih:interl=1
  12377. @end example
  12378. @item
  12379. Scale the input to half size:
  12380. @example
  12381. scale=w=iw/2:h=ih/2
  12382. @end example
  12383. @item
  12384. Increase the width, and set the height to the same size:
  12385. @example
  12386. scale=3/2*iw:ow
  12387. @end example
  12388. @item
  12389. Seek Greek harmony:
  12390. @example
  12391. scale=iw:1/PHI*iw
  12392. scale=ih*PHI:ih
  12393. @end example
  12394. @item
  12395. Increase the height, and set the width to 3/2 of the height:
  12396. @example
  12397. scale=w=3/2*oh:h=3/5*ih
  12398. @end example
  12399. @item
  12400. Increase the size, making the size a multiple of the chroma
  12401. subsample values:
  12402. @example
  12403. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12404. @end example
  12405. @item
  12406. Increase the width to a maximum of 500 pixels,
  12407. keeping the same aspect ratio as the input:
  12408. @example
  12409. scale=w='min(500\, iw*3/2):h=-1'
  12410. @end example
  12411. @item
  12412. Make pixels square by combining scale and setsar:
  12413. @example
  12414. scale='trunc(ih*dar):ih',setsar=1/1
  12415. @end example
  12416. @item
  12417. Make pixels square by combining scale and setsar,
  12418. making sure the resulting resolution is even (required by some codecs):
  12419. @example
  12420. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12421. @end example
  12422. @end itemize
  12423. @subsection Commands
  12424. This filter supports the following commands:
  12425. @table @option
  12426. @item width, w
  12427. @item height, h
  12428. Set the output video dimension expression.
  12429. The command accepts the same syntax of the corresponding option.
  12430. If the specified expression is not valid, it is kept at its current
  12431. value.
  12432. @end table
  12433. @section scale_npp
  12434. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12435. format conversion on CUDA video frames. Setting the output width and height
  12436. works in the same way as for the @var{scale} filter.
  12437. The following additional options are accepted:
  12438. @table @option
  12439. @item format
  12440. The pixel format of the output CUDA frames. If set to the string "same" (the
  12441. default), the input format will be kept. Note that automatic format negotiation
  12442. and conversion is not yet supported for hardware frames
  12443. @item interp_algo
  12444. The interpolation algorithm used for resizing. One of the following:
  12445. @table @option
  12446. @item nn
  12447. Nearest neighbour.
  12448. @item linear
  12449. @item cubic
  12450. @item cubic2p_bspline
  12451. 2-parameter cubic (B=1, C=0)
  12452. @item cubic2p_catmullrom
  12453. 2-parameter cubic (B=0, C=1/2)
  12454. @item cubic2p_b05c03
  12455. 2-parameter cubic (B=1/2, C=3/10)
  12456. @item super
  12457. Supersampling
  12458. @item lanczos
  12459. @end table
  12460. @item force_original_aspect_ratio
  12461. Enable decreasing or increasing output video width or height if necessary to
  12462. keep the original aspect ratio. Possible values:
  12463. @table @samp
  12464. @item disable
  12465. Scale the video as specified and disable this feature.
  12466. @item decrease
  12467. The output video dimensions will automatically be decreased if needed.
  12468. @item increase
  12469. The output video dimensions will automatically be increased if needed.
  12470. @end table
  12471. One useful instance of this option is that when you know a specific device's
  12472. maximum allowed resolution, you can use this to limit the output video to
  12473. that, while retaining the aspect ratio. For example, device A allows
  12474. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12475. decrease) and specifying 1280x720 to the command line makes the output
  12476. 1280x533.
  12477. Please note that this is a different thing than specifying -1 for @option{w}
  12478. or @option{h}, you still need to specify the output resolution for this option
  12479. to work.
  12480. @item force_divisible_by
  12481. Ensures that both the output dimensions, width and height, are divisible by the
  12482. given integer when used together with @option{force_original_aspect_ratio}. This
  12483. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12484. This option respects the value set for @option{force_original_aspect_ratio},
  12485. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12486. may be slightly modified.
  12487. This option can be handy if you need to have a video fit within or exceed
  12488. a defined resolution using @option{force_original_aspect_ratio} but also have
  12489. encoder restrictions on width or height divisibility.
  12490. @end table
  12491. @section scale2ref
  12492. Scale (resize) the input video, based on a reference video.
  12493. See the scale filter for available options, scale2ref supports the same but
  12494. uses the reference video instead of the main input as basis. scale2ref also
  12495. supports the following additional constants for the @option{w} and
  12496. @option{h} options:
  12497. @table @var
  12498. @item main_w
  12499. @item main_h
  12500. The main input video's width and height
  12501. @item main_a
  12502. The same as @var{main_w} / @var{main_h}
  12503. @item main_sar
  12504. The main input video's sample aspect ratio
  12505. @item main_dar, mdar
  12506. The main input video's display aspect ratio. Calculated from
  12507. @code{(main_w / main_h) * main_sar}.
  12508. @item main_hsub
  12509. @item main_vsub
  12510. The main input video's horizontal and vertical chroma subsample values.
  12511. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12512. is 1.
  12513. @item main_n
  12514. The (sequential) number of the main input frame, starting from 0.
  12515. Only available with @code{eval=frame}.
  12516. @item main_t
  12517. The presentation timestamp of the main input frame, expressed as a number of
  12518. seconds. Only available with @code{eval=frame}.
  12519. @item main_pos
  12520. The position (byte offset) of the frame in the main input stream, or NaN if
  12521. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12522. Only available with @code{eval=frame}.
  12523. @end table
  12524. @subsection Examples
  12525. @itemize
  12526. @item
  12527. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12528. @example
  12529. 'scale2ref[b][a];[a][b]overlay'
  12530. @end example
  12531. @item
  12532. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12533. @example
  12534. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12535. @end example
  12536. @end itemize
  12537. @subsection Commands
  12538. This filter supports the following commands:
  12539. @table @option
  12540. @item width, w
  12541. @item height, h
  12542. Set the output video dimension expression.
  12543. The command accepts the same syntax of the corresponding option.
  12544. If the specified expression is not valid, it is kept at its current
  12545. value.
  12546. @end table
  12547. @section scroll
  12548. Scroll input video horizontally and/or vertically by constant speed.
  12549. The filter accepts the following options:
  12550. @table @option
  12551. @item horizontal, h
  12552. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12553. Negative values changes scrolling direction.
  12554. @item vertical, v
  12555. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12556. Negative values changes scrolling direction.
  12557. @item hpos
  12558. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12559. @item vpos
  12560. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12561. @end table
  12562. @subsection Commands
  12563. This filter supports the following @ref{commands}:
  12564. @table @option
  12565. @item horizontal, h
  12566. Set the horizontal scrolling speed.
  12567. @item vertical, v
  12568. Set the vertical scrolling speed.
  12569. @end table
  12570. @anchor{selectivecolor}
  12571. @section selectivecolor
  12572. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12573. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12574. by the "purity" of the color (that is, how saturated it already is).
  12575. This filter is similar to the Adobe Photoshop Selective Color tool.
  12576. The filter accepts the following options:
  12577. @table @option
  12578. @item correction_method
  12579. Select color correction method.
  12580. Available values are:
  12581. @table @samp
  12582. @item absolute
  12583. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12584. component value).
  12585. @item relative
  12586. Specified adjustments are relative to the original component value.
  12587. @end table
  12588. Default is @code{absolute}.
  12589. @item reds
  12590. Adjustments for red pixels (pixels where the red component is the maximum)
  12591. @item yellows
  12592. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12593. @item greens
  12594. Adjustments for green pixels (pixels where the green component is the maximum)
  12595. @item cyans
  12596. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12597. @item blues
  12598. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12599. @item magentas
  12600. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12601. @item whites
  12602. Adjustments for white pixels (pixels where all components are greater than 128)
  12603. @item neutrals
  12604. Adjustments for all pixels except pure black and pure white
  12605. @item blacks
  12606. Adjustments for black pixels (pixels where all components are lesser than 128)
  12607. @item psfile
  12608. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12609. @end table
  12610. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12611. 4 space separated floating point adjustment values in the [-1,1] range,
  12612. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12613. pixels of its range.
  12614. @subsection Examples
  12615. @itemize
  12616. @item
  12617. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12618. increase magenta by 27% in blue areas:
  12619. @example
  12620. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12621. @end example
  12622. @item
  12623. Use a Photoshop selective color preset:
  12624. @example
  12625. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12626. @end example
  12627. @end itemize
  12628. @anchor{separatefields}
  12629. @section separatefields
  12630. The @code{separatefields} takes a frame-based video input and splits
  12631. each frame into its components fields, producing a new half height clip
  12632. with twice the frame rate and twice the frame count.
  12633. This filter use field-dominance information in frame to decide which
  12634. of each pair of fields to place first in the output.
  12635. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12636. @section setdar, setsar
  12637. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12638. output video.
  12639. This is done by changing the specified Sample (aka Pixel) Aspect
  12640. Ratio, according to the following equation:
  12641. @example
  12642. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12643. @end example
  12644. Keep in mind that the @code{setdar} filter does not modify the pixel
  12645. dimensions of the video frame. Also, the display aspect ratio set by
  12646. this filter may be changed by later filters in the filterchain,
  12647. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12648. applied.
  12649. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12650. the filter output video.
  12651. Note that as a consequence of the application of this filter, the
  12652. output display aspect ratio will change according to the equation
  12653. above.
  12654. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12655. filter may be changed by later filters in the filterchain, e.g. if
  12656. another "setsar" or a "setdar" filter is applied.
  12657. It accepts the following parameters:
  12658. @table @option
  12659. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12660. Set the aspect ratio used by the filter.
  12661. The parameter can be a floating point number string, an expression, or
  12662. a string of the form @var{num}:@var{den}, where @var{num} and
  12663. @var{den} are the numerator and denominator of the aspect ratio. If
  12664. the parameter is not specified, it is assumed the value "0".
  12665. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12666. should be escaped.
  12667. @item max
  12668. Set the maximum integer value to use for expressing numerator and
  12669. denominator when reducing the expressed aspect ratio to a rational.
  12670. Default value is @code{100}.
  12671. @end table
  12672. The parameter @var{sar} is an expression containing
  12673. the following constants:
  12674. @table @option
  12675. @item E, PI, PHI
  12676. These are approximated values for the mathematical constants e
  12677. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12678. @item w, h
  12679. The input width and height.
  12680. @item a
  12681. These are the same as @var{w} / @var{h}.
  12682. @item sar
  12683. The input sample aspect ratio.
  12684. @item dar
  12685. The input display aspect ratio. It is the same as
  12686. (@var{w} / @var{h}) * @var{sar}.
  12687. @item hsub, vsub
  12688. Horizontal and vertical chroma subsample values. For example, for the
  12689. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12690. @end table
  12691. @subsection Examples
  12692. @itemize
  12693. @item
  12694. To change the display aspect ratio to 16:9, specify one of the following:
  12695. @example
  12696. setdar=dar=1.77777
  12697. setdar=dar=16/9
  12698. @end example
  12699. @item
  12700. To change the sample aspect ratio to 10:11, specify:
  12701. @example
  12702. setsar=sar=10/11
  12703. @end example
  12704. @item
  12705. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12706. 1000 in the aspect ratio reduction, use the command:
  12707. @example
  12708. setdar=ratio=16/9:max=1000
  12709. @end example
  12710. @end itemize
  12711. @anchor{setfield}
  12712. @section setfield
  12713. Force field for the output video frame.
  12714. The @code{setfield} filter marks the interlace type field for the
  12715. output frames. It does not change the input frame, but only sets the
  12716. corresponding property, which affects how the frame is treated by
  12717. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12718. The filter accepts the following options:
  12719. @table @option
  12720. @item mode
  12721. Available values are:
  12722. @table @samp
  12723. @item auto
  12724. Keep the same field property.
  12725. @item bff
  12726. Mark the frame as bottom-field-first.
  12727. @item tff
  12728. Mark the frame as top-field-first.
  12729. @item prog
  12730. Mark the frame as progressive.
  12731. @end table
  12732. @end table
  12733. @anchor{setparams}
  12734. @section setparams
  12735. Force frame parameter for the output video frame.
  12736. The @code{setparams} filter marks interlace and color range for the
  12737. output frames. It does not change the input frame, but only sets the
  12738. corresponding property, which affects how the frame is treated by
  12739. filters/encoders.
  12740. @table @option
  12741. @item field_mode
  12742. Available values are:
  12743. @table @samp
  12744. @item auto
  12745. Keep the same field property (default).
  12746. @item bff
  12747. Mark the frame as bottom-field-first.
  12748. @item tff
  12749. Mark the frame as top-field-first.
  12750. @item prog
  12751. Mark the frame as progressive.
  12752. @end table
  12753. @item range
  12754. Available values are:
  12755. @table @samp
  12756. @item auto
  12757. Keep the same color range property (default).
  12758. @item unspecified, unknown
  12759. Mark the frame as unspecified color range.
  12760. @item limited, tv, mpeg
  12761. Mark the frame as limited range.
  12762. @item full, pc, jpeg
  12763. Mark the frame as full range.
  12764. @end table
  12765. @item color_primaries
  12766. Set the color primaries.
  12767. Available values are:
  12768. @table @samp
  12769. @item auto
  12770. Keep the same color primaries property (default).
  12771. @item bt709
  12772. @item unknown
  12773. @item bt470m
  12774. @item bt470bg
  12775. @item smpte170m
  12776. @item smpte240m
  12777. @item film
  12778. @item bt2020
  12779. @item smpte428
  12780. @item smpte431
  12781. @item smpte432
  12782. @item jedec-p22
  12783. @end table
  12784. @item color_trc
  12785. Set the color transfer.
  12786. Available values are:
  12787. @table @samp
  12788. @item auto
  12789. Keep the same color trc property (default).
  12790. @item bt709
  12791. @item unknown
  12792. @item bt470m
  12793. @item bt470bg
  12794. @item smpte170m
  12795. @item smpte240m
  12796. @item linear
  12797. @item log100
  12798. @item log316
  12799. @item iec61966-2-4
  12800. @item bt1361e
  12801. @item iec61966-2-1
  12802. @item bt2020-10
  12803. @item bt2020-12
  12804. @item smpte2084
  12805. @item smpte428
  12806. @item arib-std-b67
  12807. @end table
  12808. @item colorspace
  12809. Set the colorspace.
  12810. Available values are:
  12811. @table @samp
  12812. @item auto
  12813. Keep the same colorspace property (default).
  12814. @item gbr
  12815. @item bt709
  12816. @item unknown
  12817. @item fcc
  12818. @item bt470bg
  12819. @item smpte170m
  12820. @item smpte240m
  12821. @item ycgco
  12822. @item bt2020nc
  12823. @item bt2020c
  12824. @item smpte2085
  12825. @item chroma-derived-nc
  12826. @item chroma-derived-c
  12827. @item ictcp
  12828. @end table
  12829. @end table
  12830. @section showinfo
  12831. Show a line containing various information for each input video frame.
  12832. The input video is not modified.
  12833. This filter supports the following options:
  12834. @table @option
  12835. @item checksum
  12836. Calculate checksums of each plane. By default enabled.
  12837. @end table
  12838. The shown line contains a sequence of key/value pairs of the form
  12839. @var{key}:@var{value}.
  12840. The following values are shown in the output:
  12841. @table @option
  12842. @item n
  12843. The (sequential) number of the input frame, starting from 0.
  12844. @item pts
  12845. The Presentation TimeStamp of the input frame, expressed as a number of
  12846. time base units. The time base unit depends on the filter input pad.
  12847. @item pts_time
  12848. The Presentation TimeStamp of the input frame, expressed as a number of
  12849. seconds.
  12850. @item pos
  12851. The position of the frame in the input stream, or -1 if this information is
  12852. unavailable and/or meaningless (for example in case of synthetic video).
  12853. @item fmt
  12854. The pixel format name.
  12855. @item sar
  12856. The sample aspect ratio of the input frame, expressed in the form
  12857. @var{num}/@var{den}.
  12858. @item s
  12859. The size of the input frame. For the syntax of this option, check the
  12860. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12861. @item i
  12862. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12863. for bottom field first).
  12864. @item iskey
  12865. This is 1 if the frame is a key frame, 0 otherwise.
  12866. @item type
  12867. The picture type of the input frame ("I" for an I-frame, "P" for a
  12868. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12869. Also refer to the documentation of the @code{AVPictureType} enum and of
  12870. the @code{av_get_picture_type_char} function defined in
  12871. @file{libavutil/avutil.h}.
  12872. @item checksum
  12873. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12874. @item plane_checksum
  12875. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12876. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12877. @item mean
  12878. The mean value of pixels in each plane of the input frame, expressed in the form
  12879. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  12880. @item stdev
  12881. The standard deviation of pixel values in each plane of the input frame, expressed
  12882. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  12883. @end table
  12884. @section showpalette
  12885. Displays the 256 colors palette of each frame. This filter is only relevant for
  12886. @var{pal8} pixel format frames.
  12887. It accepts the following option:
  12888. @table @option
  12889. @item s
  12890. Set the size of the box used to represent one palette color entry. Default is
  12891. @code{30} (for a @code{30x30} pixel box).
  12892. @end table
  12893. @section shuffleframes
  12894. Reorder and/or duplicate and/or drop video frames.
  12895. It accepts the following parameters:
  12896. @table @option
  12897. @item mapping
  12898. Set the destination indexes of input frames.
  12899. This is space or '|' separated list of indexes that maps input frames to output
  12900. frames. Number of indexes also sets maximal value that each index may have.
  12901. '-1' index have special meaning and that is to drop frame.
  12902. @end table
  12903. The first frame has the index 0. The default is to keep the input unchanged.
  12904. @subsection Examples
  12905. @itemize
  12906. @item
  12907. Swap second and third frame of every three frames of the input:
  12908. @example
  12909. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12910. @end example
  12911. @item
  12912. Swap 10th and 1st frame of every ten frames of the input:
  12913. @example
  12914. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12915. @end example
  12916. @end itemize
  12917. @section shuffleplanes
  12918. Reorder and/or duplicate video planes.
  12919. It accepts the following parameters:
  12920. @table @option
  12921. @item map0
  12922. The index of the input plane to be used as the first output plane.
  12923. @item map1
  12924. The index of the input plane to be used as the second output plane.
  12925. @item map2
  12926. The index of the input plane to be used as the third output plane.
  12927. @item map3
  12928. The index of the input plane to be used as the fourth output plane.
  12929. @end table
  12930. The first plane has the index 0. The default is to keep the input unchanged.
  12931. @subsection Examples
  12932. @itemize
  12933. @item
  12934. Swap the second and third planes of the input:
  12935. @example
  12936. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12937. @end example
  12938. @end itemize
  12939. @anchor{signalstats}
  12940. @section signalstats
  12941. Evaluate various visual metrics that assist in determining issues associated
  12942. with the digitization of analog video media.
  12943. By default the filter will log these metadata values:
  12944. @table @option
  12945. @item YMIN
  12946. Display the minimal Y value contained within the input frame. Expressed in
  12947. range of [0-255].
  12948. @item YLOW
  12949. Display the Y value at the 10% percentile within the input frame. Expressed in
  12950. range of [0-255].
  12951. @item YAVG
  12952. Display the average Y value within the input frame. Expressed in range of
  12953. [0-255].
  12954. @item YHIGH
  12955. Display the Y value at the 90% percentile within the input frame. Expressed in
  12956. range of [0-255].
  12957. @item YMAX
  12958. Display the maximum Y value contained within the input frame. Expressed in
  12959. range of [0-255].
  12960. @item UMIN
  12961. Display the minimal U value contained within the input frame. Expressed in
  12962. range of [0-255].
  12963. @item ULOW
  12964. Display the U value at the 10% percentile within the input frame. Expressed in
  12965. range of [0-255].
  12966. @item UAVG
  12967. Display the average U value within the input frame. Expressed in range of
  12968. [0-255].
  12969. @item UHIGH
  12970. Display the U value at the 90% percentile within the input frame. Expressed in
  12971. range of [0-255].
  12972. @item UMAX
  12973. Display the maximum U value contained within the input frame. Expressed in
  12974. range of [0-255].
  12975. @item VMIN
  12976. Display the minimal V value contained within the input frame. Expressed in
  12977. range of [0-255].
  12978. @item VLOW
  12979. Display the V value at the 10% percentile within the input frame. Expressed in
  12980. range of [0-255].
  12981. @item VAVG
  12982. Display the average V value within the input frame. Expressed in range of
  12983. [0-255].
  12984. @item VHIGH
  12985. Display the V value at the 90% percentile within the input frame. Expressed in
  12986. range of [0-255].
  12987. @item VMAX
  12988. Display the maximum V value contained within the input frame. Expressed in
  12989. range of [0-255].
  12990. @item SATMIN
  12991. Display the minimal saturation value contained within the input frame.
  12992. Expressed in range of [0-~181.02].
  12993. @item SATLOW
  12994. Display the saturation value at the 10% percentile within the input frame.
  12995. Expressed in range of [0-~181.02].
  12996. @item SATAVG
  12997. Display the average saturation value within the input frame. Expressed in range
  12998. of [0-~181.02].
  12999. @item SATHIGH
  13000. Display the saturation value at the 90% percentile within the input frame.
  13001. Expressed in range of [0-~181.02].
  13002. @item SATMAX
  13003. Display the maximum saturation value contained within the input frame.
  13004. Expressed in range of [0-~181.02].
  13005. @item HUEMED
  13006. Display the median value for hue within the input frame. Expressed in range of
  13007. [0-360].
  13008. @item HUEAVG
  13009. Display the average value for hue within the input frame. Expressed in range of
  13010. [0-360].
  13011. @item YDIF
  13012. Display the average of sample value difference between all values of the Y
  13013. plane in the current frame and corresponding values of the previous input frame.
  13014. Expressed in range of [0-255].
  13015. @item UDIF
  13016. Display the average of sample value difference between all values of the U
  13017. plane in the current frame and corresponding values of the previous input frame.
  13018. Expressed in range of [0-255].
  13019. @item VDIF
  13020. Display the average of sample value difference between all values of the V
  13021. plane in the current frame and corresponding values of the previous input frame.
  13022. Expressed in range of [0-255].
  13023. @item YBITDEPTH
  13024. Display bit depth of Y plane in current frame.
  13025. Expressed in range of [0-16].
  13026. @item UBITDEPTH
  13027. Display bit depth of U plane in current frame.
  13028. Expressed in range of [0-16].
  13029. @item VBITDEPTH
  13030. Display bit depth of V plane in current frame.
  13031. Expressed in range of [0-16].
  13032. @end table
  13033. The filter accepts the following options:
  13034. @table @option
  13035. @item stat
  13036. @item out
  13037. @option{stat} specify an additional form of image analysis.
  13038. @option{out} output video with the specified type of pixel highlighted.
  13039. Both options accept the following values:
  13040. @table @samp
  13041. @item tout
  13042. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13043. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13044. include the results of video dropouts, head clogs, or tape tracking issues.
  13045. @item vrep
  13046. Identify @var{vertical line repetition}. Vertical line repetition includes
  13047. similar rows of pixels within a frame. In born-digital video vertical line
  13048. repetition is common, but this pattern is uncommon in video digitized from an
  13049. analog source. When it occurs in video that results from the digitization of an
  13050. analog source it can indicate concealment from a dropout compensator.
  13051. @item brng
  13052. Identify pixels that fall outside of legal broadcast range.
  13053. @end table
  13054. @item color, c
  13055. Set the highlight color for the @option{out} option. The default color is
  13056. yellow.
  13057. @end table
  13058. @subsection Examples
  13059. @itemize
  13060. @item
  13061. Output data of various video metrics:
  13062. @example
  13063. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13064. @end example
  13065. @item
  13066. Output specific data about the minimum and maximum values of the Y plane per frame:
  13067. @example
  13068. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13069. @end example
  13070. @item
  13071. Playback video while highlighting pixels that are outside of broadcast range in red.
  13072. @example
  13073. ffplay example.mov -vf signalstats="out=brng:color=red"
  13074. @end example
  13075. @item
  13076. Playback video with signalstats metadata drawn over the frame.
  13077. @example
  13078. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13079. @end example
  13080. The contents of signalstat_drawtext.txt used in the command are:
  13081. @example
  13082. time %@{pts:hms@}
  13083. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13084. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13085. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13086. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13087. @end example
  13088. @end itemize
  13089. @anchor{signature}
  13090. @section signature
  13091. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13092. input. In this case the matching between the inputs can be calculated additionally.
  13093. The filter always passes through the first input. The signature of each stream can
  13094. be written into a file.
  13095. It accepts the following options:
  13096. @table @option
  13097. @item detectmode
  13098. Enable or disable the matching process.
  13099. Available values are:
  13100. @table @samp
  13101. @item off
  13102. Disable the calculation of a matching (default).
  13103. @item full
  13104. Calculate the matching for the whole video and output whether the whole video
  13105. matches or only parts.
  13106. @item fast
  13107. Calculate only until a matching is found or the video ends. Should be faster in
  13108. some cases.
  13109. @end table
  13110. @item nb_inputs
  13111. Set the number of inputs. The option value must be a non negative integer.
  13112. Default value is 1.
  13113. @item filename
  13114. Set the path to which the output is written. If there is more than one input,
  13115. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13116. integer), that will be replaced with the input number. If no filename is
  13117. specified, no output will be written. This is the default.
  13118. @item format
  13119. Choose the output format.
  13120. Available values are:
  13121. @table @samp
  13122. @item binary
  13123. Use the specified binary representation (default).
  13124. @item xml
  13125. Use the specified xml representation.
  13126. @end table
  13127. @item th_d
  13128. Set threshold to detect one word as similar. The option value must be an integer
  13129. greater than zero. The default value is 9000.
  13130. @item th_dc
  13131. Set threshold to detect all words as similar. The option value must be an integer
  13132. greater than zero. The default value is 60000.
  13133. @item th_xh
  13134. Set threshold to detect frames as similar. The option value must be an integer
  13135. greater than zero. The default value is 116.
  13136. @item th_di
  13137. Set the minimum length of a sequence in frames to recognize it as matching
  13138. sequence. The option value must be a non negative integer value.
  13139. The default value is 0.
  13140. @item th_it
  13141. Set the minimum relation, that matching frames to all frames must have.
  13142. The option value must be a double value between 0 and 1. The default value is 0.5.
  13143. @end table
  13144. @subsection Examples
  13145. @itemize
  13146. @item
  13147. To calculate the signature of an input video and store it in signature.bin:
  13148. @example
  13149. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13150. @end example
  13151. @item
  13152. To detect whether two videos match and store the signatures in XML format in
  13153. signature0.xml and signature1.xml:
  13154. @example
  13155. 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 -
  13156. @end example
  13157. @end itemize
  13158. @anchor{smartblur}
  13159. @section smartblur
  13160. Blur the input video without impacting the outlines.
  13161. It accepts the following options:
  13162. @table @option
  13163. @item luma_radius, lr
  13164. Set the luma radius. The option value must be a float number in
  13165. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13166. used to blur the image (slower if larger). Default value is 1.0.
  13167. @item luma_strength, ls
  13168. Set the luma strength. The option value must be a float number
  13169. in the range [-1.0,1.0] that configures the blurring. A value included
  13170. in [0.0,1.0] will blur the image whereas a value included in
  13171. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13172. @item luma_threshold, lt
  13173. Set the luma threshold used as a coefficient to determine
  13174. whether a pixel should be blurred or not. The option value must be an
  13175. integer in the range [-30,30]. A value of 0 will filter all the image,
  13176. a value included in [0,30] will filter flat areas and a value included
  13177. in [-30,0] will filter edges. Default value is 0.
  13178. @item chroma_radius, cr
  13179. Set the chroma radius. The option value must be a float number in
  13180. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13181. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13182. @item chroma_strength, cs
  13183. Set the chroma strength. The option value must be a float number
  13184. in the range [-1.0,1.0] that configures the blurring. A value included
  13185. in [0.0,1.0] will blur the image whereas a value included in
  13186. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13187. @item chroma_threshold, ct
  13188. Set the chroma threshold used as a coefficient to determine
  13189. whether a pixel should be blurred or not. The option value must be an
  13190. integer in the range [-30,30]. A value of 0 will filter all the image,
  13191. a value included in [0,30] will filter flat areas and a value included
  13192. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13193. @end table
  13194. If a chroma option is not explicitly set, the corresponding luma value
  13195. is set.
  13196. @section sobel
  13197. Apply sobel operator to input video stream.
  13198. The filter accepts the following option:
  13199. @table @option
  13200. @item planes
  13201. Set which planes will be processed, unprocessed planes will be copied.
  13202. By default value 0xf, all planes will be processed.
  13203. @item scale
  13204. Set value which will be multiplied with filtered result.
  13205. @item delta
  13206. Set value which will be added to filtered result.
  13207. @end table
  13208. @anchor{spp}
  13209. @section spp
  13210. Apply a simple postprocessing filter that compresses and decompresses the image
  13211. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13212. and average the results.
  13213. The filter accepts the following options:
  13214. @table @option
  13215. @item quality
  13216. Set quality. This option defines the number of levels for averaging. It accepts
  13217. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13218. effect. A value of @code{6} means the higher quality. For each increment of
  13219. that value the speed drops by a factor of approximately 2. Default value is
  13220. @code{3}.
  13221. @item qp
  13222. Force a constant quantization parameter. If not set, the filter will use the QP
  13223. from the video stream (if available).
  13224. @item mode
  13225. Set thresholding mode. Available modes are:
  13226. @table @samp
  13227. @item hard
  13228. Set hard thresholding (default).
  13229. @item soft
  13230. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13231. @end table
  13232. @item use_bframe_qp
  13233. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13234. option may cause flicker since the B-Frames have often larger QP. Default is
  13235. @code{0} (not enabled).
  13236. @end table
  13237. @subsection Commands
  13238. This filter supports the following commands:
  13239. @table @option
  13240. @item quality, level
  13241. Set quality level. The value @code{max} can be used to set the maximum level,
  13242. currently @code{6}.
  13243. @end table
  13244. @anchor{sr}
  13245. @section sr
  13246. Scale the input by applying one of the super-resolution methods based on
  13247. convolutional neural networks. Supported models:
  13248. @itemize
  13249. @item
  13250. Super-Resolution Convolutional Neural Network model (SRCNN).
  13251. See @url{https://arxiv.org/abs/1501.00092}.
  13252. @item
  13253. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13254. See @url{https://arxiv.org/abs/1609.05158}.
  13255. @end itemize
  13256. Training scripts as well as scripts for model file (.pb) saving can be found at
  13257. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13258. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13259. Native model files (.model) can be generated from TensorFlow model
  13260. files (.pb) by using tools/python/convert.py
  13261. The filter accepts the following options:
  13262. @table @option
  13263. @item dnn_backend
  13264. Specify which DNN backend to use for model loading and execution. This option accepts
  13265. the following values:
  13266. @table @samp
  13267. @item native
  13268. Native implementation of DNN loading and execution.
  13269. @item tensorflow
  13270. TensorFlow backend. To enable this backend you
  13271. need to install the TensorFlow for C library (see
  13272. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13273. @code{--enable-libtensorflow}
  13274. @end table
  13275. Default value is @samp{native}.
  13276. @item model
  13277. Set path to model file specifying network architecture and its parameters.
  13278. Note that different backends use different file formats. TensorFlow backend
  13279. can load files for both formats, while native backend can load files for only
  13280. its format.
  13281. @item scale_factor
  13282. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13283. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13284. input upscaled using bicubic upscaling with proper scale factor.
  13285. @end table
  13286. This feature can also be finished with @ref{dnn_processing} filter.
  13287. @section ssim
  13288. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13289. This filter takes in input two input videos, the first input is
  13290. considered the "main" source and is passed unchanged to the
  13291. output. The second input is used as a "reference" video for computing
  13292. the SSIM.
  13293. Both video inputs must have the same resolution and pixel format for
  13294. this filter to work correctly. Also it assumes that both inputs
  13295. have the same number of frames, which are compared one by one.
  13296. The filter stores the calculated SSIM of each frame.
  13297. The description of the accepted parameters follows.
  13298. @table @option
  13299. @item stats_file, f
  13300. If specified the filter will use the named file to save the SSIM of
  13301. each individual frame. When filename equals "-" the data is sent to
  13302. standard output.
  13303. @end table
  13304. The file printed if @var{stats_file} is selected, contains a sequence of
  13305. key/value pairs of the form @var{key}:@var{value} for each compared
  13306. couple of frames.
  13307. A description of each shown parameter follows:
  13308. @table @option
  13309. @item n
  13310. sequential number of the input frame, starting from 1
  13311. @item Y, U, V, R, G, B
  13312. SSIM of the compared frames for the component specified by the suffix.
  13313. @item All
  13314. SSIM of the compared frames for the whole frame.
  13315. @item dB
  13316. Same as above but in dB representation.
  13317. @end table
  13318. This filter also supports the @ref{framesync} options.
  13319. @subsection Examples
  13320. @itemize
  13321. @item
  13322. For example:
  13323. @example
  13324. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13325. [main][ref] ssim="stats_file=stats.log" [out]
  13326. @end example
  13327. On this example the input file being processed is compared with the
  13328. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13329. is stored in @file{stats.log}.
  13330. @item
  13331. Another example with both psnr and ssim at same time:
  13332. @example
  13333. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13334. @end example
  13335. @item
  13336. Another example with different containers:
  13337. @example
  13338. 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 -
  13339. @end example
  13340. @end itemize
  13341. @section stereo3d
  13342. Convert between different stereoscopic image formats.
  13343. The filters accept the following options:
  13344. @table @option
  13345. @item in
  13346. Set stereoscopic image format of input.
  13347. Available values for input image formats are:
  13348. @table @samp
  13349. @item sbsl
  13350. side by side parallel (left eye left, right eye right)
  13351. @item sbsr
  13352. side by side crosseye (right eye left, left eye right)
  13353. @item sbs2l
  13354. side by side parallel with half width resolution
  13355. (left eye left, right eye right)
  13356. @item sbs2r
  13357. side by side crosseye with half width resolution
  13358. (right eye left, left eye right)
  13359. @item abl
  13360. @item tbl
  13361. above-below (left eye above, right eye below)
  13362. @item abr
  13363. @item tbr
  13364. above-below (right eye above, left eye below)
  13365. @item ab2l
  13366. @item tb2l
  13367. above-below with half height resolution
  13368. (left eye above, right eye below)
  13369. @item ab2r
  13370. @item tb2r
  13371. above-below with half height resolution
  13372. (right eye above, left eye below)
  13373. @item al
  13374. alternating frames (left eye first, right eye second)
  13375. @item ar
  13376. alternating frames (right eye first, left eye second)
  13377. @item irl
  13378. interleaved rows (left eye has top row, right eye starts on next row)
  13379. @item irr
  13380. interleaved rows (right eye has top row, left eye starts on next row)
  13381. @item icl
  13382. interleaved columns, left eye first
  13383. @item icr
  13384. interleaved columns, right eye first
  13385. Default value is @samp{sbsl}.
  13386. @end table
  13387. @item out
  13388. Set stereoscopic image format of output.
  13389. @table @samp
  13390. @item sbsl
  13391. side by side parallel (left eye left, right eye right)
  13392. @item sbsr
  13393. side by side crosseye (right eye left, left eye right)
  13394. @item sbs2l
  13395. side by side parallel with half width resolution
  13396. (left eye left, right eye right)
  13397. @item sbs2r
  13398. side by side crosseye with half width resolution
  13399. (right eye left, left eye right)
  13400. @item abl
  13401. @item tbl
  13402. above-below (left eye above, right eye below)
  13403. @item abr
  13404. @item tbr
  13405. above-below (right eye above, left eye below)
  13406. @item ab2l
  13407. @item tb2l
  13408. above-below with half height resolution
  13409. (left eye above, right eye below)
  13410. @item ab2r
  13411. @item tb2r
  13412. above-below with half height resolution
  13413. (right eye above, left eye below)
  13414. @item al
  13415. alternating frames (left eye first, right eye second)
  13416. @item ar
  13417. alternating frames (right eye first, left eye second)
  13418. @item irl
  13419. interleaved rows (left eye has top row, right eye starts on next row)
  13420. @item irr
  13421. interleaved rows (right eye has top row, left eye starts on next row)
  13422. @item arbg
  13423. anaglyph red/blue gray
  13424. (red filter on left eye, blue filter on right eye)
  13425. @item argg
  13426. anaglyph red/green gray
  13427. (red filter on left eye, green filter on right eye)
  13428. @item arcg
  13429. anaglyph red/cyan gray
  13430. (red filter on left eye, cyan filter on right eye)
  13431. @item arch
  13432. anaglyph red/cyan half colored
  13433. (red filter on left eye, cyan filter on right eye)
  13434. @item arcc
  13435. anaglyph red/cyan color
  13436. (red filter on left eye, cyan filter on right eye)
  13437. @item arcd
  13438. anaglyph red/cyan color optimized with the least squares projection of dubois
  13439. (red filter on left eye, cyan filter on right eye)
  13440. @item agmg
  13441. anaglyph green/magenta gray
  13442. (green filter on left eye, magenta filter on right eye)
  13443. @item agmh
  13444. anaglyph green/magenta half colored
  13445. (green filter on left eye, magenta filter on right eye)
  13446. @item agmc
  13447. anaglyph green/magenta colored
  13448. (green filter on left eye, magenta filter on right eye)
  13449. @item agmd
  13450. anaglyph green/magenta color optimized with the least squares projection of dubois
  13451. (green filter on left eye, magenta filter on right eye)
  13452. @item aybg
  13453. anaglyph yellow/blue gray
  13454. (yellow filter on left eye, blue filter on right eye)
  13455. @item aybh
  13456. anaglyph yellow/blue half colored
  13457. (yellow filter on left eye, blue filter on right eye)
  13458. @item aybc
  13459. anaglyph yellow/blue colored
  13460. (yellow filter on left eye, blue filter on right eye)
  13461. @item aybd
  13462. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13463. (yellow filter on left eye, blue filter on right eye)
  13464. @item ml
  13465. mono output (left eye only)
  13466. @item mr
  13467. mono output (right eye only)
  13468. @item chl
  13469. checkerboard, left eye first
  13470. @item chr
  13471. checkerboard, right eye first
  13472. @item icl
  13473. interleaved columns, left eye first
  13474. @item icr
  13475. interleaved columns, right eye first
  13476. @item hdmi
  13477. HDMI frame pack
  13478. @end table
  13479. Default value is @samp{arcd}.
  13480. @end table
  13481. @subsection Examples
  13482. @itemize
  13483. @item
  13484. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13485. @example
  13486. stereo3d=sbsl:aybd
  13487. @end example
  13488. @item
  13489. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13490. @example
  13491. stereo3d=abl:sbsr
  13492. @end example
  13493. @end itemize
  13494. @section streamselect, astreamselect
  13495. Select video or audio streams.
  13496. The filter accepts the following options:
  13497. @table @option
  13498. @item inputs
  13499. Set number of inputs. Default is 2.
  13500. @item map
  13501. Set input indexes to remap to outputs.
  13502. @end table
  13503. @subsection Commands
  13504. The @code{streamselect} and @code{astreamselect} filter supports the following
  13505. commands:
  13506. @table @option
  13507. @item map
  13508. Set input indexes to remap to outputs.
  13509. @end table
  13510. @subsection Examples
  13511. @itemize
  13512. @item
  13513. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13514. @example
  13515. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13516. @end example
  13517. @item
  13518. Same as above, but for audio:
  13519. @example
  13520. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13521. @end example
  13522. @end itemize
  13523. @anchor{subtitles}
  13524. @section subtitles
  13525. Draw subtitles on top of input video using the libass library.
  13526. To enable compilation of this filter you need to configure FFmpeg with
  13527. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13528. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13529. Alpha) subtitles format.
  13530. The filter accepts the following options:
  13531. @table @option
  13532. @item filename, f
  13533. Set the filename of the subtitle file to read. It must be specified.
  13534. @item original_size
  13535. Specify the size of the original video, the video for which the ASS file
  13536. was composed. For the syntax of this option, check the
  13537. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13538. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13539. correctly scale the fonts if the aspect ratio has been changed.
  13540. @item fontsdir
  13541. Set a directory path containing fonts that can be used by the filter.
  13542. These fonts will be used in addition to whatever the font provider uses.
  13543. @item alpha
  13544. Process alpha channel, by default alpha channel is untouched.
  13545. @item charenc
  13546. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13547. useful if not UTF-8.
  13548. @item stream_index, si
  13549. Set subtitles stream index. @code{subtitles} filter only.
  13550. @item force_style
  13551. Override default style or script info parameters of the subtitles. It accepts a
  13552. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13553. @end table
  13554. If the first key is not specified, it is assumed that the first value
  13555. specifies the @option{filename}.
  13556. For example, to render the file @file{sub.srt} on top of the input
  13557. video, use the command:
  13558. @example
  13559. subtitles=sub.srt
  13560. @end example
  13561. which is equivalent to:
  13562. @example
  13563. subtitles=filename=sub.srt
  13564. @end example
  13565. To render the default subtitles stream from file @file{video.mkv}, use:
  13566. @example
  13567. subtitles=video.mkv
  13568. @end example
  13569. To render the second subtitles stream from that file, use:
  13570. @example
  13571. subtitles=video.mkv:si=1
  13572. @end example
  13573. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13574. @code{DejaVu Serif}, use:
  13575. @example
  13576. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13577. @end example
  13578. @section super2xsai
  13579. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13580. Interpolate) pixel art scaling algorithm.
  13581. Useful for enlarging pixel art images without reducing sharpness.
  13582. @section swaprect
  13583. Swap two rectangular objects in video.
  13584. This filter accepts the following options:
  13585. @table @option
  13586. @item w
  13587. Set object width.
  13588. @item h
  13589. Set object height.
  13590. @item x1
  13591. Set 1st rect x coordinate.
  13592. @item y1
  13593. Set 1st rect y coordinate.
  13594. @item x2
  13595. Set 2nd rect x coordinate.
  13596. @item y2
  13597. Set 2nd rect y coordinate.
  13598. All expressions are evaluated once for each frame.
  13599. @end table
  13600. The all options are expressions containing the following constants:
  13601. @table @option
  13602. @item w
  13603. @item h
  13604. The input width and height.
  13605. @item a
  13606. same as @var{w} / @var{h}
  13607. @item sar
  13608. input sample aspect ratio
  13609. @item dar
  13610. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13611. @item n
  13612. The number of the input frame, starting from 0.
  13613. @item t
  13614. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13615. @item pos
  13616. the position in the file of the input frame, NAN if unknown
  13617. @end table
  13618. @section swapuv
  13619. Swap U & V plane.
  13620. @section tblend
  13621. Blend successive video frames.
  13622. See @ref{blend}
  13623. @section telecine
  13624. Apply telecine process to the video.
  13625. This filter accepts the following options:
  13626. @table @option
  13627. @item first_field
  13628. @table @samp
  13629. @item top, t
  13630. top field first
  13631. @item bottom, b
  13632. bottom field first
  13633. The default value is @code{top}.
  13634. @end table
  13635. @item pattern
  13636. A string of numbers representing the pulldown pattern you wish to apply.
  13637. The default value is @code{23}.
  13638. @end table
  13639. @example
  13640. Some typical patterns:
  13641. NTSC output (30i):
  13642. 27.5p: 32222
  13643. 24p: 23 (classic)
  13644. 24p: 2332 (preferred)
  13645. 20p: 33
  13646. 18p: 334
  13647. 16p: 3444
  13648. PAL output (25i):
  13649. 27.5p: 12222
  13650. 24p: 222222222223 ("Euro pulldown")
  13651. 16.67p: 33
  13652. 16p: 33333334
  13653. @end example
  13654. @section thistogram
  13655. Compute and draw a color distribution histogram for the input video across time.
  13656. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13657. at certain time, this filter shows also past histograms of number of frames defined
  13658. by @code{width} option.
  13659. The computed histogram is a representation of the color component
  13660. distribution in an image.
  13661. The filter accepts the following options:
  13662. @table @option
  13663. @item width, w
  13664. Set width of single color component output. Default value is @code{0}.
  13665. Value of @code{0} means width will be picked from input video.
  13666. This also set number of passed histograms to keep.
  13667. Allowed range is [0, 8192].
  13668. @item display_mode, d
  13669. Set display mode.
  13670. It accepts the following values:
  13671. @table @samp
  13672. @item stack
  13673. Per color component graphs are placed below each other.
  13674. @item parade
  13675. Per color component graphs are placed side by side.
  13676. @item overlay
  13677. Presents information identical to that in the @code{parade}, except
  13678. that the graphs representing color components are superimposed directly
  13679. over one another.
  13680. @end table
  13681. Default is @code{stack}.
  13682. @item levels_mode, m
  13683. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  13684. Default is @code{linear}.
  13685. @item components, c
  13686. Set what color components to display.
  13687. Default is @code{7}.
  13688. @item bgopacity, b
  13689. Set background opacity. Default is @code{0.9}.
  13690. @item envelope, e
  13691. Show envelope. Default is disabled.
  13692. @item ecolor, ec
  13693. Set envelope color. Default is @code{gold}.
  13694. @end table
  13695. @section threshold
  13696. Apply threshold effect to video stream.
  13697. This filter needs four video streams to perform thresholding.
  13698. First stream is stream we are filtering.
  13699. Second stream is holding threshold values, third stream is holding min values,
  13700. and last, fourth stream is holding max values.
  13701. The filter accepts the following option:
  13702. @table @option
  13703. @item planes
  13704. Set which planes will be processed, unprocessed planes will be copied.
  13705. By default value 0xf, all planes will be processed.
  13706. @end table
  13707. For example if first stream pixel's component value is less then threshold value
  13708. of pixel component from 2nd threshold stream, third stream value will picked,
  13709. otherwise fourth stream pixel component value will be picked.
  13710. Using color source filter one can perform various types of thresholding:
  13711. @subsection Examples
  13712. @itemize
  13713. @item
  13714. Binary threshold, using gray color as threshold:
  13715. @example
  13716. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13717. @end example
  13718. @item
  13719. Inverted binary threshold, using gray color as threshold:
  13720. @example
  13721. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13722. @end example
  13723. @item
  13724. Truncate binary threshold, using gray color as threshold:
  13725. @example
  13726. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13727. @end example
  13728. @item
  13729. Threshold to zero, using gray color as threshold:
  13730. @example
  13731. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13732. @end example
  13733. @item
  13734. Inverted threshold to zero, using gray color as threshold:
  13735. @example
  13736. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13737. @end example
  13738. @end itemize
  13739. @section thumbnail
  13740. Select the most representative frame in a given sequence of consecutive frames.
  13741. The filter accepts the following options:
  13742. @table @option
  13743. @item n
  13744. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13745. will pick one of them, and then handle the next batch of @var{n} frames until
  13746. the end. Default is @code{100}.
  13747. @end table
  13748. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13749. value will result in a higher memory usage, so a high value is not recommended.
  13750. @subsection Examples
  13751. @itemize
  13752. @item
  13753. Extract one picture each 50 frames:
  13754. @example
  13755. thumbnail=50
  13756. @end example
  13757. @item
  13758. Complete example of a thumbnail creation with @command{ffmpeg}:
  13759. @example
  13760. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13761. @end example
  13762. @end itemize
  13763. @section tile
  13764. Tile several successive frames together.
  13765. The filter accepts the following options:
  13766. @table @option
  13767. @item layout
  13768. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13769. this option, check the
  13770. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13771. @item nb_frames
  13772. Set the maximum number of frames to render in the given area. It must be less
  13773. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13774. the area will be used.
  13775. @item margin
  13776. Set the outer border margin in pixels.
  13777. @item padding
  13778. Set the inner border thickness (i.e. the number of pixels between frames). For
  13779. more advanced padding options (such as having different values for the edges),
  13780. refer to the pad video filter.
  13781. @item color
  13782. Specify the color of the unused area. For the syntax of this option, check the
  13783. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13784. The default value of @var{color} is "black".
  13785. @item overlap
  13786. Set the number of frames to overlap when tiling several successive frames together.
  13787. The value must be between @code{0} and @var{nb_frames - 1}.
  13788. @item init_padding
  13789. Set the number of frames to initially be empty before displaying first output frame.
  13790. This controls how soon will one get first output frame.
  13791. The value must be between @code{0} and @var{nb_frames - 1}.
  13792. @end table
  13793. @subsection Examples
  13794. @itemize
  13795. @item
  13796. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13797. @example
  13798. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13799. @end example
  13800. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13801. duplicating each output frame to accommodate the originally detected frame
  13802. rate.
  13803. @item
  13804. Display @code{5} pictures in an area of @code{3x2} frames,
  13805. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13806. mixed flat and named options:
  13807. @example
  13808. tile=3x2:nb_frames=5:padding=7:margin=2
  13809. @end example
  13810. @end itemize
  13811. @section tinterlace
  13812. Perform various types of temporal field interlacing.
  13813. Frames are counted starting from 1, so the first input frame is
  13814. considered odd.
  13815. The filter accepts the following options:
  13816. @table @option
  13817. @item mode
  13818. Specify the mode of the interlacing. This option can also be specified
  13819. as a value alone. See below for a list of values for this option.
  13820. Available values are:
  13821. @table @samp
  13822. @item merge, 0
  13823. Move odd frames into the upper field, even into the lower field,
  13824. generating a double height frame at half frame rate.
  13825. @example
  13826. ------> time
  13827. Input:
  13828. Frame 1 Frame 2 Frame 3 Frame 4
  13829. 11111 22222 33333 44444
  13830. 11111 22222 33333 44444
  13831. 11111 22222 33333 44444
  13832. 11111 22222 33333 44444
  13833. Output:
  13834. 11111 33333
  13835. 22222 44444
  13836. 11111 33333
  13837. 22222 44444
  13838. 11111 33333
  13839. 22222 44444
  13840. 11111 33333
  13841. 22222 44444
  13842. @end example
  13843. @item drop_even, 1
  13844. Only output odd frames, even frames are dropped, generating a frame with
  13845. unchanged height at half frame rate.
  13846. @example
  13847. ------> time
  13848. Input:
  13849. Frame 1 Frame 2 Frame 3 Frame 4
  13850. 11111 22222 33333 44444
  13851. 11111 22222 33333 44444
  13852. 11111 22222 33333 44444
  13853. 11111 22222 33333 44444
  13854. Output:
  13855. 11111 33333
  13856. 11111 33333
  13857. 11111 33333
  13858. 11111 33333
  13859. @end example
  13860. @item drop_odd, 2
  13861. Only output even frames, odd frames are dropped, generating a frame with
  13862. unchanged height at half frame rate.
  13863. @example
  13864. ------> time
  13865. Input:
  13866. Frame 1 Frame 2 Frame 3 Frame 4
  13867. 11111 22222 33333 44444
  13868. 11111 22222 33333 44444
  13869. 11111 22222 33333 44444
  13870. 11111 22222 33333 44444
  13871. Output:
  13872. 22222 44444
  13873. 22222 44444
  13874. 22222 44444
  13875. 22222 44444
  13876. @end example
  13877. @item pad, 3
  13878. Expand each frame to full height, but pad alternate lines with black,
  13879. generating a frame with double height at the same input frame rate.
  13880. @example
  13881. ------> time
  13882. Input:
  13883. Frame 1 Frame 2 Frame 3 Frame 4
  13884. 11111 22222 33333 44444
  13885. 11111 22222 33333 44444
  13886. 11111 22222 33333 44444
  13887. 11111 22222 33333 44444
  13888. Output:
  13889. 11111 ..... 33333 .....
  13890. ..... 22222 ..... 44444
  13891. 11111 ..... 33333 .....
  13892. ..... 22222 ..... 44444
  13893. 11111 ..... 33333 .....
  13894. ..... 22222 ..... 44444
  13895. 11111 ..... 33333 .....
  13896. ..... 22222 ..... 44444
  13897. @end example
  13898. @item interleave_top, 4
  13899. Interleave the upper field from odd frames with the lower field from
  13900. even frames, generating a frame with unchanged height at half frame rate.
  13901. @example
  13902. ------> time
  13903. Input:
  13904. Frame 1 Frame 2 Frame 3 Frame 4
  13905. 11111<- 22222 33333<- 44444
  13906. 11111 22222<- 33333 44444<-
  13907. 11111<- 22222 33333<- 44444
  13908. 11111 22222<- 33333 44444<-
  13909. Output:
  13910. 11111 33333
  13911. 22222 44444
  13912. 11111 33333
  13913. 22222 44444
  13914. @end example
  13915. @item interleave_bottom, 5
  13916. Interleave the lower field from odd frames with the upper field from
  13917. even frames, generating a frame with unchanged height at half frame rate.
  13918. @example
  13919. ------> time
  13920. Input:
  13921. Frame 1 Frame 2 Frame 3 Frame 4
  13922. 11111 22222<- 33333 44444<-
  13923. 11111<- 22222 33333<- 44444
  13924. 11111 22222<- 33333 44444<-
  13925. 11111<- 22222 33333<- 44444
  13926. Output:
  13927. 22222 44444
  13928. 11111 33333
  13929. 22222 44444
  13930. 11111 33333
  13931. @end example
  13932. @item interlacex2, 6
  13933. Double frame rate with unchanged height. Frames are inserted each
  13934. containing the second temporal field from the previous input frame and
  13935. the first temporal field from the next input frame. This mode relies on
  13936. the top_field_first flag. Useful for interlaced video displays with no
  13937. field synchronisation.
  13938. @example
  13939. ------> time
  13940. Input:
  13941. Frame 1 Frame 2 Frame 3 Frame 4
  13942. 11111 22222 33333 44444
  13943. 11111 22222 33333 44444
  13944. 11111 22222 33333 44444
  13945. 11111 22222 33333 44444
  13946. Output:
  13947. 11111 22222 22222 33333 33333 44444 44444
  13948. 11111 11111 22222 22222 33333 33333 44444
  13949. 11111 22222 22222 33333 33333 44444 44444
  13950. 11111 11111 22222 22222 33333 33333 44444
  13951. @end example
  13952. @item mergex2, 7
  13953. Move odd frames into the upper field, even into the lower field,
  13954. generating a double height frame at same frame rate.
  13955. @example
  13956. ------> time
  13957. Input:
  13958. Frame 1 Frame 2 Frame 3 Frame 4
  13959. 11111 22222 33333 44444
  13960. 11111 22222 33333 44444
  13961. 11111 22222 33333 44444
  13962. 11111 22222 33333 44444
  13963. Output:
  13964. 11111 33333 33333 55555
  13965. 22222 22222 44444 44444
  13966. 11111 33333 33333 55555
  13967. 22222 22222 44444 44444
  13968. 11111 33333 33333 55555
  13969. 22222 22222 44444 44444
  13970. 11111 33333 33333 55555
  13971. 22222 22222 44444 44444
  13972. @end example
  13973. @end table
  13974. Numeric values are deprecated but are accepted for backward
  13975. compatibility reasons.
  13976. Default mode is @code{merge}.
  13977. @item flags
  13978. Specify flags influencing the filter process.
  13979. Available value for @var{flags} is:
  13980. @table @option
  13981. @item low_pass_filter, vlpf
  13982. Enable linear vertical low-pass filtering in the filter.
  13983. Vertical low-pass filtering is required when creating an interlaced
  13984. destination from a progressive source which contains high-frequency
  13985. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13986. patterning.
  13987. @item complex_filter, cvlpf
  13988. Enable complex vertical low-pass filtering.
  13989. This will slightly less reduce interlace 'twitter' and Moire
  13990. patterning but better retain detail and subjective sharpness impression.
  13991. @item bypass_il
  13992. Bypass already interlaced frames, only adjust the frame rate.
  13993. @end table
  13994. Vertical low-pass filtering and bypassing already interlaced frames can only be
  13995. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  13996. @end table
  13997. @section tmix
  13998. Mix successive video frames.
  13999. A description of the accepted options follows.
  14000. @table @option
  14001. @item frames
  14002. The number of successive frames to mix. If unspecified, it defaults to 3.
  14003. @item weights
  14004. Specify weight of each input video frame.
  14005. Each weight is separated by space. If number of weights is smaller than
  14006. number of @var{frames} last specified weight will be used for all remaining
  14007. unset weights.
  14008. @item scale
  14009. Specify scale, if it is set it will be multiplied with sum
  14010. of each weight multiplied with pixel values to give final destination
  14011. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14012. @end table
  14013. @subsection Examples
  14014. @itemize
  14015. @item
  14016. Average 7 successive frames:
  14017. @example
  14018. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14019. @end example
  14020. @item
  14021. Apply simple temporal convolution:
  14022. @example
  14023. tmix=frames=3:weights="-1 3 -1"
  14024. @end example
  14025. @item
  14026. Similar as above but only showing temporal differences:
  14027. @example
  14028. tmix=frames=3:weights="-1 2 -1":scale=1
  14029. @end example
  14030. @end itemize
  14031. @anchor{tonemap}
  14032. @section tonemap
  14033. Tone map colors from different dynamic ranges.
  14034. This filter expects data in single precision floating point, as it needs to
  14035. operate on (and can output) out-of-range values. Another filter, such as
  14036. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14037. The tonemapping algorithms implemented only work on linear light, so input
  14038. data should be linearized beforehand (and possibly correctly tagged).
  14039. @example
  14040. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14041. @end example
  14042. @subsection Options
  14043. The filter accepts the following options.
  14044. @table @option
  14045. @item tonemap
  14046. Set the tone map algorithm to use.
  14047. Possible values are:
  14048. @table @var
  14049. @item none
  14050. Do not apply any tone map, only desaturate overbright pixels.
  14051. @item clip
  14052. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14053. in-range values, while distorting out-of-range values.
  14054. @item linear
  14055. Stretch the entire reference gamut to a linear multiple of the display.
  14056. @item gamma
  14057. Fit a logarithmic transfer between the tone curves.
  14058. @item reinhard
  14059. Preserve overall image brightness with a simple curve, using nonlinear
  14060. contrast, which results in flattening details and degrading color accuracy.
  14061. @item hable
  14062. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14063. of slightly darkening everything. Use it when detail preservation is more
  14064. important than color and brightness accuracy.
  14065. @item mobius
  14066. Smoothly map out-of-range values, while retaining contrast and colors for
  14067. in-range material as much as possible. Use it when color accuracy is more
  14068. important than detail preservation.
  14069. @end table
  14070. Default is none.
  14071. @item param
  14072. Tune the tone mapping algorithm.
  14073. This affects the following algorithms:
  14074. @table @var
  14075. @item none
  14076. Ignored.
  14077. @item linear
  14078. Specifies the scale factor to use while stretching.
  14079. Default to 1.0.
  14080. @item gamma
  14081. Specifies the exponent of the function.
  14082. Default to 1.8.
  14083. @item clip
  14084. Specify an extra linear coefficient to multiply into the signal before clipping.
  14085. Default to 1.0.
  14086. @item reinhard
  14087. Specify the local contrast coefficient at the display peak.
  14088. Default to 0.5, which means that in-gamut values will be about half as bright
  14089. as when clipping.
  14090. @item hable
  14091. Ignored.
  14092. @item mobius
  14093. Specify the transition point from linear to mobius transform. Every value
  14094. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14095. more accurate the result will be, at the cost of losing bright details.
  14096. Default to 0.3, which due to the steep initial slope still preserves in-range
  14097. colors fairly accurately.
  14098. @end table
  14099. @item desat
  14100. Apply desaturation for highlights that exceed this level of brightness. The
  14101. higher the parameter, the more color information will be preserved. This
  14102. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14103. (smoothly) turning into white instead. This makes images feel more natural,
  14104. at the cost of reducing information about out-of-range colors.
  14105. The default of 2.0 is somewhat conservative and will mostly just apply to
  14106. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14107. This option works only if the input frame has a supported color tag.
  14108. @item peak
  14109. Override signal/nominal/reference peak with this value. Useful when the
  14110. embedded peak information in display metadata is not reliable or when tone
  14111. mapping from a lower range to a higher range.
  14112. @end table
  14113. @section tpad
  14114. Temporarily pad video frames.
  14115. The filter accepts the following options:
  14116. @table @option
  14117. @item start
  14118. Specify number of delay frames before input video stream. Default is 0.
  14119. @item stop
  14120. Specify number of padding frames after input video stream.
  14121. Set to -1 to pad indefinitely. Default is 0.
  14122. @item start_mode
  14123. Set kind of frames added to beginning of stream.
  14124. Can be either @var{add} or @var{clone}.
  14125. With @var{add} frames of solid-color are added.
  14126. With @var{clone} frames are clones of first frame.
  14127. Default is @var{add}.
  14128. @item stop_mode
  14129. Set kind of frames added to end of stream.
  14130. Can be either @var{add} or @var{clone}.
  14131. With @var{add} frames of solid-color are added.
  14132. With @var{clone} frames are clones of last frame.
  14133. Default is @var{add}.
  14134. @item start_duration, stop_duration
  14135. Specify the duration of the start/stop delay. See
  14136. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14137. for the accepted syntax.
  14138. These options override @var{start} and @var{stop}. Default is 0.
  14139. @item color
  14140. Specify the color of the padded area. For the syntax of this option,
  14141. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14142. manual,ffmpeg-utils}.
  14143. The default value of @var{color} is "black".
  14144. @end table
  14145. @anchor{transpose}
  14146. @section transpose
  14147. Transpose rows with columns in the input video and optionally flip it.
  14148. It accepts the following parameters:
  14149. @table @option
  14150. @item dir
  14151. Specify the transposition direction.
  14152. Can assume the following values:
  14153. @table @samp
  14154. @item 0, 4, cclock_flip
  14155. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14156. @example
  14157. L.R L.l
  14158. . . -> . .
  14159. l.r R.r
  14160. @end example
  14161. @item 1, 5, clock
  14162. Rotate by 90 degrees clockwise, that is:
  14163. @example
  14164. L.R l.L
  14165. . . -> . .
  14166. l.r r.R
  14167. @end example
  14168. @item 2, 6, cclock
  14169. Rotate by 90 degrees counterclockwise, that is:
  14170. @example
  14171. L.R R.r
  14172. . . -> . .
  14173. l.r L.l
  14174. @end example
  14175. @item 3, 7, clock_flip
  14176. Rotate by 90 degrees clockwise and vertically flip, that is:
  14177. @example
  14178. L.R r.R
  14179. . . -> . .
  14180. l.r l.L
  14181. @end example
  14182. @end table
  14183. For values between 4-7, the transposition is only done if the input
  14184. video geometry is portrait and not landscape. These values are
  14185. deprecated, the @code{passthrough} option should be used instead.
  14186. Numerical values are deprecated, and should be dropped in favor of
  14187. symbolic constants.
  14188. @item passthrough
  14189. Do not apply the transposition if the input geometry matches the one
  14190. specified by the specified value. It accepts the following values:
  14191. @table @samp
  14192. @item none
  14193. Always apply transposition.
  14194. @item portrait
  14195. Preserve portrait geometry (when @var{height} >= @var{width}).
  14196. @item landscape
  14197. Preserve landscape geometry (when @var{width} >= @var{height}).
  14198. @end table
  14199. Default value is @code{none}.
  14200. @end table
  14201. For example to rotate by 90 degrees clockwise and preserve portrait
  14202. layout:
  14203. @example
  14204. transpose=dir=1:passthrough=portrait
  14205. @end example
  14206. The command above can also be specified as:
  14207. @example
  14208. transpose=1:portrait
  14209. @end example
  14210. @section transpose_npp
  14211. Transpose rows with columns in the input video and optionally flip it.
  14212. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14213. It accepts the following parameters:
  14214. @table @option
  14215. @item dir
  14216. Specify the transposition direction.
  14217. Can assume the following values:
  14218. @table @samp
  14219. @item cclock_flip
  14220. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14221. @item clock
  14222. Rotate by 90 degrees clockwise.
  14223. @item cclock
  14224. Rotate by 90 degrees counterclockwise.
  14225. @item clock_flip
  14226. Rotate by 90 degrees clockwise and vertically flip.
  14227. @end table
  14228. @item passthrough
  14229. Do not apply the transposition if the input geometry matches the one
  14230. specified by the specified value. It accepts the following values:
  14231. @table @samp
  14232. @item none
  14233. Always apply transposition. (default)
  14234. @item portrait
  14235. Preserve portrait geometry (when @var{height} >= @var{width}).
  14236. @item landscape
  14237. Preserve landscape geometry (when @var{width} >= @var{height}).
  14238. @end table
  14239. @end table
  14240. @section trim
  14241. Trim the input so that the output contains one continuous subpart of the input.
  14242. It accepts the following parameters:
  14243. @table @option
  14244. @item start
  14245. Specify the time of the start of the kept section, i.e. the frame with the
  14246. timestamp @var{start} will be the first frame in the output.
  14247. @item end
  14248. Specify the time of the first frame that will be dropped, i.e. the frame
  14249. immediately preceding the one with the timestamp @var{end} will be the last
  14250. frame in the output.
  14251. @item start_pts
  14252. This is the same as @var{start}, except this option sets the start timestamp
  14253. in timebase units instead of seconds.
  14254. @item end_pts
  14255. This is the same as @var{end}, except this option sets the end timestamp
  14256. in timebase units instead of seconds.
  14257. @item duration
  14258. The maximum duration of the output in seconds.
  14259. @item start_frame
  14260. The number of the first frame that should be passed to the output.
  14261. @item end_frame
  14262. The number of the first frame that should be dropped.
  14263. @end table
  14264. @option{start}, @option{end}, and @option{duration} are expressed as time
  14265. duration specifications; see
  14266. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14267. for the accepted syntax.
  14268. Note that the first two sets of the start/end options and the @option{duration}
  14269. option look at the frame timestamp, while the _frame variants simply count the
  14270. frames that pass through the filter. Also note that this filter does not modify
  14271. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14272. setpts filter after the trim filter.
  14273. If multiple start or end options are set, this filter tries to be greedy and
  14274. keep all the frames that match at least one of the specified constraints. To keep
  14275. only the part that matches all the constraints at once, chain multiple trim
  14276. filters.
  14277. The defaults are such that all the input is kept. So it is possible to set e.g.
  14278. just the end values to keep everything before the specified time.
  14279. Examples:
  14280. @itemize
  14281. @item
  14282. Drop everything except the second minute of input:
  14283. @example
  14284. ffmpeg -i INPUT -vf trim=60:120
  14285. @end example
  14286. @item
  14287. Keep only the first second:
  14288. @example
  14289. ffmpeg -i INPUT -vf trim=duration=1
  14290. @end example
  14291. @end itemize
  14292. @section unpremultiply
  14293. Apply alpha unpremultiply effect to input video stream using first plane
  14294. of second stream as alpha.
  14295. Both streams must have same dimensions and same pixel format.
  14296. The filter accepts the following option:
  14297. @table @option
  14298. @item planes
  14299. Set which planes will be processed, unprocessed planes will be copied.
  14300. By default value 0xf, all planes will be processed.
  14301. If the format has 1 or 2 components, then luma is bit 0.
  14302. If the format has 3 or 4 components:
  14303. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14304. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14305. If present, the alpha channel is always the last bit.
  14306. @item inplace
  14307. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14308. @end table
  14309. @anchor{unsharp}
  14310. @section unsharp
  14311. Sharpen or blur the input video.
  14312. It accepts the following parameters:
  14313. @table @option
  14314. @item luma_msize_x, lx
  14315. Set the luma matrix horizontal size. It must be an odd integer between
  14316. 3 and 23. The default value is 5.
  14317. @item luma_msize_y, ly
  14318. Set the luma matrix vertical size. It must be an odd integer between 3
  14319. and 23. The default value is 5.
  14320. @item luma_amount, la
  14321. Set the luma effect strength. It must be a floating point number, reasonable
  14322. values lay between -1.5 and 1.5.
  14323. Negative values will blur the input video, while positive values will
  14324. sharpen it, a value of zero will disable the effect.
  14325. Default value is 1.0.
  14326. @item chroma_msize_x, cx
  14327. Set the chroma matrix horizontal size. It must be an odd integer
  14328. between 3 and 23. The default value is 5.
  14329. @item chroma_msize_y, cy
  14330. Set the chroma matrix vertical size. It must be an odd integer
  14331. between 3 and 23. The default value is 5.
  14332. @item chroma_amount, ca
  14333. Set the chroma effect strength. It must be a floating point number, reasonable
  14334. values lay between -1.5 and 1.5.
  14335. Negative values will blur the input video, while positive values will
  14336. sharpen it, a value of zero will disable the effect.
  14337. Default value is 0.0.
  14338. @end table
  14339. All parameters are optional and default to the equivalent of the
  14340. string '5:5:1.0:5:5:0.0'.
  14341. @subsection Examples
  14342. @itemize
  14343. @item
  14344. Apply strong luma sharpen effect:
  14345. @example
  14346. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14347. @end example
  14348. @item
  14349. Apply a strong blur of both luma and chroma parameters:
  14350. @example
  14351. unsharp=7:7:-2:7:7:-2
  14352. @end example
  14353. @end itemize
  14354. @section uspp
  14355. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14356. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14357. shifts and average the results.
  14358. The way this differs from the behavior of spp is that uspp actually encodes &
  14359. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14360. DCT similar to MJPEG.
  14361. The filter accepts the following options:
  14362. @table @option
  14363. @item quality
  14364. Set quality. This option defines the number of levels for averaging. It accepts
  14365. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14366. effect. A value of @code{8} means the higher quality. For each increment of
  14367. that value the speed drops by a factor of approximately 2. Default value is
  14368. @code{3}.
  14369. @item qp
  14370. Force a constant quantization parameter. If not set, the filter will use the QP
  14371. from the video stream (if available).
  14372. @end table
  14373. @section v360
  14374. Convert 360 videos between various formats.
  14375. The filter accepts the following options:
  14376. @table @option
  14377. @item input
  14378. @item output
  14379. Set format of the input/output video.
  14380. Available formats:
  14381. @table @samp
  14382. @item e
  14383. @item equirect
  14384. Equirectangular projection.
  14385. @item c3x2
  14386. @item c6x1
  14387. @item c1x6
  14388. Cubemap with 3x2/6x1/1x6 layout.
  14389. Format specific options:
  14390. @table @option
  14391. @item in_pad
  14392. @item out_pad
  14393. Set padding proportion for the input/output cubemap. Values in decimals.
  14394. Example values:
  14395. @table @samp
  14396. @item 0
  14397. No padding.
  14398. @item 0.01
  14399. 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)
  14400. @end table
  14401. Default value is @b{@samp{0}}.
  14402. @item fin_pad
  14403. @item fout_pad
  14404. Set fixed padding for the input/output cubemap. Values in pixels.
  14405. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14406. @item in_forder
  14407. @item out_forder
  14408. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14409. Designation of directions:
  14410. @table @samp
  14411. @item r
  14412. right
  14413. @item l
  14414. left
  14415. @item u
  14416. up
  14417. @item d
  14418. down
  14419. @item f
  14420. forward
  14421. @item b
  14422. back
  14423. @end table
  14424. Default value is @b{@samp{rludfb}}.
  14425. @item in_frot
  14426. @item out_frot
  14427. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14428. Designation of angles:
  14429. @table @samp
  14430. @item 0
  14431. 0 degrees clockwise
  14432. @item 1
  14433. 90 degrees clockwise
  14434. @item 2
  14435. 180 degrees clockwise
  14436. @item 3
  14437. 270 degrees clockwise
  14438. @end table
  14439. Default value is @b{@samp{000000}}.
  14440. @end table
  14441. @item eac
  14442. Equi-Angular Cubemap.
  14443. @item flat
  14444. @item gnomonic
  14445. @item rectilinear
  14446. Regular video.
  14447. Format specific options:
  14448. @table @option
  14449. @item h_fov
  14450. @item v_fov
  14451. @item d_fov
  14452. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14453. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14454. @item ih_fov
  14455. @item iv_fov
  14456. @item id_fov
  14457. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14458. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14459. @end table
  14460. @item dfisheye
  14461. Dual fisheye.
  14462. Format specific options:
  14463. @table @option
  14464. @item in_pad
  14465. @item out_pad
  14466. Set padding proportion. Values in decimals.
  14467. Example values:
  14468. @table @samp
  14469. @item 0
  14470. No padding.
  14471. @item 0.01
  14472. 1% padding.
  14473. @end table
  14474. Default value is @b{@samp{0}}.
  14475. @end table
  14476. @item barrel
  14477. @item fb
  14478. @item barrelsplit
  14479. Facebook's 360 formats.
  14480. @item sg
  14481. Stereographic format.
  14482. Format specific options:
  14483. @table @option
  14484. @item h_fov
  14485. @item v_fov
  14486. @item d_fov
  14487. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14488. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14489. @item ih_fov
  14490. @item iv_fov
  14491. @item id_fov
  14492. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14493. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14494. @end table
  14495. @item mercator
  14496. Mercator format.
  14497. @item ball
  14498. Ball format, gives significant distortion toward the back.
  14499. @item hammer
  14500. Hammer-Aitoff map projection format.
  14501. @item sinusoidal
  14502. Sinusoidal map projection format.
  14503. @item fisheye
  14504. Fisheye projection.
  14505. Format specific options:
  14506. @table @option
  14507. @item h_fov
  14508. @item v_fov
  14509. @item d_fov
  14510. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14511. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14512. @item ih_fov
  14513. @item iv_fov
  14514. @item id_fov
  14515. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14516. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14517. @end table
  14518. @item pannini
  14519. Pannini projection.
  14520. Format specific options:
  14521. @table @option
  14522. @item h_fov
  14523. Set output pannini parameter.
  14524. @item ih_fov
  14525. Set input pannini parameter.
  14526. @end table
  14527. @item cylindrical
  14528. Cylindrical projection.
  14529. Format specific options:
  14530. @table @option
  14531. @item h_fov
  14532. @item v_fov
  14533. @item d_fov
  14534. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14535. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14536. @item ih_fov
  14537. @item iv_fov
  14538. @item id_fov
  14539. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14540. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14541. @end table
  14542. @item perspective
  14543. Perspective projection. @i{(output only)}
  14544. Format specific options:
  14545. @table @option
  14546. @item v_fov
  14547. Set perspective parameter.
  14548. @end table
  14549. @item tetrahedron
  14550. Tetrahedron projection.
  14551. @item tsp
  14552. Truncated square pyramid projection.
  14553. @item he
  14554. @item hequirect
  14555. Half equirectangular projection.
  14556. @end table
  14557. @item interp
  14558. Set interpolation method.@*
  14559. @i{Note: more complex interpolation methods require much more memory to run.}
  14560. Available methods:
  14561. @table @samp
  14562. @item near
  14563. @item nearest
  14564. Nearest neighbour.
  14565. @item line
  14566. @item linear
  14567. Bilinear interpolation.
  14568. @item lagrange9
  14569. Lagrange9 interpolation.
  14570. @item cube
  14571. @item cubic
  14572. Bicubic interpolation.
  14573. @item lanc
  14574. @item lanczos
  14575. Lanczos interpolation.
  14576. @item sp16
  14577. @item spline16
  14578. Spline16 interpolation.
  14579. @item gauss
  14580. @item gaussian
  14581. Gaussian interpolation.
  14582. @end table
  14583. Default value is @b{@samp{line}}.
  14584. @item w
  14585. @item h
  14586. Set the output video resolution.
  14587. Default resolution depends on formats.
  14588. @item in_stereo
  14589. @item out_stereo
  14590. Set the input/output stereo format.
  14591. @table @samp
  14592. @item 2d
  14593. 2D mono
  14594. @item sbs
  14595. Side by side
  14596. @item tb
  14597. Top bottom
  14598. @end table
  14599. Default value is @b{@samp{2d}} for input and output format.
  14600. @item yaw
  14601. @item pitch
  14602. @item roll
  14603. Set rotation for the output video. Values in degrees.
  14604. @item rorder
  14605. Set rotation order for the output video. Choose one item for each position.
  14606. @table @samp
  14607. @item y, Y
  14608. yaw
  14609. @item p, P
  14610. pitch
  14611. @item r, R
  14612. roll
  14613. @end table
  14614. Default value is @b{@samp{ypr}}.
  14615. @item h_flip
  14616. @item v_flip
  14617. @item d_flip
  14618. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14619. @item ih_flip
  14620. @item iv_flip
  14621. Set if input video is flipped horizontally/vertically. Boolean values.
  14622. @item in_trans
  14623. Set if input video is transposed. Boolean value, by default disabled.
  14624. @item out_trans
  14625. Set if output video needs to be transposed. Boolean value, by default disabled.
  14626. @item alpha_mask
  14627. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  14628. @end table
  14629. @subsection Examples
  14630. @itemize
  14631. @item
  14632. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14633. @example
  14634. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14635. @end example
  14636. @item
  14637. Extract back view of Equi-Angular Cubemap:
  14638. @example
  14639. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14640. @end example
  14641. @item
  14642. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14643. @example
  14644. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14645. @end example
  14646. @end itemize
  14647. @subsection Commands
  14648. This filter supports subset of above options as @ref{commands}.
  14649. @section vaguedenoiser
  14650. Apply a wavelet based denoiser.
  14651. It transforms each frame from the video input into the wavelet domain,
  14652. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14653. the obtained coefficients. It does an inverse wavelet transform after.
  14654. Due to wavelet properties, it should give a nice smoothed result, and
  14655. reduced noise, without blurring picture features.
  14656. This filter accepts the following options:
  14657. @table @option
  14658. @item threshold
  14659. The filtering strength. The higher, the more filtered the video will be.
  14660. Hard thresholding can use a higher threshold than soft thresholding
  14661. before the video looks overfiltered. Default value is 2.
  14662. @item method
  14663. The filtering method the filter will use.
  14664. It accepts the following values:
  14665. @table @samp
  14666. @item hard
  14667. All values under the threshold will be zeroed.
  14668. @item soft
  14669. All values under the threshold will be zeroed. All values above will be
  14670. reduced by the threshold.
  14671. @item garrote
  14672. Scales or nullifies coefficients - intermediary between (more) soft and
  14673. (less) hard thresholding.
  14674. @end table
  14675. Default is garrote.
  14676. @item nsteps
  14677. Number of times, the wavelet will decompose the picture. Picture can't
  14678. be decomposed beyond a particular point (typically, 8 for a 640x480
  14679. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14680. @item percent
  14681. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14682. @item planes
  14683. A list of the planes to process. By default all planes are processed.
  14684. @end table
  14685. @section vectorscope
  14686. Display 2 color component values in the two dimensional graph (which is called
  14687. a vectorscope).
  14688. This filter accepts the following options:
  14689. @table @option
  14690. @item mode, m
  14691. Set vectorscope mode.
  14692. It accepts the following values:
  14693. @table @samp
  14694. @item gray
  14695. @item tint
  14696. Gray values are displayed on graph, higher brightness means more pixels have
  14697. same component color value on location in graph. This is the default mode.
  14698. @item color
  14699. Gray values are displayed on graph. Surrounding pixels values which are not
  14700. present in video frame are drawn in gradient of 2 color components which are
  14701. set by option @code{x} and @code{y}. The 3rd color component is static.
  14702. @item color2
  14703. Actual color components values present in video frame are displayed on graph.
  14704. @item color3
  14705. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14706. on graph increases value of another color component, which is luminance by
  14707. default values of @code{x} and @code{y}.
  14708. @item color4
  14709. Actual colors present in video frame are displayed on graph. If two different
  14710. colors map to same position on graph then color with higher value of component
  14711. not present in graph is picked.
  14712. @item color5
  14713. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14714. component picked from radial gradient.
  14715. @end table
  14716. @item x
  14717. Set which color component will be represented on X-axis. Default is @code{1}.
  14718. @item y
  14719. Set which color component will be represented on Y-axis. Default is @code{2}.
  14720. @item intensity, i
  14721. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14722. of color component which represents frequency of (X, Y) location in graph.
  14723. @item envelope, e
  14724. @table @samp
  14725. @item none
  14726. No envelope, this is default.
  14727. @item instant
  14728. Instant envelope, even darkest single pixel will be clearly highlighted.
  14729. @item peak
  14730. Hold maximum and minimum values presented in graph over time. This way you
  14731. can still spot out of range values without constantly looking at vectorscope.
  14732. @item peak+instant
  14733. Peak and instant envelope combined together.
  14734. @end table
  14735. @item graticule, g
  14736. Set what kind of graticule to draw.
  14737. @table @samp
  14738. @item none
  14739. @item green
  14740. @item color
  14741. @item invert
  14742. @end table
  14743. @item opacity, o
  14744. Set graticule opacity.
  14745. @item flags, f
  14746. Set graticule flags.
  14747. @table @samp
  14748. @item white
  14749. Draw graticule for white point.
  14750. @item black
  14751. Draw graticule for black point.
  14752. @item name
  14753. Draw color points short names.
  14754. @end table
  14755. @item bgopacity, b
  14756. Set background opacity.
  14757. @item lthreshold, l
  14758. Set low threshold for color component not represented on X or Y axis.
  14759. Values lower than this value will be ignored. Default is 0.
  14760. Note this value is multiplied with actual max possible value one pixel component
  14761. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14762. is 0.1 * 255 = 25.
  14763. @item hthreshold, h
  14764. Set high threshold for color component not represented on X or Y axis.
  14765. Values higher than this value will be ignored. Default is 1.
  14766. Note this value is multiplied with actual max possible value one pixel component
  14767. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14768. is 0.9 * 255 = 230.
  14769. @item colorspace, c
  14770. Set what kind of colorspace to use when drawing graticule.
  14771. @table @samp
  14772. @item auto
  14773. @item 601
  14774. @item 709
  14775. @end table
  14776. Default is auto.
  14777. @item tint0, t0
  14778. @item tint1, t1
  14779. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  14780. This means no tint, and output will remain gray.
  14781. @end table
  14782. @anchor{vidstabdetect}
  14783. @section vidstabdetect
  14784. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14785. @ref{vidstabtransform} for pass 2.
  14786. This filter generates a file with relative translation and rotation
  14787. transform information about subsequent frames, which is then used by
  14788. the @ref{vidstabtransform} filter.
  14789. To enable compilation of this filter you need to configure FFmpeg with
  14790. @code{--enable-libvidstab}.
  14791. This filter accepts the following options:
  14792. @table @option
  14793. @item result
  14794. Set the path to the file used to write the transforms information.
  14795. Default value is @file{transforms.trf}.
  14796. @item shakiness
  14797. Set how shaky the video is and how quick the camera is. It accepts an
  14798. integer in the range 1-10, a value of 1 means little shakiness, a
  14799. value of 10 means strong shakiness. Default value is 5.
  14800. @item accuracy
  14801. Set the accuracy of the detection process. It must be a value in the
  14802. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14803. accuracy. Default value is 15.
  14804. @item stepsize
  14805. Set stepsize of the search process. The region around minimum is
  14806. scanned with 1 pixel resolution. Default value is 6.
  14807. @item mincontrast
  14808. Set minimum contrast. Below this value a local measurement field is
  14809. discarded. Must be a floating point value in the range 0-1. Default
  14810. value is 0.3.
  14811. @item tripod
  14812. Set reference frame number for tripod mode.
  14813. If enabled, the motion of the frames is compared to a reference frame
  14814. in the filtered stream, identified by the specified number. The idea
  14815. is to compensate all movements in a more-or-less static scene and keep
  14816. the camera view absolutely still.
  14817. If set to 0, it is disabled. The frames are counted starting from 1.
  14818. @item show
  14819. Show fields and transforms in the resulting frames. It accepts an
  14820. integer in the range 0-2. Default value is 0, which disables any
  14821. visualization.
  14822. @end table
  14823. @subsection Examples
  14824. @itemize
  14825. @item
  14826. Use default values:
  14827. @example
  14828. vidstabdetect
  14829. @end example
  14830. @item
  14831. Analyze strongly shaky movie and put the results in file
  14832. @file{mytransforms.trf}:
  14833. @example
  14834. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14835. @end example
  14836. @item
  14837. Visualize the result of internal transformations in the resulting
  14838. video:
  14839. @example
  14840. vidstabdetect=show=1
  14841. @end example
  14842. @item
  14843. Analyze a video with medium shakiness using @command{ffmpeg}:
  14844. @example
  14845. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14846. @end example
  14847. @end itemize
  14848. @anchor{vidstabtransform}
  14849. @section vidstabtransform
  14850. Video stabilization/deshaking: pass 2 of 2,
  14851. see @ref{vidstabdetect} for pass 1.
  14852. Read a file with transform information for each frame and
  14853. apply/compensate them. Together with the @ref{vidstabdetect}
  14854. filter this can be used to deshake videos. See also
  14855. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14856. the @ref{unsharp} filter, see below.
  14857. To enable compilation of this filter you need to configure FFmpeg with
  14858. @code{--enable-libvidstab}.
  14859. @subsection Options
  14860. @table @option
  14861. @item input
  14862. Set path to the file used to read the transforms. Default value is
  14863. @file{transforms.trf}.
  14864. @item smoothing
  14865. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14866. camera movements. Default value is 10.
  14867. For example a number of 10 means that 21 frames are used (10 in the
  14868. past and 10 in the future) to smoothen the motion in the video. A
  14869. larger value leads to a smoother video, but limits the acceleration of
  14870. the camera (pan/tilt movements). 0 is a special case where a static
  14871. camera is simulated.
  14872. @item optalgo
  14873. Set the camera path optimization algorithm.
  14874. Accepted values are:
  14875. @table @samp
  14876. @item gauss
  14877. gaussian kernel low-pass filter on camera motion (default)
  14878. @item avg
  14879. averaging on transformations
  14880. @end table
  14881. @item maxshift
  14882. Set maximal number of pixels to translate frames. Default value is -1,
  14883. meaning no limit.
  14884. @item maxangle
  14885. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14886. value is -1, meaning no limit.
  14887. @item crop
  14888. Specify how to deal with borders that may be visible due to movement
  14889. compensation.
  14890. Available values are:
  14891. @table @samp
  14892. @item keep
  14893. keep image information from previous frame (default)
  14894. @item black
  14895. fill the border black
  14896. @end table
  14897. @item invert
  14898. Invert transforms if set to 1. Default value is 0.
  14899. @item relative
  14900. Consider transforms as relative to previous frame if set to 1,
  14901. absolute if set to 0. Default value is 0.
  14902. @item zoom
  14903. Set percentage to zoom. A positive value will result in a zoom-in
  14904. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14905. zoom).
  14906. @item optzoom
  14907. Set optimal zooming to avoid borders.
  14908. Accepted values are:
  14909. @table @samp
  14910. @item 0
  14911. disabled
  14912. @item 1
  14913. optimal static zoom value is determined (only very strong movements
  14914. will lead to visible borders) (default)
  14915. @item 2
  14916. optimal adaptive zoom value is determined (no borders will be
  14917. visible), see @option{zoomspeed}
  14918. @end table
  14919. Note that the value given at zoom is added to the one calculated here.
  14920. @item zoomspeed
  14921. Set percent to zoom maximally each frame (enabled when
  14922. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14923. 0.25.
  14924. @item interpol
  14925. Specify type of interpolation.
  14926. Available values are:
  14927. @table @samp
  14928. @item no
  14929. no interpolation
  14930. @item linear
  14931. linear only horizontal
  14932. @item bilinear
  14933. linear in both directions (default)
  14934. @item bicubic
  14935. cubic in both directions (slow)
  14936. @end table
  14937. @item tripod
  14938. Enable virtual tripod mode if set to 1, which is equivalent to
  14939. @code{relative=0:smoothing=0}. Default value is 0.
  14940. Use also @code{tripod} option of @ref{vidstabdetect}.
  14941. @item debug
  14942. Increase log verbosity if set to 1. Also the detected global motions
  14943. are written to the temporary file @file{global_motions.trf}. Default
  14944. value is 0.
  14945. @end table
  14946. @subsection Examples
  14947. @itemize
  14948. @item
  14949. Use @command{ffmpeg} for a typical stabilization with default values:
  14950. @example
  14951. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14952. @end example
  14953. Note the use of the @ref{unsharp} filter which is always recommended.
  14954. @item
  14955. Zoom in a bit more and load transform data from a given file:
  14956. @example
  14957. vidstabtransform=zoom=5:input="mytransforms.trf"
  14958. @end example
  14959. @item
  14960. Smoothen the video even more:
  14961. @example
  14962. vidstabtransform=smoothing=30
  14963. @end example
  14964. @end itemize
  14965. @section vflip
  14966. Flip the input video vertically.
  14967. For example, to vertically flip a video with @command{ffmpeg}:
  14968. @example
  14969. ffmpeg -i in.avi -vf "vflip" out.avi
  14970. @end example
  14971. @section vfrdet
  14972. Detect variable frame rate video.
  14973. This filter tries to detect if the input is variable or constant frame rate.
  14974. At end it will output number of frames detected as having variable delta pts,
  14975. and ones with constant delta pts.
  14976. If there was frames with variable delta, than it will also show min, max and
  14977. average delta encountered.
  14978. @section vibrance
  14979. Boost or alter saturation.
  14980. The filter accepts the following options:
  14981. @table @option
  14982. @item intensity
  14983. Set strength of boost if positive value or strength of alter if negative value.
  14984. Default is 0. Allowed range is from -2 to 2.
  14985. @item rbal
  14986. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14987. @item gbal
  14988. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14989. @item bbal
  14990. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14991. @item rlum
  14992. Set the red luma coefficient.
  14993. @item glum
  14994. Set the green luma coefficient.
  14995. @item blum
  14996. Set the blue luma coefficient.
  14997. @item alternate
  14998. If @code{intensity} is negative and this is set to 1, colors will change,
  14999. otherwise colors will be less saturated, more towards gray.
  15000. @end table
  15001. @subsection Commands
  15002. This filter supports the all above options as @ref{commands}.
  15003. @anchor{vignette}
  15004. @section vignette
  15005. Make or reverse a natural vignetting effect.
  15006. The filter accepts the following options:
  15007. @table @option
  15008. @item angle, a
  15009. Set lens angle expression as a number of radians.
  15010. The value is clipped in the @code{[0,PI/2]} range.
  15011. Default value: @code{"PI/5"}
  15012. @item x0
  15013. @item y0
  15014. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15015. by default.
  15016. @item mode
  15017. Set forward/backward mode.
  15018. Available modes are:
  15019. @table @samp
  15020. @item forward
  15021. The larger the distance from the central point, the darker the image becomes.
  15022. @item backward
  15023. The larger the distance from the central point, the brighter the image becomes.
  15024. This can be used to reverse a vignette effect, though there is no automatic
  15025. detection to extract the lens @option{angle} and other settings (yet). It can
  15026. also be used to create a burning effect.
  15027. @end table
  15028. Default value is @samp{forward}.
  15029. @item eval
  15030. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15031. It accepts the following values:
  15032. @table @samp
  15033. @item init
  15034. Evaluate expressions only once during the filter initialization.
  15035. @item frame
  15036. Evaluate expressions for each incoming frame. This is way slower than the
  15037. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15038. allows advanced dynamic expressions.
  15039. @end table
  15040. Default value is @samp{init}.
  15041. @item dither
  15042. Set dithering to reduce the circular banding effects. Default is @code{1}
  15043. (enabled).
  15044. @item aspect
  15045. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15046. Setting this value to the SAR of the input will make a rectangular vignetting
  15047. following the dimensions of the video.
  15048. Default is @code{1/1}.
  15049. @end table
  15050. @subsection Expressions
  15051. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15052. following parameters.
  15053. @table @option
  15054. @item w
  15055. @item h
  15056. input width and height
  15057. @item n
  15058. the number of input frame, starting from 0
  15059. @item pts
  15060. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15061. @var{TB} units, NAN if undefined
  15062. @item r
  15063. frame rate of the input video, NAN if the input frame rate is unknown
  15064. @item t
  15065. the PTS (Presentation TimeStamp) of the filtered video frame,
  15066. expressed in seconds, NAN if undefined
  15067. @item tb
  15068. time base of the input video
  15069. @end table
  15070. @subsection Examples
  15071. @itemize
  15072. @item
  15073. Apply simple strong vignetting effect:
  15074. @example
  15075. vignette=PI/4
  15076. @end example
  15077. @item
  15078. Make a flickering vignetting:
  15079. @example
  15080. vignette='PI/4+random(1)*PI/50':eval=frame
  15081. @end example
  15082. @end itemize
  15083. @section vmafmotion
  15084. Obtain the average VMAF motion score of a video.
  15085. It is one of the component metrics of VMAF.
  15086. The obtained average motion score is printed through the logging system.
  15087. The filter accepts the following options:
  15088. @table @option
  15089. @item stats_file
  15090. If specified, the filter will use the named file to save the motion score of
  15091. each frame with respect to the previous frame.
  15092. When filename equals "-" the data is sent to standard output.
  15093. @end table
  15094. Example:
  15095. @example
  15096. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15097. @end example
  15098. @section vstack
  15099. Stack input videos vertically.
  15100. All streams must be of same pixel format and of same width.
  15101. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15102. to create same output.
  15103. The filter accepts the following options:
  15104. @table @option
  15105. @item inputs
  15106. Set number of input streams. Default is 2.
  15107. @item shortest
  15108. If set to 1, force the output to terminate when the shortest input
  15109. terminates. Default value is 0.
  15110. @end table
  15111. @section w3fdif
  15112. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15113. Deinterlacing Filter").
  15114. Based on the process described by Martin Weston for BBC R&D, and
  15115. implemented based on the de-interlace algorithm written by Jim
  15116. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15117. uses filter coefficients calculated by BBC R&D.
  15118. This filter uses field-dominance information in frame to decide which
  15119. of each pair of fields to place first in the output.
  15120. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15121. There are two sets of filter coefficients, so called "simple"
  15122. and "complex". Which set of filter coefficients is used can
  15123. be set by passing an optional parameter:
  15124. @table @option
  15125. @item filter
  15126. Set the interlacing filter coefficients. Accepts one of the following values:
  15127. @table @samp
  15128. @item simple
  15129. Simple filter coefficient set.
  15130. @item complex
  15131. More-complex filter coefficient set.
  15132. @end table
  15133. Default value is @samp{complex}.
  15134. @item deint
  15135. Specify which frames to deinterlace. Accepts one of the following values:
  15136. @table @samp
  15137. @item all
  15138. Deinterlace all frames,
  15139. @item interlaced
  15140. Only deinterlace frames marked as interlaced.
  15141. @end table
  15142. Default value is @samp{all}.
  15143. @end table
  15144. @section waveform
  15145. Video waveform monitor.
  15146. The waveform monitor plots color component intensity. By default luminance
  15147. only. Each column of the waveform corresponds to a column of pixels in the
  15148. source video.
  15149. It accepts the following options:
  15150. @table @option
  15151. @item mode, m
  15152. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15153. In row mode, the graph on the left side represents color component value 0 and
  15154. the right side represents value = 255. In column mode, the top side represents
  15155. color component value = 0 and bottom side represents value = 255.
  15156. @item intensity, i
  15157. Set intensity. Smaller values are useful to find out how many values of the same
  15158. luminance are distributed across input rows/columns.
  15159. Default value is @code{0.04}. Allowed range is [0, 1].
  15160. @item mirror, r
  15161. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15162. In mirrored mode, higher values will be represented on the left
  15163. side for @code{row} mode and at the top for @code{column} mode. Default is
  15164. @code{1} (mirrored).
  15165. @item display, d
  15166. Set display mode.
  15167. It accepts the following values:
  15168. @table @samp
  15169. @item overlay
  15170. Presents information identical to that in the @code{parade}, except
  15171. that the graphs representing color components are superimposed directly
  15172. over one another.
  15173. This display mode makes it easier to spot relative differences or similarities
  15174. in overlapping areas of the color components that are supposed to be identical,
  15175. such as neutral whites, grays, or blacks.
  15176. @item stack
  15177. Display separate graph for the color components side by side in
  15178. @code{row} mode or one below the other in @code{column} mode.
  15179. @item parade
  15180. Display separate graph for the color components side by side in
  15181. @code{column} mode or one below the other in @code{row} mode.
  15182. Using this display mode makes it easy to spot color casts in the highlights
  15183. and shadows of an image, by comparing the contours of the top and the bottom
  15184. graphs of each waveform. Since whites, grays, and blacks are characterized
  15185. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15186. should display three waveforms of roughly equal width/height. If not, the
  15187. correction is easy to perform by making level adjustments the three waveforms.
  15188. @end table
  15189. Default is @code{stack}.
  15190. @item components, c
  15191. Set which color components to display. Default is 1, which means only luminance
  15192. or red color component if input is in RGB colorspace. If is set for example to
  15193. 7 it will display all 3 (if) available color components.
  15194. @item envelope, e
  15195. @table @samp
  15196. @item none
  15197. No envelope, this is default.
  15198. @item instant
  15199. Instant envelope, minimum and maximum values presented in graph will be easily
  15200. visible even with small @code{step} value.
  15201. @item peak
  15202. Hold minimum and maximum values presented in graph across time. This way you
  15203. can still spot out of range values without constantly looking at waveforms.
  15204. @item peak+instant
  15205. Peak and instant envelope combined together.
  15206. @end table
  15207. @item filter, f
  15208. @table @samp
  15209. @item lowpass
  15210. No filtering, this is default.
  15211. @item flat
  15212. Luma and chroma combined together.
  15213. @item aflat
  15214. Similar as above, but shows difference between blue and red chroma.
  15215. @item xflat
  15216. Similar as above, but use different colors.
  15217. @item yflat
  15218. Similar as above, but again with different colors.
  15219. @item chroma
  15220. Displays only chroma.
  15221. @item color
  15222. Displays actual color value on waveform.
  15223. @item acolor
  15224. Similar as above, but with luma showing frequency of chroma values.
  15225. @end table
  15226. @item graticule, g
  15227. Set which graticule to display.
  15228. @table @samp
  15229. @item none
  15230. Do not display graticule.
  15231. @item green
  15232. Display green graticule showing legal broadcast ranges.
  15233. @item orange
  15234. Display orange graticule showing legal broadcast ranges.
  15235. @item invert
  15236. Display invert graticule showing legal broadcast ranges.
  15237. @end table
  15238. @item opacity, o
  15239. Set graticule opacity.
  15240. @item flags, fl
  15241. Set graticule flags.
  15242. @table @samp
  15243. @item numbers
  15244. Draw numbers above lines. By default enabled.
  15245. @item dots
  15246. Draw dots instead of lines.
  15247. @end table
  15248. @item scale, s
  15249. Set scale used for displaying graticule.
  15250. @table @samp
  15251. @item digital
  15252. @item millivolts
  15253. @item ire
  15254. @end table
  15255. Default is digital.
  15256. @item bgopacity, b
  15257. Set background opacity.
  15258. @item tint0, t0
  15259. @item tint1, t1
  15260. Set tint for output.
  15261. Only used with lowpass filter and when display is not overlay and input
  15262. pixel formats are not RGB.
  15263. @end table
  15264. @section weave, doubleweave
  15265. The @code{weave} takes a field-based video input and join
  15266. each two sequential fields into single frame, producing a new double
  15267. height clip with half the frame rate and half the frame count.
  15268. The @code{doubleweave} works same as @code{weave} but without
  15269. halving frame rate and frame count.
  15270. It accepts the following option:
  15271. @table @option
  15272. @item first_field
  15273. Set first field. Available values are:
  15274. @table @samp
  15275. @item top, t
  15276. Set the frame as top-field-first.
  15277. @item bottom, b
  15278. Set the frame as bottom-field-first.
  15279. @end table
  15280. @end table
  15281. @subsection Examples
  15282. @itemize
  15283. @item
  15284. Interlace video using @ref{select} and @ref{separatefields} filter:
  15285. @example
  15286. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15287. @end example
  15288. @end itemize
  15289. @section xbr
  15290. Apply the xBR high-quality magnification filter which is designed for pixel
  15291. art. It follows a set of edge-detection rules, see
  15292. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15293. It accepts the following option:
  15294. @table @option
  15295. @item n
  15296. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15297. @code{3xBR} and @code{4} for @code{4xBR}.
  15298. Default is @code{3}.
  15299. @end table
  15300. @section xfade
  15301. Apply cross fade from one input video stream to another input video stream.
  15302. The cross fade is applied for specified duration.
  15303. The filter accepts the following options:
  15304. @table @option
  15305. @item transition
  15306. Set one of available transition effects:
  15307. @table @samp
  15308. @item custom
  15309. @item fade
  15310. @item wipeleft
  15311. @item wiperight
  15312. @item wipeup
  15313. @item wipedown
  15314. @item slideleft
  15315. @item slideright
  15316. @item slideup
  15317. @item slidedown
  15318. @item circlecrop
  15319. @item rectcrop
  15320. @item distance
  15321. @item fadeblack
  15322. @item fadewhite
  15323. @item radial
  15324. @item smoothleft
  15325. @item smoothright
  15326. @item smoothup
  15327. @item smoothdown
  15328. @item circleopen
  15329. @item circleclose
  15330. @item vertopen
  15331. @item vertclose
  15332. @item horzopen
  15333. @item horzclose
  15334. @item dissolve
  15335. @item pixelize
  15336. @item diagtl
  15337. @item diagtr
  15338. @item diagbl
  15339. @item diagbr
  15340. @item hlslice
  15341. @item hrslice
  15342. @item vuslice
  15343. @item vdslice
  15344. @end table
  15345. Default transition effect is fade.
  15346. @item duration
  15347. Set cross fade duration in seconds.
  15348. Default duration is 1 second.
  15349. @item offset
  15350. Set cross fade start relative to first input stream in seconds.
  15351. Default offset is 0.
  15352. @item expr
  15353. Set expression for custom transition effect.
  15354. The expressions can use the following variables and functions:
  15355. @table @option
  15356. @item X
  15357. @item Y
  15358. The coordinates of the current sample.
  15359. @item W
  15360. @item H
  15361. The width and height of the image.
  15362. @item P
  15363. Progress of transition effect.
  15364. @item PLANE
  15365. Currently processed plane.
  15366. @item A
  15367. Return value of first input at current location and plane.
  15368. @item B
  15369. Return value of second input at current location and plane.
  15370. @item a0(x, y)
  15371. @item a1(x, y)
  15372. @item a2(x, y)
  15373. @item a3(x, y)
  15374. Return the value of the pixel at location (@var{x},@var{y}) of the
  15375. first/second/third/fourth component of first input.
  15376. @item b0(x, y)
  15377. @item b1(x, y)
  15378. @item b2(x, y)
  15379. @item b3(x, y)
  15380. Return the value of the pixel at location (@var{x},@var{y}) of the
  15381. first/second/third/fourth component of second input.
  15382. @end table
  15383. @end table
  15384. @subsection Examples
  15385. @itemize
  15386. @item
  15387. Cross fade from one input video to another input video, with fade transition and duration of transition
  15388. of 2 seconds starting at offset of 5 seconds:
  15389. @example
  15390. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15391. @end example
  15392. @end itemize
  15393. @section xmedian
  15394. Pick median pixels from several input videos.
  15395. The filter accepts the following options:
  15396. @table @option
  15397. @item inputs
  15398. Set number of inputs.
  15399. Default is 3. Allowed range is from 3 to 255.
  15400. If number of inputs is even number, than result will be mean value between two median values.
  15401. @item planes
  15402. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15403. @item percentile
  15404. Set median percentile. Default value is @code{0.5}.
  15405. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15406. minimum values, and @code{1} maximum values.
  15407. @end table
  15408. @section xstack
  15409. Stack video inputs into custom layout.
  15410. All streams must be of same pixel format.
  15411. The filter accepts the following options:
  15412. @table @option
  15413. @item inputs
  15414. Set number of input streams. Default is 2.
  15415. @item layout
  15416. Specify layout of inputs.
  15417. This option requires the desired layout configuration to be explicitly set by the user.
  15418. This sets position of each video input in output. Each input
  15419. is separated by '|'.
  15420. The first number represents the column, and the second number represents the row.
  15421. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15422. where X is video input from which to take width or height.
  15423. Multiple values can be used when separated by '+'. In such
  15424. case values are summed together.
  15425. Note that if inputs are of different sizes gaps may appear, as not all of
  15426. the output video frame will be filled. Similarly, videos can overlap each
  15427. other if their position doesn't leave enough space for the full frame of
  15428. adjoining videos.
  15429. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15430. a layout must be set by the user.
  15431. @item shortest
  15432. If set to 1, force the output to terminate when the shortest input
  15433. terminates. Default value is 0.
  15434. @item fill
  15435. If set to valid color, all unused pixels will be filled with that color.
  15436. By default fill is set to none, so it is disabled.
  15437. @end table
  15438. @subsection Examples
  15439. @itemize
  15440. @item
  15441. Display 4 inputs into 2x2 grid.
  15442. Layout:
  15443. @example
  15444. input1(0, 0) | input3(w0, 0)
  15445. input2(0, h0) | input4(w0, h0)
  15446. @end example
  15447. @example
  15448. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15449. @end example
  15450. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15451. @item
  15452. Display 4 inputs into 1x4 grid.
  15453. Layout:
  15454. @example
  15455. input1(0, 0)
  15456. input2(0, h0)
  15457. input3(0, h0+h1)
  15458. input4(0, h0+h1+h2)
  15459. @end example
  15460. @example
  15461. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15462. @end example
  15463. Note that if inputs are of different widths, unused space will appear.
  15464. @item
  15465. Display 9 inputs into 3x3 grid.
  15466. Layout:
  15467. @example
  15468. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15469. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15470. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15471. @end example
  15472. @example
  15473. 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
  15474. @end example
  15475. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15476. @item
  15477. Display 16 inputs into 4x4 grid.
  15478. Layout:
  15479. @example
  15480. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15481. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15482. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15483. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15484. @end example
  15485. @example
  15486. 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|
  15487. 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
  15488. @end example
  15489. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15490. @end itemize
  15491. @anchor{yadif}
  15492. @section yadif
  15493. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15494. filter").
  15495. It accepts the following parameters:
  15496. @table @option
  15497. @item mode
  15498. The interlacing mode to adopt. It accepts one of the following values:
  15499. @table @option
  15500. @item 0, send_frame
  15501. Output one frame for each frame.
  15502. @item 1, send_field
  15503. Output one frame for each field.
  15504. @item 2, send_frame_nospatial
  15505. Like @code{send_frame}, but it skips the spatial interlacing check.
  15506. @item 3, send_field_nospatial
  15507. Like @code{send_field}, but it skips the spatial interlacing check.
  15508. @end table
  15509. The default value is @code{send_frame}.
  15510. @item parity
  15511. The picture field parity assumed for the input interlaced video. It accepts one
  15512. of the following values:
  15513. @table @option
  15514. @item 0, tff
  15515. Assume the top field is first.
  15516. @item 1, bff
  15517. Assume the bottom field is first.
  15518. @item -1, auto
  15519. Enable automatic detection of field parity.
  15520. @end table
  15521. The default value is @code{auto}.
  15522. If the interlacing is unknown or the decoder does not export this information,
  15523. top field first will be assumed.
  15524. @item deint
  15525. Specify which frames to deinterlace. Accepts one of the following
  15526. values:
  15527. @table @option
  15528. @item 0, all
  15529. Deinterlace all frames.
  15530. @item 1, interlaced
  15531. Only deinterlace frames marked as interlaced.
  15532. @end table
  15533. The default value is @code{all}.
  15534. @end table
  15535. @section yadif_cuda
  15536. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15537. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15538. and/or nvenc.
  15539. It accepts the following parameters:
  15540. @table @option
  15541. @item mode
  15542. The interlacing mode to adopt. It accepts one of the following values:
  15543. @table @option
  15544. @item 0, send_frame
  15545. Output one frame for each frame.
  15546. @item 1, send_field
  15547. Output one frame for each field.
  15548. @item 2, send_frame_nospatial
  15549. Like @code{send_frame}, but it skips the spatial interlacing check.
  15550. @item 3, send_field_nospatial
  15551. Like @code{send_field}, but it skips the spatial interlacing check.
  15552. @end table
  15553. The default value is @code{send_frame}.
  15554. @item parity
  15555. The picture field parity assumed for the input interlaced video. It accepts one
  15556. of the following values:
  15557. @table @option
  15558. @item 0, tff
  15559. Assume the top field is first.
  15560. @item 1, bff
  15561. Assume the bottom field is first.
  15562. @item -1, auto
  15563. Enable automatic detection of field parity.
  15564. @end table
  15565. The default value is @code{auto}.
  15566. If the interlacing is unknown or the decoder does not export this information,
  15567. top field first will be assumed.
  15568. @item deint
  15569. Specify which frames to deinterlace. Accepts one of the following
  15570. values:
  15571. @table @option
  15572. @item 0, all
  15573. Deinterlace all frames.
  15574. @item 1, interlaced
  15575. Only deinterlace frames marked as interlaced.
  15576. @end table
  15577. The default value is @code{all}.
  15578. @end table
  15579. @section yaepblur
  15580. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15581. The algorithm is described in
  15582. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15583. It accepts the following parameters:
  15584. @table @option
  15585. @item radius, r
  15586. Set the window radius. Default value is 3.
  15587. @item planes, p
  15588. Set which planes to filter. Default is only the first plane.
  15589. @item sigma, s
  15590. Set blur strength. Default value is 128.
  15591. @end table
  15592. @subsection Commands
  15593. This filter supports same @ref{commands} as options.
  15594. @section zoompan
  15595. Apply Zoom & Pan effect.
  15596. This filter accepts the following options:
  15597. @table @option
  15598. @item zoom, z
  15599. Set the zoom expression. Range is 1-10. Default is 1.
  15600. @item x
  15601. @item y
  15602. Set the x and y expression. Default is 0.
  15603. @item d
  15604. Set the duration expression in number of frames.
  15605. This sets for how many number of frames effect will last for
  15606. single input image.
  15607. @item s
  15608. Set the output image size, default is 'hd720'.
  15609. @item fps
  15610. Set the output frame rate, default is '25'.
  15611. @end table
  15612. Each expression can contain the following constants:
  15613. @table @option
  15614. @item in_w, iw
  15615. Input width.
  15616. @item in_h, ih
  15617. Input height.
  15618. @item out_w, ow
  15619. Output width.
  15620. @item out_h, oh
  15621. Output height.
  15622. @item in
  15623. Input frame count.
  15624. @item on
  15625. Output frame count.
  15626. @item x
  15627. @item y
  15628. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15629. for current input frame.
  15630. @item px
  15631. @item py
  15632. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15633. not yet such frame (first input frame).
  15634. @item zoom
  15635. Last calculated zoom from 'z' expression for current input frame.
  15636. @item pzoom
  15637. Last calculated zoom of last output frame of previous input frame.
  15638. @item duration
  15639. Number of output frames for current input frame. Calculated from 'd' expression
  15640. for each input frame.
  15641. @item pduration
  15642. number of output frames created for previous input frame
  15643. @item a
  15644. Rational number: input width / input height
  15645. @item sar
  15646. sample aspect ratio
  15647. @item dar
  15648. display aspect ratio
  15649. @end table
  15650. @subsection Examples
  15651. @itemize
  15652. @item
  15653. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  15654. @example
  15655. 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
  15656. @end example
  15657. @item
  15658. Zoom-in up to 1.5 and pan always at center of picture:
  15659. @example
  15660. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15661. @end example
  15662. @item
  15663. Same as above but without pausing:
  15664. @example
  15665. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15666. @end example
  15667. @end itemize
  15668. @anchor{zscale}
  15669. @section zscale
  15670. Scale (resize) the input video, using the z.lib library:
  15671. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  15672. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  15673. The zscale filter forces the output display aspect ratio to be the same
  15674. as the input, by changing the output sample aspect ratio.
  15675. If the input image format is different from the format requested by
  15676. the next filter, the zscale filter will convert the input to the
  15677. requested format.
  15678. @subsection Options
  15679. The filter accepts the following options.
  15680. @table @option
  15681. @item width, w
  15682. @item height, h
  15683. Set the output video dimension expression. Default value is the input
  15684. dimension.
  15685. If the @var{width} or @var{w} value is 0, the input width is used for
  15686. the output. If the @var{height} or @var{h} value is 0, the input height
  15687. is used for the output.
  15688. If one and only one of the values is -n with n >= 1, the zscale filter
  15689. will use a value that maintains the aspect ratio of the input image,
  15690. calculated from the other specified dimension. After that it will,
  15691. however, make sure that the calculated dimension is divisible by n and
  15692. adjust the value if necessary.
  15693. If both values are -n with n >= 1, the behavior will be identical to
  15694. both values being set to 0 as previously detailed.
  15695. See below for the list of accepted constants for use in the dimension
  15696. expression.
  15697. @item size, s
  15698. Set the video size. For the syntax of this option, check the
  15699. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15700. @item dither, d
  15701. Set the dither type.
  15702. Possible values are:
  15703. @table @var
  15704. @item none
  15705. @item ordered
  15706. @item random
  15707. @item error_diffusion
  15708. @end table
  15709. Default is none.
  15710. @item filter, f
  15711. Set the resize filter type.
  15712. Possible values are:
  15713. @table @var
  15714. @item point
  15715. @item bilinear
  15716. @item bicubic
  15717. @item spline16
  15718. @item spline36
  15719. @item lanczos
  15720. @end table
  15721. Default is bilinear.
  15722. @item range, r
  15723. Set the color range.
  15724. Possible values are:
  15725. @table @var
  15726. @item input
  15727. @item limited
  15728. @item full
  15729. @end table
  15730. Default is same as input.
  15731. @item primaries, p
  15732. Set the color primaries.
  15733. Possible values are:
  15734. @table @var
  15735. @item input
  15736. @item 709
  15737. @item unspecified
  15738. @item 170m
  15739. @item 240m
  15740. @item 2020
  15741. @end table
  15742. Default is same as input.
  15743. @item transfer, t
  15744. Set the transfer characteristics.
  15745. Possible values are:
  15746. @table @var
  15747. @item input
  15748. @item 709
  15749. @item unspecified
  15750. @item 601
  15751. @item linear
  15752. @item 2020_10
  15753. @item 2020_12
  15754. @item smpte2084
  15755. @item iec61966-2-1
  15756. @item arib-std-b67
  15757. @end table
  15758. Default is same as input.
  15759. @item matrix, m
  15760. Set the colorspace matrix.
  15761. Possible value are:
  15762. @table @var
  15763. @item input
  15764. @item 709
  15765. @item unspecified
  15766. @item 470bg
  15767. @item 170m
  15768. @item 2020_ncl
  15769. @item 2020_cl
  15770. @end table
  15771. Default is same as input.
  15772. @item rangein, rin
  15773. Set the input color range.
  15774. Possible values are:
  15775. @table @var
  15776. @item input
  15777. @item limited
  15778. @item full
  15779. @end table
  15780. Default is same as input.
  15781. @item primariesin, pin
  15782. Set the input color primaries.
  15783. Possible values are:
  15784. @table @var
  15785. @item input
  15786. @item 709
  15787. @item unspecified
  15788. @item 170m
  15789. @item 240m
  15790. @item 2020
  15791. @end table
  15792. Default is same as input.
  15793. @item transferin, tin
  15794. Set the input transfer characteristics.
  15795. Possible values are:
  15796. @table @var
  15797. @item input
  15798. @item 709
  15799. @item unspecified
  15800. @item 601
  15801. @item linear
  15802. @item 2020_10
  15803. @item 2020_12
  15804. @end table
  15805. Default is same as input.
  15806. @item matrixin, min
  15807. Set the input colorspace matrix.
  15808. Possible value are:
  15809. @table @var
  15810. @item input
  15811. @item 709
  15812. @item unspecified
  15813. @item 470bg
  15814. @item 170m
  15815. @item 2020_ncl
  15816. @item 2020_cl
  15817. @end table
  15818. @item chromal, c
  15819. Set the output chroma location.
  15820. Possible values are:
  15821. @table @var
  15822. @item input
  15823. @item left
  15824. @item center
  15825. @item topleft
  15826. @item top
  15827. @item bottomleft
  15828. @item bottom
  15829. @end table
  15830. @item chromalin, cin
  15831. Set the input chroma location.
  15832. Possible values are:
  15833. @table @var
  15834. @item input
  15835. @item left
  15836. @item center
  15837. @item topleft
  15838. @item top
  15839. @item bottomleft
  15840. @item bottom
  15841. @end table
  15842. @item npl
  15843. Set the nominal peak luminance.
  15844. @end table
  15845. The values of the @option{w} and @option{h} options are expressions
  15846. containing the following constants:
  15847. @table @var
  15848. @item in_w
  15849. @item in_h
  15850. The input width and height
  15851. @item iw
  15852. @item ih
  15853. These are the same as @var{in_w} and @var{in_h}.
  15854. @item out_w
  15855. @item out_h
  15856. The output (scaled) width and height
  15857. @item ow
  15858. @item oh
  15859. These are the same as @var{out_w} and @var{out_h}
  15860. @item a
  15861. The same as @var{iw} / @var{ih}
  15862. @item sar
  15863. input sample aspect ratio
  15864. @item dar
  15865. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15866. @item hsub
  15867. @item vsub
  15868. horizontal and vertical input chroma subsample values. For example for the
  15869. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15870. @item ohsub
  15871. @item ovsub
  15872. horizontal and vertical output chroma subsample values. For example for the
  15873. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15874. @end table
  15875. @subsection Commands
  15876. This filter supports the following commands:
  15877. @table @option
  15878. @item width, w
  15879. @item height, h
  15880. Set the output video dimension expression.
  15881. The command accepts the same syntax of the corresponding option.
  15882. If the specified expression is not valid, it is kept at its current
  15883. value.
  15884. @end table
  15885. @c man end VIDEO FILTERS
  15886. @chapter OpenCL Video Filters
  15887. @c man begin OPENCL VIDEO FILTERS
  15888. Below is a description of the currently available OpenCL video filters.
  15889. To enable compilation of these filters you need to configure FFmpeg with
  15890. @code{--enable-opencl}.
  15891. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15892. @table @option
  15893. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15894. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15895. given device parameters.
  15896. @item -filter_hw_device @var{name}
  15897. Pass the hardware device called @var{name} to all filters in any filter graph.
  15898. @end table
  15899. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15900. @itemize
  15901. @item
  15902. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15903. @example
  15904. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15905. @end example
  15906. @end itemize
  15907. 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.
  15908. @section avgblur_opencl
  15909. Apply average blur filter.
  15910. The filter accepts the following options:
  15911. @table @option
  15912. @item sizeX
  15913. Set horizontal radius size.
  15914. Range is @code{[1, 1024]} and default value is @code{1}.
  15915. @item planes
  15916. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15917. @item sizeY
  15918. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15919. @end table
  15920. @subsection Example
  15921. @itemize
  15922. @item
  15923. 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.
  15924. @example
  15925. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15926. @end example
  15927. @end itemize
  15928. @section boxblur_opencl
  15929. Apply a boxblur algorithm to the input video.
  15930. It accepts the following parameters:
  15931. @table @option
  15932. @item luma_radius, lr
  15933. @item luma_power, lp
  15934. @item chroma_radius, cr
  15935. @item chroma_power, cp
  15936. @item alpha_radius, ar
  15937. @item alpha_power, ap
  15938. @end table
  15939. A description of the accepted options follows.
  15940. @table @option
  15941. @item luma_radius, lr
  15942. @item chroma_radius, cr
  15943. @item alpha_radius, ar
  15944. Set an expression for the box radius in pixels used for blurring the
  15945. corresponding input plane.
  15946. The radius value must be a non-negative number, and must not be
  15947. greater than the value of the expression @code{min(w,h)/2} for the
  15948. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15949. planes.
  15950. Default value for @option{luma_radius} is "2". If not specified,
  15951. @option{chroma_radius} and @option{alpha_radius} default to the
  15952. corresponding value set for @option{luma_radius}.
  15953. The expressions can contain the following constants:
  15954. @table @option
  15955. @item w
  15956. @item h
  15957. The input width and height in pixels.
  15958. @item cw
  15959. @item ch
  15960. The input chroma image width and height in pixels.
  15961. @item hsub
  15962. @item vsub
  15963. The horizontal and vertical chroma subsample values. For example, for the
  15964. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15965. @end table
  15966. @item luma_power, lp
  15967. @item chroma_power, cp
  15968. @item alpha_power, ap
  15969. Specify how many times the boxblur filter is applied to the
  15970. corresponding plane.
  15971. Default value for @option{luma_power} is 2. If not specified,
  15972. @option{chroma_power} and @option{alpha_power} default to the
  15973. corresponding value set for @option{luma_power}.
  15974. A value of 0 will disable the effect.
  15975. @end table
  15976. @subsection Examples
  15977. 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.
  15978. @itemize
  15979. @item
  15980. Apply a boxblur filter with the luma, chroma, and alpha radius
  15981. 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.
  15982. @example
  15983. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15984. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15985. @end example
  15986. @item
  15987. 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.
  15988. For the luma plane, a 2x2 box radius will be run once.
  15989. For the chroma plane, a 4x4 box radius will be run 5 times.
  15990. For the alpha plane, a 3x3 box radius will be run 7 times.
  15991. @example
  15992. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15993. @end example
  15994. @end itemize
  15995. @section colorkey_opencl
  15996. RGB colorspace color keying.
  15997. The filter accepts the following options:
  15998. @table @option
  15999. @item color
  16000. The color which will be replaced with transparency.
  16001. @item similarity
  16002. Similarity percentage with the key color.
  16003. 0.01 matches only the exact key color, while 1.0 matches everything.
  16004. @item blend
  16005. Blend percentage.
  16006. 0.0 makes pixels either fully transparent, or not transparent at all.
  16007. Higher values result in semi-transparent pixels, with a higher transparency
  16008. the more similar the pixels color is to the key color.
  16009. @end table
  16010. @subsection Examples
  16011. @itemize
  16012. @item
  16013. Make every semi-green pixel in the input transparent with some slight blending:
  16014. @example
  16015. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16016. @end example
  16017. @end itemize
  16018. @section convolution_opencl
  16019. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16020. The filter accepts the following options:
  16021. @table @option
  16022. @item 0m
  16023. @item 1m
  16024. @item 2m
  16025. @item 3m
  16026. Set matrix for each plane.
  16027. Matrix is sequence of 9, 25 or 49 signed numbers.
  16028. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16029. @item 0rdiv
  16030. @item 1rdiv
  16031. @item 2rdiv
  16032. @item 3rdiv
  16033. Set multiplier for calculated value for each plane.
  16034. If unset or 0, it will be sum of all matrix elements.
  16035. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16036. @item 0bias
  16037. @item 1bias
  16038. @item 2bias
  16039. @item 3bias
  16040. Set bias for each plane. This value is added to the result of the multiplication.
  16041. Useful for making the overall image brighter or darker.
  16042. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16043. @end table
  16044. @subsection Examples
  16045. @itemize
  16046. @item
  16047. Apply sharpen:
  16048. @example
  16049. -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
  16050. @end example
  16051. @item
  16052. Apply blur:
  16053. @example
  16054. -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
  16055. @end example
  16056. @item
  16057. Apply edge enhance:
  16058. @example
  16059. -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
  16060. @end example
  16061. @item
  16062. Apply edge detect:
  16063. @example
  16064. -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
  16065. @end example
  16066. @item
  16067. Apply laplacian edge detector which includes diagonals:
  16068. @example
  16069. -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
  16070. @end example
  16071. @item
  16072. Apply emboss:
  16073. @example
  16074. -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
  16075. @end example
  16076. @end itemize
  16077. @section erosion_opencl
  16078. Apply erosion effect to the video.
  16079. This filter replaces the pixel by the local(3x3) minimum.
  16080. It accepts the following options:
  16081. @table @option
  16082. @item threshold0
  16083. @item threshold1
  16084. @item threshold2
  16085. @item threshold3
  16086. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16087. If @code{0}, plane will remain unchanged.
  16088. @item coordinates
  16089. Flag which specifies the pixel to refer to.
  16090. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16091. Flags to local 3x3 coordinates region centered on @code{x}:
  16092. 1 2 3
  16093. 4 x 5
  16094. 6 7 8
  16095. @end table
  16096. @subsection Example
  16097. @itemize
  16098. @item
  16099. 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.
  16100. @example
  16101. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16102. @end example
  16103. @end itemize
  16104. @section deshake_opencl
  16105. Feature-point based video stabilization filter.
  16106. The filter accepts the following options:
  16107. @table @option
  16108. @item tripod
  16109. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16110. @item debug
  16111. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16112. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16113. Viewing point matches in the output video is only supported for RGB input.
  16114. Defaults to @code{0}.
  16115. @item adaptive_crop
  16116. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16117. Defaults to @code{1}.
  16118. @item refine_features
  16119. Whether or not feature points should be refined at a sub-pixel level.
  16120. This can be turned off for a slight performance gain at the cost of precision.
  16121. Defaults to @code{1}.
  16122. @item smooth_strength
  16123. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16124. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16125. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16126. Defaults to @code{0.0}.
  16127. @item smooth_window_multiplier
  16128. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16129. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16130. Acceptable values range from @code{0.1} to @code{10.0}.
  16131. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16132. potentially improving smoothness, but also increase latency and memory usage.
  16133. Defaults to @code{2.0}.
  16134. @end table
  16135. @subsection Examples
  16136. @itemize
  16137. @item
  16138. Stabilize a video with a fixed, medium smoothing strength:
  16139. @example
  16140. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16141. @end example
  16142. @item
  16143. Stabilize a video with debugging (both in console and in rendered video):
  16144. @example
  16145. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16146. @end example
  16147. @end itemize
  16148. @section dilation_opencl
  16149. Apply dilation effect to the video.
  16150. This filter replaces the pixel by the local(3x3) maximum.
  16151. It accepts the following options:
  16152. @table @option
  16153. @item threshold0
  16154. @item threshold1
  16155. @item threshold2
  16156. @item threshold3
  16157. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16158. If @code{0}, plane will remain unchanged.
  16159. @item coordinates
  16160. Flag which specifies the pixel to refer to.
  16161. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16162. Flags to local 3x3 coordinates region centered on @code{x}:
  16163. 1 2 3
  16164. 4 x 5
  16165. 6 7 8
  16166. @end table
  16167. @subsection Example
  16168. @itemize
  16169. @item
  16170. 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.
  16171. @example
  16172. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16173. @end example
  16174. @end itemize
  16175. @section nlmeans_opencl
  16176. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16177. @section overlay_opencl
  16178. Overlay one video on top of another.
  16179. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16180. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16181. The filter accepts the following options:
  16182. @table @option
  16183. @item x
  16184. Set the x coordinate of the overlaid video on the main video.
  16185. Default value is @code{0}.
  16186. @item y
  16187. Set the y coordinate of the overlaid video on the main video.
  16188. Default value is @code{0}.
  16189. @end table
  16190. @subsection Examples
  16191. @itemize
  16192. @item
  16193. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16194. @example
  16195. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16196. @end example
  16197. @item
  16198. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16199. @example
  16200. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16201. @end example
  16202. @end itemize
  16203. @section pad_opencl
  16204. Add paddings to the input image, and place the original input at the
  16205. provided @var{x}, @var{y} coordinates.
  16206. It accepts the following options:
  16207. @table @option
  16208. @item width, w
  16209. @item height, h
  16210. Specify an expression for the size of the output image with the
  16211. paddings added. If the value for @var{width} or @var{height} is 0, the
  16212. corresponding input size is used for the output.
  16213. The @var{width} expression can reference the value set by the
  16214. @var{height} expression, and vice versa.
  16215. The default value of @var{width} and @var{height} is 0.
  16216. @item x
  16217. @item y
  16218. Specify the offsets to place the input image at within the padded area,
  16219. with respect to the top/left border of the output image.
  16220. The @var{x} expression can reference the value set by the @var{y}
  16221. expression, and vice versa.
  16222. The default value of @var{x} and @var{y} is 0.
  16223. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16224. so the input image is centered on the padded area.
  16225. @item color
  16226. Specify the color of the padded area. For the syntax of this option,
  16227. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16228. manual,ffmpeg-utils}.
  16229. @item aspect
  16230. Pad to an aspect instead to a resolution.
  16231. @end table
  16232. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16233. options are expressions containing the following constants:
  16234. @table @option
  16235. @item in_w
  16236. @item in_h
  16237. The input video width and height.
  16238. @item iw
  16239. @item ih
  16240. These are the same as @var{in_w} and @var{in_h}.
  16241. @item out_w
  16242. @item out_h
  16243. The output width and height (the size of the padded area), as
  16244. specified by the @var{width} and @var{height} expressions.
  16245. @item ow
  16246. @item oh
  16247. These are the same as @var{out_w} and @var{out_h}.
  16248. @item x
  16249. @item y
  16250. The x and y offsets as specified by the @var{x} and @var{y}
  16251. expressions, or NAN if not yet specified.
  16252. @item a
  16253. same as @var{iw} / @var{ih}
  16254. @item sar
  16255. input sample aspect ratio
  16256. @item dar
  16257. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16258. @end table
  16259. @section prewitt_opencl
  16260. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16261. The filter accepts the following option:
  16262. @table @option
  16263. @item planes
  16264. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16265. @item scale
  16266. Set value which will be multiplied with filtered result.
  16267. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16268. @item delta
  16269. Set value which will be added to filtered result.
  16270. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16271. @end table
  16272. @subsection Example
  16273. @itemize
  16274. @item
  16275. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16276. @example
  16277. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16278. @end example
  16279. @end itemize
  16280. @anchor{program_opencl}
  16281. @section program_opencl
  16282. Filter video using an OpenCL program.
  16283. @table @option
  16284. @item source
  16285. OpenCL program source file.
  16286. @item kernel
  16287. Kernel name in program.
  16288. @item inputs
  16289. Number of inputs to the filter. Defaults to 1.
  16290. @item size, s
  16291. Size of output frames. Defaults to the same as the first input.
  16292. @end table
  16293. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16294. The program source file must contain a kernel function with the given name,
  16295. which will be run once for each plane of the output. Each run on a plane
  16296. gets enqueued as a separate 2D global NDRange with one work-item for each
  16297. pixel to be generated. The global ID offset for each work-item is therefore
  16298. the coordinates of a pixel in the destination image.
  16299. The kernel function needs to take the following arguments:
  16300. @itemize
  16301. @item
  16302. Destination image, @var{__write_only image2d_t}.
  16303. This image will become the output; the kernel should write all of it.
  16304. @item
  16305. Frame index, @var{unsigned int}.
  16306. This is a counter starting from zero and increasing by one for each frame.
  16307. @item
  16308. Source images, @var{__read_only image2d_t}.
  16309. These are the most recent images on each input. The kernel may read from
  16310. them to generate the output, but they can't be written to.
  16311. @end itemize
  16312. Example programs:
  16313. @itemize
  16314. @item
  16315. Copy the input to the output (output must be the same size as the input).
  16316. @verbatim
  16317. __kernel void copy(__write_only image2d_t destination,
  16318. unsigned int index,
  16319. __read_only image2d_t source)
  16320. {
  16321. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16322. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16323. float4 value = read_imagef(source, sampler, location);
  16324. write_imagef(destination, location, value);
  16325. }
  16326. @end verbatim
  16327. @item
  16328. Apply a simple transformation, rotating the input by an amount increasing
  16329. with the index counter. Pixel values are linearly interpolated by the
  16330. sampler, and the output need not have the same dimensions as the input.
  16331. @verbatim
  16332. __kernel void rotate_image(__write_only image2d_t dst,
  16333. unsigned int index,
  16334. __read_only image2d_t src)
  16335. {
  16336. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16337. CLK_FILTER_LINEAR);
  16338. float angle = (float)index / 100.0f;
  16339. float2 dst_dim = convert_float2(get_image_dim(dst));
  16340. float2 src_dim = convert_float2(get_image_dim(src));
  16341. float2 dst_cen = dst_dim / 2.0f;
  16342. float2 src_cen = src_dim / 2.0f;
  16343. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16344. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16345. float2 src_pos = {
  16346. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16347. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16348. };
  16349. src_pos = src_pos * src_dim / dst_dim;
  16350. float2 src_loc = src_pos + src_cen;
  16351. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16352. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16353. write_imagef(dst, dst_loc, 0.5f);
  16354. else
  16355. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16356. }
  16357. @end verbatim
  16358. @item
  16359. Blend two inputs together, with the amount of each input used varying
  16360. with the index counter.
  16361. @verbatim
  16362. __kernel void blend_images(__write_only image2d_t dst,
  16363. unsigned int index,
  16364. __read_only image2d_t src1,
  16365. __read_only image2d_t src2)
  16366. {
  16367. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16368. CLK_FILTER_LINEAR);
  16369. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16370. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16371. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16372. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16373. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16374. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16375. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16376. }
  16377. @end verbatim
  16378. @end itemize
  16379. @section roberts_opencl
  16380. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16381. The filter accepts the following option:
  16382. @table @option
  16383. @item planes
  16384. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16385. @item scale
  16386. Set value which will be multiplied with filtered result.
  16387. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16388. @item delta
  16389. Set value which will be added to filtered result.
  16390. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16391. @end table
  16392. @subsection Example
  16393. @itemize
  16394. @item
  16395. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16396. @example
  16397. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16398. @end example
  16399. @end itemize
  16400. @section sobel_opencl
  16401. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16402. The filter accepts the following option:
  16403. @table @option
  16404. @item planes
  16405. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16406. @item scale
  16407. Set value which will be multiplied with filtered result.
  16408. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16409. @item delta
  16410. Set value which will be added to filtered result.
  16411. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16412. @end table
  16413. @subsection Example
  16414. @itemize
  16415. @item
  16416. Apply sobel operator with scale set to 2 and delta set to 10
  16417. @example
  16418. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16419. @end example
  16420. @end itemize
  16421. @section tonemap_opencl
  16422. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16423. It accepts the following parameters:
  16424. @table @option
  16425. @item tonemap
  16426. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16427. @item param
  16428. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16429. @item desat
  16430. Apply desaturation for highlights that exceed this level of brightness. The
  16431. higher the parameter, the more color information will be preserved. This
  16432. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16433. (smoothly) turning into white instead. This makes images feel more natural,
  16434. at the cost of reducing information about out-of-range colors.
  16435. The default value is 0.5, and the algorithm here is a little different from
  16436. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16437. @item threshold
  16438. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16439. is used to detect whether the scene has changed or not. If the distance between
  16440. the current frame average brightness and the current running average exceeds
  16441. a threshold value, we would re-calculate scene average and peak brightness.
  16442. The default value is 0.2.
  16443. @item format
  16444. Specify the output pixel format.
  16445. Currently supported formats are:
  16446. @table @var
  16447. @item p010
  16448. @item nv12
  16449. @end table
  16450. @item range, r
  16451. Set the output color range.
  16452. Possible values are:
  16453. @table @var
  16454. @item tv/mpeg
  16455. @item pc/jpeg
  16456. @end table
  16457. Default is same as input.
  16458. @item primaries, p
  16459. Set the output color primaries.
  16460. Possible values are:
  16461. @table @var
  16462. @item bt709
  16463. @item bt2020
  16464. @end table
  16465. Default is same as input.
  16466. @item transfer, t
  16467. Set the output transfer characteristics.
  16468. Possible values are:
  16469. @table @var
  16470. @item bt709
  16471. @item bt2020
  16472. @end table
  16473. Default is bt709.
  16474. @item matrix, m
  16475. Set the output colorspace matrix.
  16476. Possible value are:
  16477. @table @var
  16478. @item bt709
  16479. @item bt2020
  16480. @end table
  16481. Default is same as input.
  16482. @end table
  16483. @subsection Example
  16484. @itemize
  16485. @item
  16486. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16487. @example
  16488. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16489. @end example
  16490. @end itemize
  16491. @section unsharp_opencl
  16492. Sharpen or blur the input video.
  16493. It accepts the following parameters:
  16494. @table @option
  16495. @item luma_msize_x, lx
  16496. Set the luma matrix horizontal size.
  16497. Range is @code{[1, 23]} and default value is @code{5}.
  16498. @item luma_msize_y, ly
  16499. Set the luma matrix vertical size.
  16500. Range is @code{[1, 23]} and default value is @code{5}.
  16501. @item luma_amount, la
  16502. Set the luma effect strength.
  16503. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16504. Negative values will blur the input video, while positive values will
  16505. sharpen it, a value of zero will disable the effect.
  16506. @item chroma_msize_x, cx
  16507. Set the chroma matrix horizontal size.
  16508. Range is @code{[1, 23]} and default value is @code{5}.
  16509. @item chroma_msize_y, cy
  16510. Set the chroma matrix vertical size.
  16511. Range is @code{[1, 23]} and default value is @code{5}.
  16512. @item chroma_amount, ca
  16513. Set the chroma effect strength.
  16514. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16515. Negative values will blur the input video, while positive values will
  16516. sharpen it, a value of zero will disable the effect.
  16517. @end table
  16518. All parameters are optional and default to the equivalent of the
  16519. string '5:5:1.0:5:5:0.0'.
  16520. @subsection Examples
  16521. @itemize
  16522. @item
  16523. Apply strong luma sharpen effect:
  16524. @example
  16525. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16526. @end example
  16527. @item
  16528. Apply a strong blur of both luma and chroma parameters:
  16529. @example
  16530. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16531. @end example
  16532. @end itemize
  16533. @section xfade_opencl
  16534. Cross fade two videos with custom transition effect by using OpenCL.
  16535. It accepts the following options:
  16536. @table @option
  16537. @item transition
  16538. Set one of possible transition effects.
  16539. @table @option
  16540. @item custom
  16541. Select custom transition effect, the actual transition description
  16542. will be picked from source and kernel options.
  16543. @item fade
  16544. @item wipeleft
  16545. @item wiperight
  16546. @item wipeup
  16547. @item wipedown
  16548. @item slideleft
  16549. @item slideright
  16550. @item slideup
  16551. @item slidedown
  16552. Default transition is fade.
  16553. @end table
  16554. @item source
  16555. OpenCL program source file for custom transition.
  16556. @item kernel
  16557. Set name of kernel to use for custom transition from program source file.
  16558. @item duration
  16559. Set duration of video transition.
  16560. @item offset
  16561. Set time of start of transition relative to first video.
  16562. @end table
  16563. The program source file must contain a kernel function with the given name,
  16564. which will be run once for each plane of the output. Each run on a plane
  16565. gets enqueued as a separate 2D global NDRange with one work-item for each
  16566. pixel to be generated. The global ID offset for each work-item is therefore
  16567. the coordinates of a pixel in the destination image.
  16568. The kernel function needs to take the following arguments:
  16569. @itemize
  16570. @item
  16571. Destination image, @var{__write_only image2d_t}.
  16572. This image will become the output; the kernel should write all of it.
  16573. @item
  16574. First Source image, @var{__read_only image2d_t}.
  16575. Second Source image, @var{__read_only image2d_t}.
  16576. These are the most recent images on each input. The kernel may read from
  16577. them to generate the output, but they can't be written to.
  16578. @item
  16579. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  16580. @end itemize
  16581. Example programs:
  16582. @itemize
  16583. @item
  16584. Apply dots curtain transition effect:
  16585. @verbatim
  16586. __kernel void blend_images(__write_only image2d_t dst,
  16587. __read_only image2d_t src1,
  16588. __read_only image2d_t src2,
  16589. float progress)
  16590. {
  16591. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16592. CLK_FILTER_LINEAR);
  16593. int2 p = (int2)(get_global_id(0), get_global_id(1));
  16594. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  16595. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  16596. rp = rp / dim;
  16597. float2 dots = (float2)(20.0, 20.0);
  16598. float2 center = (float2)(0,0);
  16599. float2 unused;
  16600. float4 val1 = read_imagef(src1, sampler, p);
  16601. float4 val2 = read_imagef(src2, sampler, p);
  16602. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  16603. write_imagef(dst, p, next ? val1 : val2);
  16604. }
  16605. @end verbatim
  16606. @end itemize
  16607. @c man end OPENCL VIDEO FILTERS
  16608. @chapter VAAPI Video Filters
  16609. @c man begin VAAPI VIDEO FILTERS
  16610. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  16611. To enable compilation of these filters you need to configure FFmpeg with
  16612. @code{--enable-vaapi}.
  16613. 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}
  16614. @section tonemap_vaapi
  16615. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  16616. It maps the dynamic range of HDR10 content to the SDR content.
  16617. It currently only accepts HDR10 as input.
  16618. It accepts the following parameters:
  16619. @table @option
  16620. @item format
  16621. Specify the output pixel format.
  16622. Currently supported formats are:
  16623. @table @var
  16624. @item p010
  16625. @item nv12
  16626. @end table
  16627. Default is nv12.
  16628. @item primaries, p
  16629. Set the output color primaries.
  16630. Default is same as input.
  16631. @item transfer, t
  16632. Set the output transfer characteristics.
  16633. Default is bt709.
  16634. @item matrix, m
  16635. Set the output colorspace matrix.
  16636. Default is same as input.
  16637. @end table
  16638. @subsection Example
  16639. @itemize
  16640. @item
  16641. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  16642. @example
  16643. tonemap_vaapi=format=p010:t=bt2020-10
  16644. @end example
  16645. @end itemize
  16646. @c man end VAAPI VIDEO FILTERS
  16647. @chapter Video Sources
  16648. @c man begin VIDEO SOURCES
  16649. Below is a description of the currently available video sources.
  16650. @section buffer
  16651. Buffer video frames, and make them available to the filter chain.
  16652. This source is mainly intended for a programmatic use, in particular
  16653. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  16654. It accepts the following parameters:
  16655. @table @option
  16656. @item video_size
  16657. Specify the size (width and height) of the buffered video frames. For the
  16658. syntax of this option, check the
  16659. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16660. @item width
  16661. The input video width.
  16662. @item height
  16663. The input video height.
  16664. @item pix_fmt
  16665. A string representing the pixel format of the buffered video frames.
  16666. It may be a number corresponding to a pixel format, or a pixel format
  16667. name.
  16668. @item time_base
  16669. Specify the timebase assumed by the timestamps of the buffered frames.
  16670. @item frame_rate
  16671. Specify the frame rate expected for the video stream.
  16672. @item pixel_aspect, sar
  16673. The sample (pixel) aspect ratio of the input video.
  16674. @item sws_param
  16675. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  16676. to the filtergraph description to specify swscale flags for automatically
  16677. inserted scalers. See @ref{Filtergraph syntax}.
  16678. @item hw_frames_ctx
  16679. When using a hardware pixel format, this should be a reference to an
  16680. AVHWFramesContext describing input frames.
  16681. @end table
  16682. For example:
  16683. @example
  16684. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  16685. @end example
  16686. will instruct the source to accept video frames with size 320x240 and
  16687. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  16688. square pixels (1:1 sample aspect ratio).
  16689. Since the pixel format with name "yuv410p" corresponds to the number 6
  16690. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  16691. this example corresponds to:
  16692. @example
  16693. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  16694. @end example
  16695. Alternatively, the options can be specified as a flat string, but this
  16696. syntax is deprecated:
  16697. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  16698. @section cellauto
  16699. Create a pattern generated by an elementary cellular automaton.
  16700. The initial state of the cellular automaton can be defined through the
  16701. @option{filename} and @option{pattern} options. If such options are
  16702. not specified an initial state is created randomly.
  16703. At each new frame a new row in the video is filled with the result of
  16704. the cellular automaton next generation. The behavior when the whole
  16705. frame is filled is defined by the @option{scroll} option.
  16706. This source accepts the following options:
  16707. @table @option
  16708. @item filename, f
  16709. Read the initial cellular automaton state, i.e. the starting row, from
  16710. the specified file.
  16711. In the file, each non-whitespace character is considered an alive
  16712. cell, a newline will terminate the row, and further characters in the
  16713. file will be ignored.
  16714. @item pattern, p
  16715. Read the initial cellular automaton state, i.e. the starting row, from
  16716. the specified string.
  16717. Each non-whitespace character in the string is considered an alive
  16718. cell, a newline will terminate the row, and further characters in the
  16719. string will be ignored.
  16720. @item rate, r
  16721. Set the video rate, that is the number of frames generated per second.
  16722. Default is 25.
  16723. @item random_fill_ratio, ratio
  16724. Set the random fill ratio for the initial cellular automaton row. It
  16725. is a floating point number value ranging from 0 to 1, defaults to
  16726. 1/PHI.
  16727. This option is ignored when a file or a pattern is specified.
  16728. @item random_seed, seed
  16729. Set the seed for filling randomly the initial row, must be an integer
  16730. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16731. set to -1, the filter will try to use a good random seed on a best
  16732. effort basis.
  16733. @item rule
  16734. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  16735. Default value is 110.
  16736. @item size, s
  16737. Set the size of the output video. For the syntax of this option, check the
  16738. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16739. If @option{filename} or @option{pattern} is specified, the size is set
  16740. by default to the width of the specified initial state row, and the
  16741. height is set to @var{width} * PHI.
  16742. If @option{size} is set, it must contain the width of the specified
  16743. pattern string, and the specified pattern will be centered in the
  16744. larger row.
  16745. If a filename or a pattern string is not specified, the size value
  16746. defaults to "320x518" (used for a randomly generated initial state).
  16747. @item scroll
  16748. If set to 1, scroll the output upward when all the rows in the output
  16749. have been already filled. If set to 0, the new generated row will be
  16750. written over the top row just after the bottom row is filled.
  16751. Defaults to 1.
  16752. @item start_full, full
  16753. If set to 1, completely fill the output with generated rows before
  16754. outputting the first frame.
  16755. This is the default behavior, for disabling set the value to 0.
  16756. @item stitch
  16757. If set to 1, stitch the left and right row edges together.
  16758. This is the default behavior, for disabling set the value to 0.
  16759. @end table
  16760. @subsection Examples
  16761. @itemize
  16762. @item
  16763. Read the initial state from @file{pattern}, and specify an output of
  16764. size 200x400.
  16765. @example
  16766. cellauto=f=pattern:s=200x400
  16767. @end example
  16768. @item
  16769. Generate a random initial row with a width of 200 cells, with a fill
  16770. ratio of 2/3:
  16771. @example
  16772. cellauto=ratio=2/3:s=200x200
  16773. @end example
  16774. @item
  16775. Create a pattern generated by rule 18 starting by a single alive cell
  16776. centered on an initial row with width 100:
  16777. @example
  16778. cellauto=p=@@:s=100x400:full=0:rule=18
  16779. @end example
  16780. @item
  16781. Specify a more elaborated initial pattern:
  16782. @example
  16783. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  16784. @end example
  16785. @end itemize
  16786. @anchor{coreimagesrc}
  16787. @section coreimagesrc
  16788. Video source generated on GPU using Apple's CoreImage API on OSX.
  16789. This video source is a specialized version of the @ref{coreimage} video filter.
  16790. Use a core image generator at the beginning of the applied filterchain to
  16791. generate the content.
  16792. The coreimagesrc video source accepts the following options:
  16793. @table @option
  16794. @item list_generators
  16795. List all available generators along with all their respective options as well as
  16796. possible minimum and maximum values along with the default values.
  16797. @example
  16798. list_generators=true
  16799. @end example
  16800. @item size, s
  16801. Specify the size of the sourced video. For the syntax of this option, check the
  16802. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16803. The default value is @code{320x240}.
  16804. @item rate, r
  16805. Specify the frame rate of the sourced video, as the number of frames
  16806. generated per second. It has to be a string in the format
  16807. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16808. number or a valid video frame rate abbreviation. The default value is
  16809. "25".
  16810. @item sar
  16811. Set the sample aspect ratio of the sourced video.
  16812. @item duration, d
  16813. Set the duration of the sourced video. See
  16814. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16815. for the accepted syntax.
  16816. If not specified, or the expressed duration is negative, the video is
  16817. supposed to be generated forever.
  16818. @end table
  16819. Additionally, all options of the @ref{coreimage} video filter are accepted.
  16820. A complete filterchain can be used for further processing of the
  16821. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  16822. and examples for details.
  16823. @subsection Examples
  16824. @itemize
  16825. @item
  16826. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  16827. given as complete and escaped command-line for Apple's standard bash shell:
  16828. @example
  16829. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  16830. @end example
  16831. This example is equivalent to the QRCode example of @ref{coreimage} without the
  16832. need for a nullsrc video source.
  16833. @end itemize
  16834. @section mandelbrot
  16835. Generate a Mandelbrot set fractal, and progressively zoom towards the
  16836. point specified with @var{start_x} and @var{start_y}.
  16837. This source accepts the following options:
  16838. @table @option
  16839. @item end_pts
  16840. Set the terminal pts value. Default value is 400.
  16841. @item end_scale
  16842. Set the terminal scale value.
  16843. Must be a floating point value. Default value is 0.3.
  16844. @item inner
  16845. Set the inner coloring mode, that is the algorithm used to draw the
  16846. Mandelbrot fractal internal region.
  16847. It shall assume one of the following values:
  16848. @table @option
  16849. @item black
  16850. Set black mode.
  16851. @item convergence
  16852. Show time until convergence.
  16853. @item mincol
  16854. Set color based on point closest to the origin of the iterations.
  16855. @item period
  16856. Set period mode.
  16857. @end table
  16858. Default value is @var{mincol}.
  16859. @item bailout
  16860. Set the bailout value. Default value is 10.0.
  16861. @item maxiter
  16862. Set the maximum of iterations performed by the rendering
  16863. algorithm. Default value is 7189.
  16864. @item outer
  16865. Set outer coloring mode.
  16866. It shall assume one of following values:
  16867. @table @option
  16868. @item iteration_count
  16869. Set iteration count mode.
  16870. @item normalized_iteration_count
  16871. set normalized iteration count mode.
  16872. @end table
  16873. Default value is @var{normalized_iteration_count}.
  16874. @item rate, r
  16875. Set frame rate, expressed as number of frames per second. Default
  16876. value is "25".
  16877. @item size, s
  16878. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16879. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16880. @item start_scale
  16881. Set the initial scale value. Default value is 3.0.
  16882. @item start_x
  16883. Set the initial x position. Must be a floating point value between
  16884. -100 and 100. Default value is -0.743643887037158704752191506114774.
  16885. @item start_y
  16886. Set the initial y position. Must be a floating point value between
  16887. -100 and 100. Default value is -0.131825904205311970493132056385139.
  16888. @end table
  16889. @section mptestsrc
  16890. Generate various test patterns, as generated by the MPlayer test filter.
  16891. The size of the generated video is fixed, and is 256x256.
  16892. This source is useful in particular for testing encoding features.
  16893. This source accepts the following options:
  16894. @table @option
  16895. @item rate, r
  16896. Specify the frame rate of the sourced video, as the number of frames
  16897. generated per second. It has to be a string in the format
  16898. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16899. number or a valid video frame rate abbreviation. The default value is
  16900. "25".
  16901. @item duration, d
  16902. Set the duration of the sourced video. See
  16903. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16904. for the accepted syntax.
  16905. If not specified, or the expressed duration is negative, the video is
  16906. supposed to be generated forever.
  16907. @item test, t
  16908. Set the number or the name of the test to perform. Supported tests are:
  16909. @table @option
  16910. @item dc_luma
  16911. @item dc_chroma
  16912. @item freq_luma
  16913. @item freq_chroma
  16914. @item amp_luma
  16915. @item amp_chroma
  16916. @item cbp
  16917. @item mv
  16918. @item ring1
  16919. @item ring2
  16920. @item all
  16921. @item max_frames, m
  16922. Set the maximum number of frames generated for each test, default value is 30.
  16923. @end table
  16924. Default value is "all", which will cycle through the list of all tests.
  16925. @end table
  16926. Some examples:
  16927. @example
  16928. mptestsrc=t=dc_luma
  16929. @end example
  16930. will generate a "dc_luma" test pattern.
  16931. @section frei0r_src
  16932. Provide a frei0r source.
  16933. To enable compilation of this filter you need to install the frei0r
  16934. header and configure FFmpeg with @code{--enable-frei0r}.
  16935. This source accepts the following parameters:
  16936. @table @option
  16937. @item size
  16938. The size of the video to generate. For the syntax of this option, check the
  16939. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16940. @item framerate
  16941. The framerate of the generated video. It may be a string of the form
  16942. @var{num}/@var{den} or a frame rate abbreviation.
  16943. @item filter_name
  16944. The name to the frei0r source to load. For more information regarding frei0r and
  16945. how to set the parameters, read the @ref{frei0r} section in the video filters
  16946. documentation.
  16947. @item filter_params
  16948. A '|'-separated list of parameters to pass to the frei0r source.
  16949. @end table
  16950. For example, to generate a frei0r partik0l source with size 200x200
  16951. and frame rate 10 which is overlaid on the overlay filter main input:
  16952. @example
  16953. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  16954. @end example
  16955. @section life
  16956. Generate a life pattern.
  16957. This source is based on a generalization of John Conway's life game.
  16958. The sourced input represents a life grid, each pixel represents a cell
  16959. which can be in one of two possible states, alive or dead. Every cell
  16960. interacts with its eight neighbours, which are the cells that are
  16961. horizontally, vertically, or diagonally adjacent.
  16962. At each interaction the grid evolves according to the adopted rule,
  16963. which specifies the number of neighbor alive cells which will make a
  16964. cell stay alive or born. The @option{rule} option allows one to specify
  16965. the rule to adopt.
  16966. This source accepts the following options:
  16967. @table @option
  16968. @item filename, f
  16969. Set the file from which to read the initial grid state. In the file,
  16970. each non-whitespace character is considered an alive cell, and newline
  16971. is used to delimit the end of each row.
  16972. If this option is not specified, the initial grid is generated
  16973. randomly.
  16974. @item rate, r
  16975. Set the video rate, that is the number of frames generated per second.
  16976. Default is 25.
  16977. @item random_fill_ratio, ratio
  16978. Set the random fill ratio for the initial random grid. It is a
  16979. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  16980. It is ignored when a file is specified.
  16981. @item random_seed, seed
  16982. Set the seed for filling the initial random grid, must be an integer
  16983. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16984. set to -1, the filter will try to use a good random seed on a best
  16985. effort basis.
  16986. @item rule
  16987. Set the life rule.
  16988. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  16989. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  16990. @var{NS} specifies the number of alive neighbor cells which make a
  16991. live cell stay alive, and @var{NB} the number of alive neighbor cells
  16992. which make a dead cell to become alive (i.e. to "born").
  16993. "s" and "b" can be used in place of "S" and "B", respectively.
  16994. Alternatively a rule can be specified by an 18-bits integer. The 9
  16995. high order bits are used to encode the next cell state if it is alive
  16996. for each number of neighbor alive cells, the low order bits specify
  16997. the rule for "borning" new cells. Higher order bits encode for an
  16998. higher number of neighbor cells.
  16999. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17000. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17001. Default value is "S23/B3", which is the original Conway's game of life
  17002. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17003. cells, and will born a new cell if there are three alive cells around
  17004. a dead cell.
  17005. @item size, s
  17006. Set the size of the output video. For the syntax of this option, check the
  17007. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17008. If @option{filename} is specified, the size is set by default to the
  17009. same size of the input file. If @option{size} is set, it must contain
  17010. the size specified in the input file, and the initial grid defined in
  17011. that file is centered in the larger resulting area.
  17012. If a filename is not specified, the size value defaults to "320x240"
  17013. (used for a randomly generated initial grid).
  17014. @item stitch
  17015. If set to 1, stitch the left and right grid edges together, and the
  17016. top and bottom edges also. Defaults to 1.
  17017. @item mold
  17018. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17019. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17020. value from 0 to 255.
  17021. @item life_color
  17022. Set the color of living (or new born) cells.
  17023. @item death_color
  17024. Set the color of dead cells. If @option{mold} is set, this is the first color
  17025. used to represent a dead cell.
  17026. @item mold_color
  17027. Set mold color, for definitely dead and moldy cells.
  17028. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17029. ffmpeg-utils manual,ffmpeg-utils}.
  17030. @end table
  17031. @subsection Examples
  17032. @itemize
  17033. @item
  17034. Read a grid from @file{pattern}, and center it on a grid of size
  17035. 300x300 pixels:
  17036. @example
  17037. life=f=pattern:s=300x300
  17038. @end example
  17039. @item
  17040. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17041. @example
  17042. life=ratio=2/3:s=200x200
  17043. @end example
  17044. @item
  17045. Specify a custom rule for evolving a randomly generated grid:
  17046. @example
  17047. life=rule=S14/B34
  17048. @end example
  17049. @item
  17050. Full example with slow death effect (mold) using @command{ffplay}:
  17051. @example
  17052. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17053. @end example
  17054. @end itemize
  17055. @anchor{allrgb}
  17056. @anchor{allyuv}
  17057. @anchor{color}
  17058. @anchor{haldclutsrc}
  17059. @anchor{nullsrc}
  17060. @anchor{pal75bars}
  17061. @anchor{pal100bars}
  17062. @anchor{rgbtestsrc}
  17063. @anchor{smptebars}
  17064. @anchor{smptehdbars}
  17065. @anchor{testsrc}
  17066. @anchor{testsrc2}
  17067. @anchor{yuvtestsrc}
  17068. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17069. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17070. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17071. The @code{color} source provides an uniformly colored input.
  17072. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17073. @ref{haldclut} filter.
  17074. The @code{nullsrc} source returns unprocessed video frames. It is
  17075. mainly useful to be employed in analysis / debugging tools, or as the
  17076. source for filters which ignore the input data.
  17077. The @code{pal75bars} source generates a color bars pattern, based on
  17078. EBU PAL recommendations with 75% color levels.
  17079. The @code{pal100bars} source generates a color bars pattern, based on
  17080. EBU PAL recommendations with 100% color levels.
  17081. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17082. detecting RGB vs BGR issues. You should see a red, green and blue
  17083. stripe from top to bottom.
  17084. The @code{smptebars} source generates a color bars pattern, based on
  17085. the SMPTE Engineering Guideline EG 1-1990.
  17086. The @code{smptehdbars} source generates a color bars pattern, based on
  17087. the SMPTE RP 219-2002.
  17088. The @code{testsrc} source generates a test video pattern, showing a
  17089. color pattern, a scrolling gradient and a timestamp. This is mainly
  17090. intended for testing purposes.
  17091. The @code{testsrc2} source is similar to testsrc, but supports more
  17092. pixel formats instead of just @code{rgb24}. This allows using it as an
  17093. input for other tests without requiring a format conversion.
  17094. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17095. see a y, cb and cr stripe from top to bottom.
  17096. The sources accept the following parameters:
  17097. @table @option
  17098. @item level
  17099. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17100. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17101. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17102. coded on a @code{1/(N*N)} scale.
  17103. @item color, c
  17104. Specify the color of the source, only available in the @code{color}
  17105. source. For the syntax of this option, check the
  17106. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17107. @item size, s
  17108. Specify the size of the sourced video. For the syntax of this option, check the
  17109. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17110. The default value is @code{320x240}.
  17111. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17112. @code{haldclutsrc} filters.
  17113. @item rate, r
  17114. Specify the frame rate of the sourced video, as the number of frames
  17115. generated per second. It has to be a string in the format
  17116. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17117. number or a valid video frame rate abbreviation. The default value is
  17118. "25".
  17119. @item duration, d
  17120. Set the duration of the sourced video. See
  17121. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17122. for the accepted syntax.
  17123. If not specified, or the expressed duration is negative, the video is
  17124. supposed to be generated forever.
  17125. @item sar
  17126. Set the sample aspect ratio of the sourced video.
  17127. @item alpha
  17128. Specify the alpha (opacity) of the background, only available in the
  17129. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17130. 255 (fully opaque, the default).
  17131. @item decimals, n
  17132. Set the number of decimals to show in the timestamp, only available in the
  17133. @code{testsrc} source.
  17134. The displayed timestamp value will correspond to the original
  17135. timestamp value multiplied by the power of 10 of the specified
  17136. value. Default value is 0.
  17137. @end table
  17138. @subsection Examples
  17139. @itemize
  17140. @item
  17141. Generate a video with a duration of 5.3 seconds, with size
  17142. 176x144 and a frame rate of 10 frames per second:
  17143. @example
  17144. testsrc=duration=5.3:size=qcif:rate=10
  17145. @end example
  17146. @item
  17147. The following graph description will generate a red source
  17148. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17149. frames per second:
  17150. @example
  17151. color=c=red@@0.2:s=qcif:r=10
  17152. @end example
  17153. @item
  17154. If the input content is to be ignored, @code{nullsrc} can be used. The
  17155. following command generates noise in the luminance plane by employing
  17156. the @code{geq} filter:
  17157. @example
  17158. nullsrc=s=256x256, geq=random(1)*255:128:128
  17159. @end example
  17160. @end itemize
  17161. @subsection Commands
  17162. The @code{color} source supports the following commands:
  17163. @table @option
  17164. @item c, color
  17165. Set the color of the created image. Accepts the same syntax of the
  17166. corresponding @option{color} option.
  17167. @end table
  17168. @section openclsrc
  17169. Generate video using an OpenCL program.
  17170. @table @option
  17171. @item source
  17172. OpenCL program source file.
  17173. @item kernel
  17174. Kernel name in program.
  17175. @item size, s
  17176. Size of frames to generate. This must be set.
  17177. @item format
  17178. Pixel format to use for the generated frames. This must be set.
  17179. @item rate, r
  17180. Number of frames generated every second. Default value is '25'.
  17181. @end table
  17182. For details of how the program loading works, see the @ref{program_opencl}
  17183. filter.
  17184. Example programs:
  17185. @itemize
  17186. @item
  17187. Generate a colour ramp by setting pixel values from the position of the pixel
  17188. in the output image. (Note that this will work with all pixel formats, but
  17189. the generated output will not be the same.)
  17190. @verbatim
  17191. __kernel void ramp(__write_only image2d_t dst,
  17192. unsigned int index)
  17193. {
  17194. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17195. float4 val;
  17196. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17197. write_imagef(dst, loc, val);
  17198. }
  17199. @end verbatim
  17200. @item
  17201. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17202. @verbatim
  17203. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17204. unsigned int index)
  17205. {
  17206. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17207. float4 value = 0.0f;
  17208. int x = loc.x + index;
  17209. int y = loc.y + index;
  17210. while (x > 0 || y > 0) {
  17211. if (x % 3 == 1 && y % 3 == 1) {
  17212. value = 1.0f;
  17213. break;
  17214. }
  17215. x /= 3;
  17216. y /= 3;
  17217. }
  17218. write_imagef(dst, loc, value);
  17219. }
  17220. @end verbatim
  17221. @end itemize
  17222. @section sierpinski
  17223. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17224. This source accepts the following options:
  17225. @table @option
  17226. @item size, s
  17227. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17228. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17229. @item rate, r
  17230. Set frame rate, expressed as number of frames per second. Default
  17231. value is "25".
  17232. @item seed
  17233. Set seed which is used for random panning.
  17234. @item jump
  17235. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17236. @item type
  17237. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17238. @end table
  17239. @c man end VIDEO SOURCES
  17240. @chapter Video Sinks
  17241. @c man begin VIDEO SINKS
  17242. Below is a description of the currently available video sinks.
  17243. @section buffersink
  17244. Buffer video frames, and make them available to the end of the filter
  17245. graph.
  17246. This sink is mainly intended for programmatic use, in particular
  17247. through the interface defined in @file{libavfilter/buffersink.h}
  17248. or the options system.
  17249. It accepts a pointer to an AVBufferSinkContext structure, which
  17250. defines the incoming buffers' formats, to be passed as the opaque
  17251. parameter to @code{avfilter_init_filter} for initialization.
  17252. @section nullsink
  17253. Null video sink: do absolutely nothing with the input video. It is
  17254. mainly useful as a template and for use in analysis / debugging
  17255. tools.
  17256. @c man end VIDEO SINKS
  17257. @chapter Multimedia Filters
  17258. @c man begin MULTIMEDIA FILTERS
  17259. Below is a description of the currently available multimedia filters.
  17260. @section abitscope
  17261. Convert input audio to a video output, displaying the audio bit scope.
  17262. The filter accepts the following options:
  17263. @table @option
  17264. @item rate, r
  17265. Set frame rate, expressed as number of frames per second. Default
  17266. value is "25".
  17267. @item size, s
  17268. Specify the video size for the output. For the syntax of this option, check the
  17269. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17270. Default value is @code{1024x256}.
  17271. @item colors
  17272. Specify list of colors separated by space or by '|' which will be used to
  17273. draw channels. Unrecognized or missing colors will be replaced
  17274. by white color.
  17275. @end table
  17276. @section adrawgraph
  17277. Draw a graph using input audio metadata.
  17278. See @ref{drawgraph}
  17279. @section agraphmonitor
  17280. See @ref{graphmonitor}.
  17281. @section ahistogram
  17282. Convert input audio to a video output, displaying the volume histogram.
  17283. The filter accepts the following options:
  17284. @table @option
  17285. @item dmode
  17286. Specify how histogram is calculated.
  17287. It accepts the following values:
  17288. @table @samp
  17289. @item single
  17290. Use single histogram for all channels.
  17291. @item separate
  17292. Use separate histogram for each channel.
  17293. @end table
  17294. Default is @code{single}.
  17295. @item rate, r
  17296. Set frame rate, expressed as number of frames per second. Default
  17297. value is "25".
  17298. @item size, s
  17299. Specify the video size for the output. For the syntax of this option, check the
  17300. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17301. Default value is @code{hd720}.
  17302. @item scale
  17303. Set display scale.
  17304. It accepts the following values:
  17305. @table @samp
  17306. @item log
  17307. logarithmic
  17308. @item sqrt
  17309. square root
  17310. @item cbrt
  17311. cubic root
  17312. @item lin
  17313. linear
  17314. @item rlog
  17315. reverse logarithmic
  17316. @end table
  17317. Default is @code{log}.
  17318. @item ascale
  17319. Set amplitude scale.
  17320. It accepts the following values:
  17321. @table @samp
  17322. @item log
  17323. logarithmic
  17324. @item lin
  17325. linear
  17326. @end table
  17327. Default is @code{log}.
  17328. @item acount
  17329. Set how much frames to accumulate in histogram.
  17330. Default is 1. Setting this to -1 accumulates all frames.
  17331. @item rheight
  17332. Set histogram ratio of window height.
  17333. @item slide
  17334. Set sonogram sliding.
  17335. It accepts the following values:
  17336. @table @samp
  17337. @item replace
  17338. replace old rows with new ones.
  17339. @item scroll
  17340. scroll from top to bottom.
  17341. @end table
  17342. Default is @code{replace}.
  17343. @end table
  17344. @section aphasemeter
  17345. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17346. representing mean phase of current audio frame. A video output can also be produced and is
  17347. enabled by default. The audio is passed through as first output.
  17348. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17349. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17350. and @code{1} means channels are in phase.
  17351. The filter accepts the following options, all related to its video output:
  17352. @table @option
  17353. @item rate, r
  17354. Set the output frame rate. Default value is @code{25}.
  17355. @item size, s
  17356. Set the video size for the output. For the syntax of this option, check the
  17357. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17358. Default value is @code{800x400}.
  17359. @item rc
  17360. @item gc
  17361. @item bc
  17362. Specify the red, green, blue contrast. Default values are @code{2},
  17363. @code{7} and @code{1}.
  17364. Allowed range is @code{[0, 255]}.
  17365. @item mpc
  17366. Set color which will be used for drawing median phase. If color is
  17367. @code{none} which is default, no median phase value will be drawn.
  17368. @item video
  17369. Enable video output. Default is enabled.
  17370. @end table
  17371. @section avectorscope
  17372. Convert input audio to a video output, representing the audio vector
  17373. scope.
  17374. The filter is used to measure the difference between channels of stereo
  17375. audio stream. A monaural signal, consisting of identical left and right
  17376. signal, results in straight vertical line. Any stereo separation is visible
  17377. as a deviation from this line, creating a Lissajous figure.
  17378. If the straight (or deviation from it) but horizontal line appears this
  17379. indicates that the left and right channels are out of phase.
  17380. The filter accepts the following options:
  17381. @table @option
  17382. @item mode, m
  17383. Set the vectorscope mode.
  17384. Available values are:
  17385. @table @samp
  17386. @item lissajous
  17387. Lissajous rotated by 45 degrees.
  17388. @item lissajous_xy
  17389. Same as above but not rotated.
  17390. @item polar
  17391. Shape resembling half of circle.
  17392. @end table
  17393. Default value is @samp{lissajous}.
  17394. @item size, s
  17395. Set the video size for the output. For the syntax of this option, check the
  17396. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17397. Default value is @code{400x400}.
  17398. @item rate, r
  17399. Set the output frame rate. Default value is @code{25}.
  17400. @item rc
  17401. @item gc
  17402. @item bc
  17403. @item ac
  17404. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17405. @code{160}, @code{80} and @code{255}.
  17406. Allowed range is @code{[0, 255]}.
  17407. @item rf
  17408. @item gf
  17409. @item bf
  17410. @item af
  17411. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17412. @code{10}, @code{5} and @code{5}.
  17413. Allowed range is @code{[0, 255]}.
  17414. @item zoom
  17415. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17416. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17417. @item draw
  17418. Set the vectorscope drawing mode.
  17419. Available values are:
  17420. @table @samp
  17421. @item dot
  17422. Draw dot for each sample.
  17423. @item line
  17424. Draw line between previous and current sample.
  17425. @end table
  17426. Default value is @samp{dot}.
  17427. @item scale
  17428. Specify amplitude scale of audio samples.
  17429. Available values are:
  17430. @table @samp
  17431. @item lin
  17432. Linear.
  17433. @item sqrt
  17434. Square root.
  17435. @item cbrt
  17436. Cubic root.
  17437. @item log
  17438. Logarithmic.
  17439. @end table
  17440. @item swap
  17441. Swap left channel axis with right channel axis.
  17442. @item mirror
  17443. Mirror axis.
  17444. @table @samp
  17445. @item none
  17446. No mirror.
  17447. @item x
  17448. Mirror only x axis.
  17449. @item y
  17450. Mirror only y axis.
  17451. @item xy
  17452. Mirror both axis.
  17453. @end table
  17454. @end table
  17455. @subsection Examples
  17456. @itemize
  17457. @item
  17458. Complete example using @command{ffplay}:
  17459. @example
  17460. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17461. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  17462. @end example
  17463. @end itemize
  17464. @section bench, abench
  17465. Benchmark part of a filtergraph.
  17466. The filter accepts the following options:
  17467. @table @option
  17468. @item action
  17469. Start or stop a timer.
  17470. Available values are:
  17471. @table @samp
  17472. @item start
  17473. Get the current time, set it as frame metadata (using the key
  17474. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  17475. @item stop
  17476. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  17477. the input frame metadata to get the time difference. Time difference, average,
  17478. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  17479. @code{min}) are then printed. The timestamps are expressed in seconds.
  17480. @end table
  17481. @end table
  17482. @subsection Examples
  17483. @itemize
  17484. @item
  17485. Benchmark @ref{selectivecolor} filter:
  17486. @example
  17487. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17488. @end example
  17489. @end itemize
  17490. @section concat
  17491. Concatenate audio and video streams, joining them together one after the
  17492. other.
  17493. The filter works on segments of synchronized video and audio streams. All
  17494. segments must have the same number of streams of each type, and that will
  17495. also be the number of streams at output.
  17496. The filter accepts the following options:
  17497. @table @option
  17498. @item n
  17499. Set the number of segments. Default is 2.
  17500. @item v
  17501. Set the number of output video streams, that is also the number of video
  17502. streams in each segment. Default is 1.
  17503. @item a
  17504. Set the number of output audio streams, that is also the number of audio
  17505. streams in each segment. Default is 0.
  17506. @item unsafe
  17507. Activate unsafe mode: do not fail if segments have a different format.
  17508. @end table
  17509. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  17510. @var{a} audio outputs.
  17511. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  17512. segment, in the same order as the outputs, then the inputs for the second
  17513. segment, etc.
  17514. Related streams do not always have exactly the same duration, for various
  17515. reasons including codec frame size or sloppy authoring. For that reason,
  17516. related synchronized streams (e.g. a video and its audio track) should be
  17517. concatenated at once. The concat filter will use the duration of the longest
  17518. stream in each segment (except the last one), and if necessary pad shorter
  17519. audio streams with silence.
  17520. For this filter to work correctly, all segments must start at timestamp 0.
  17521. All corresponding streams must have the same parameters in all segments; the
  17522. filtering system will automatically select a common pixel format for video
  17523. streams, and a common sample format, sample rate and channel layout for
  17524. audio streams, but other settings, such as resolution, must be converted
  17525. explicitly by the user.
  17526. Different frame rates are acceptable but will result in variable frame rate
  17527. at output; be sure to configure the output file to handle it.
  17528. @subsection Examples
  17529. @itemize
  17530. @item
  17531. Concatenate an opening, an episode and an ending, all in bilingual version
  17532. (video in stream 0, audio in streams 1 and 2):
  17533. @example
  17534. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  17535. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  17536. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  17537. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  17538. @end example
  17539. @item
  17540. Concatenate two parts, handling audio and video separately, using the
  17541. (a)movie sources, and adjusting the resolution:
  17542. @example
  17543. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  17544. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  17545. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  17546. @end example
  17547. Note that a desync will happen at the stitch if the audio and video streams
  17548. do not have exactly the same duration in the first file.
  17549. @end itemize
  17550. @subsection Commands
  17551. This filter supports the following commands:
  17552. @table @option
  17553. @item next
  17554. Close the current segment and step to the next one
  17555. @end table
  17556. @anchor{ebur128}
  17557. @section ebur128
  17558. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  17559. level. By default, it logs a message at a frequency of 10Hz with the
  17560. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  17561. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  17562. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  17563. sample format is double-precision floating point. The input stream will be converted to
  17564. this specification, if needed. Users may need to insert aformat and/or aresample filters
  17565. after this filter to obtain the original parameters.
  17566. The filter also has a video output (see the @var{video} option) with a real
  17567. time graph to observe the loudness evolution. The graphic contains the logged
  17568. message mentioned above, so it is not printed anymore when this option is set,
  17569. unless the verbose logging is set. The main graphing area contains the
  17570. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  17571. the momentary loudness (400 milliseconds), but can optionally be configured
  17572. to instead display short-term loudness (see @var{gauge}).
  17573. The green area marks a +/- 1LU target range around the target loudness
  17574. (-23LUFS by default, unless modified through @var{target}).
  17575. More information about the Loudness Recommendation EBU R128 on
  17576. @url{http://tech.ebu.ch/loudness}.
  17577. The filter accepts the following options:
  17578. @table @option
  17579. @item video
  17580. Activate the video output. The audio stream is passed unchanged whether this
  17581. option is set or no. The video stream will be the first output stream if
  17582. activated. Default is @code{0}.
  17583. @item size
  17584. Set the video size. This option is for video only. For the syntax of this
  17585. option, check the
  17586. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17587. Default and minimum resolution is @code{640x480}.
  17588. @item meter
  17589. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  17590. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  17591. other integer value between this range is allowed.
  17592. @item metadata
  17593. Set metadata injection. If set to @code{1}, the audio input will be segmented
  17594. into 100ms output frames, each of them containing various loudness information
  17595. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  17596. Default is @code{0}.
  17597. @item framelog
  17598. Force the frame logging level.
  17599. Available values are:
  17600. @table @samp
  17601. @item info
  17602. information logging level
  17603. @item verbose
  17604. verbose logging level
  17605. @end table
  17606. By default, the logging level is set to @var{info}. If the @option{video} or
  17607. the @option{metadata} options are set, it switches to @var{verbose}.
  17608. @item peak
  17609. Set peak mode(s).
  17610. Available modes can be cumulated (the option is a @code{flag} type). Possible
  17611. values are:
  17612. @table @samp
  17613. @item none
  17614. Disable any peak mode (default).
  17615. @item sample
  17616. Enable sample-peak mode.
  17617. Simple peak mode looking for the higher sample value. It logs a message
  17618. for sample-peak (identified by @code{SPK}).
  17619. @item true
  17620. Enable true-peak mode.
  17621. If enabled, the peak lookup is done on an over-sampled version of the input
  17622. stream for better peak accuracy. It logs a message for true-peak.
  17623. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  17624. This mode requires a build with @code{libswresample}.
  17625. @end table
  17626. @item dualmono
  17627. Treat mono input files as "dual mono". If a mono file is intended for playback
  17628. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  17629. If set to @code{true}, this option will compensate for this effect.
  17630. Multi-channel input files are not affected by this option.
  17631. @item panlaw
  17632. Set a specific pan law to be used for the measurement of dual mono files.
  17633. This parameter is optional, and has a default value of -3.01dB.
  17634. @item target
  17635. Set a specific target level (in LUFS) used as relative zero in the visualization.
  17636. This parameter is optional and has a default value of -23LUFS as specified
  17637. by EBU R128. However, material published online may prefer a level of -16LUFS
  17638. (e.g. for use with podcasts or video platforms).
  17639. @item gauge
  17640. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  17641. @code{shortterm}. By default the momentary value will be used, but in certain
  17642. scenarios it may be more useful to observe the short term value instead (e.g.
  17643. live mixing).
  17644. @item scale
  17645. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  17646. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  17647. video output, not the summary or continuous log output.
  17648. @end table
  17649. @subsection Examples
  17650. @itemize
  17651. @item
  17652. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  17653. @example
  17654. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  17655. @end example
  17656. @item
  17657. Run an analysis with @command{ffmpeg}:
  17658. @example
  17659. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  17660. @end example
  17661. @end itemize
  17662. @section interleave, ainterleave
  17663. Temporally interleave frames from several inputs.
  17664. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  17665. These filters read frames from several inputs and send the oldest
  17666. queued frame to the output.
  17667. Input streams must have well defined, monotonically increasing frame
  17668. timestamp values.
  17669. In order to submit one frame to output, these filters need to enqueue
  17670. at least one frame for each input, so they cannot work in case one
  17671. input is not yet terminated and will not receive incoming frames.
  17672. For example consider the case when one input is a @code{select} filter
  17673. which always drops input frames. The @code{interleave} filter will keep
  17674. reading from that input, but it will never be able to send new frames
  17675. to output until the input sends an end-of-stream signal.
  17676. Also, depending on inputs synchronization, the filters will drop
  17677. frames in case one input receives more frames than the other ones, and
  17678. the queue is already filled.
  17679. These filters accept the following options:
  17680. @table @option
  17681. @item nb_inputs, n
  17682. Set the number of different inputs, it is 2 by default.
  17683. @end table
  17684. @subsection Examples
  17685. @itemize
  17686. @item
  17687. Interleave frames belonging to different streams using @command{ffmpeg}:
  17688. @example
  17689. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  17690. @end example
  17691. @item
  17692. Add flickering blur effect:
  17693. @example
  17694. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  17695. @end example
  17696. @end itemize
  17697. @section metadata, ametadata
  17698. Manipulate frame metadata.
  17699. This filter accepts the following options:
  17700. @table @option
  17701. @item mode
  17702. Set mode of operation of the filter.
  17703. Can be one of the following:
  17704. @table @samp
  17705. @item select
  17706. If both @code{value} and @code{key} is set, select frames
  17707. which have such metadata. If only @code{key} is set, select
  17708. every frame that has such key in metadata.
  17709. @item add
  17710. Add new metadata @code{key} and @code{value}. If key is already available
  17711. do nothing.
  17712. @item modify
  17713. Modify value of already present key.
  17714. @item delete
  17715. If @code{value} is set, delete only keys that have such value.
  17716. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  17717. the frame.
  17718. @item print
  17719. Print key and its value if metadata was found. If @code{key} is not set print all
  17720. metadata values available in frame.
  17721. @end table
  17722. @item key
  17723. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  17724. @item value
  17725. Set metadata value which will be used. This option is mandatory for
  17726. @code{modify} and @code{add} mode.
  17727. @item function
  17728. Which function to use when comparing metadata value and @code{value}.
  17729. Can be one of following:
  17730. @table @samp
  17731. @item same_str
  17732. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  17733. @item starts_with
  17734. Values are interpreted as strings, returns true if metadata value starts with
  17735. the @code{value} option string.
  17736. @item less
  17737. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  17738. @item equal
  17739. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  17740. @item greater
  17741. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  17742. @item expr
  17743. Values are interpreted as floats, returns true if expression from option @code{expr}
  17744. evaluates to true.
  17745. @item ends_with
  17746. Values are interpreted as strings, returns true if metadata value ends with
  17747. the @code{value} option string.
  17748. @end table
  17749. @item expr
  17750. Set expression which is used when @code{function} is set to @code{expr}.
  17751. The expression is evaluated through the eval API and can contain the following
  17752. constants:
  17753. @table @option
  17754. @item VALUE1
  17755. Float representation of @code{value} from metadata key.
  17756. @item VALUE2
  17757. Float representation of @code{value} as supplied by user in @code{value} option.
  17758. @end table
  17759. @item file
  17760. If specified in @code{print} mode, output is written to the named file. Instead of
  17761. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  17762. for standard output. If @code{file} option is not set, output is written to the log
  17763. with AV_LOG_INFO loglevel.
  17764. @item direct
  17765. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  17766. @end table
  17767. @subsection Examples
  17768. @itemize
  17769. @item
  17770. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  17771. between 0 and 1.
  17772. @example
  17773. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  17774. @end example
  17775. @item
  17776. Print silencedetect output to file @file{metadata.txt}.
  17777. @example
  17778. silencedetect,ametadata=mode=print:file=metadata.txt
  17779. @end example
  17780. @item
  17781. Direct all metadata to a pipe with file descriptor 4.
  17782. @example
  17783. metadata=mode=print:file='pipe\:4'
  17784. @end example
  17785. @end itemize
  17786. @section perms, aperms
  17787. Set read/write permissions for the output frames.
  17788. These filters are mainly aimed at developers to test direct path in the
  17789. following filter in the filtergraph.
  17790. The filters accept the following options:
  17791. @table @option
  17792. @item mode
  17793. Select the permissions mode.
  17794. It accepts the following values:
  17795. @table @samp
  17796. @item none
  17797. Do nothing. This is the default.
  17798. @item ro
  17799. Set all the output frames read-only.
  17800. @item rw
  17801. Set all the output frames directly writable.
  17802. @item toggle
  17803. Make the frame read-only if writable, and writable if read-only.
  17804. @item random
  17805. Set each output frame read-only or writable randomly.
  17806. @end table
  17807. @item seed
  17808. Set the seed for the @var{random} mode, must be an integer included between
  17809. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  17810. @code{-1}, the filter will try to use a good random seed on a best effort
  17811. basis.
  17812. @end table
  17813. Note: in case of auto-inserted filter between the permission filter and the
  17814. following one, the permission might not be received as expected in that
  17815. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  17816. perms/aperms filter can avoid this problem.
  17817. @section realtime, arealtime
  17818. Slow down filtering to match real time approximately.
  17819. These filters will pause the filtering for a variable amount of time to
  17820. match the output rate with the input timestamps.
  17821. They are similar to the @option{re} option to @code{ffmpeg}.
  17822. They accept the following options:
  17823. @table @option
  17824. @item limit
  17825. Time limit for the pauses. Any pause longer than that will be considered
  17826. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  17827. @item speed
  17828. Speed factor for processing. The value must be a float larger than zero.
  17829. Values larger than 1.0 will result in faster than realtime processing,
  17830. smaller will slow processing down. The @var{limit} is automatically adapted
  17831. accordingly. Default is 1.0.
  17832. A processing speed faster than what is possible without these filters cannot
  17833. be achieved.
  17834. @end table
  17835. @anchor{select}
  17836. @section select, aselect
  17837. Select frames to pass in output.
  17838. This filter accepts the following options:
  17839. @table @option
  17840. @item expr, e
  17841. Set expression, which is evaluated for each input frame.
  17842. If the expression is evaluated to zero, the frame is discarded.
  17843. If the evaluation result is negative or NaN, the frame is sent to the
  17844. first output; otherwise it is sent to the output with index
  17845. @code{ceil(val)-1}, assuming that the input index starts from 0.
  17846. For example a value of @code{1.2} corresponds to the output with index
  17847. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  17848. @item outputs, n
  17849. Set the number of outputs. The output to which to send the selected
  17850. frame is based on the result of the evaluation. Default value is 1.
  17851. @end table
  17852. The expression can contain the following constants:
  17853. @table @option
  17854. @item n
  17855. The (sequential) number of the filtered frame, starting from 0.
  17856. @item selected_n
  17857. The (sequential) number of the selected frame, starting from 0.
  17858. @item prev_selected_n
  17859. The sequential number of the last selected frame. It's NAN if undefined.
  17860. @item TB
  17861. The timebase of the input timestamps.
  17862. @item pts
  17863. The PTS (Presentation TimeStamp) of the filtered video frame,
  17864. expressed in @var{TB} units. It's NAN if undefined.
  17865. @item t
  17866. The PTS of the filtered video frame,
  17867. expressed in seconds. It's NAN if undefined.
  17868. @item prev_pts
  17869. The PTS of the previously filtered video frame. It's NAN if undefined.
  17870. @item prev_selected_pts
  17871. The PTS of the last previously filtered video frame. It's NAN if undefined.
  17872. @item prev_selected_t
  17873. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  17874. @item start_pts
  17875. The PTS of the first video frame in the video. It's NAN if undefined.
  17876. @item start_t
  17877. The time of the first video frame in the video. It's NAN if undefined.
  17878. @item pict_type @emph{(video only)}
  17879. The type of the filtered frame. It can assume one of the following
  17880. values:
  17881. @table @option
  17882. @item I
  17883. @item P
  17884. @item B
  17885. @item S
  17886. @item SI
  17887. @item SP
  17888. @item BI
  17889. @end table
  17890. @item interlace_type @emph{(video only)}
  17891. The frame interlace type. It can assume one of the following values:
  17892. @table @option
  17893. @item PROGRESSIVE
  17894. The frame is progressive (not interlaced).
  17895. @item TOPFIRST
  17896. The frame is top-field-first.
  17897. @item BOTTOMFIRST
  17898. The frame is bottom-field-first.
  17899. @end table
  17900. @item consumed_sample_n @emph{(audio only)}
  17901. the number of selected samples before the current frame
  17902. @item samples_n @emph{(audio only)}
  17903. the number of samples in the current frame
  17904. @item sample_rate @emph{(audio only)}
  17905. the input sample rate
  17906. @item key
  17907. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  17908. @item pos
  17909. the position in the file of the filtered frame, -1 if the information
  17910. is not available (e.g. for synthetic video)
  17911. @item scene @emph{(video only)}
  17912. value between 0 and 1 to indicate a new scene; a low value reflects a low
  17913. probability for the current frame to introduce a new scene, while a higher
  17914. value means the current frame is more likely to be one (see the example below)
  17915. @item concatdec_select
  17916. The concat demuxer can select only part of a concat input file by setting an
  17917. inpoint and an outpoint, but the output packets may not be entirely contained
  17918. in the selected interval. By using this variable, it is possible to skip frames
  17919. generated by the concat demuxer which are not exactly contained in the selected
  17920. interval.
  17921. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  17922. and the @var{lavf.concat.duration} packet metadata values which are also
  17923. present in the decoded frames.
  17924. The @var{concatdec_select} variable is -1 if the frame pts is at least
  17925. start_time and either the duration metadata is missing or the frame pts is less
  17926. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  17927. missing.
  17928. That basically means that an input frame is selected if its pts is within the
  17929. interval set by the concat demuxer.
  17930. @end table
  17931. The default value of the select expression is "1".
  17932. @subsection Examples
  17933. @itemize
  17934. @item
  17935. Select all frames in input:
  17936. @example
  17937. select
  17938. @end example
  17939. The example above is the same as:
  17940. @example
  17941. select=1
  17942. @end example
  17943. @item
  17944. Skip all frames:
  17945. @example
  17946. select=0
  17947. @end example
  17948. @item
  17949. Select only I-frames:
  17950. @example
  17951. select='eq(pict_type\,I)'
  17952. @end example
  17953. @item
  17954. Select one frame every 100:
  17955. @example
  17956. select='not(mod(n\,100))'
  17957. @end example
  17958. @item
  17959. Select only frames contained in the 10-20 time interval:
  17960. @example
  17961. select=between(t\,10\,20)
  17962. @end example
  17963. @item
  17964. Select only I-frames contained in the 10-20 time interval:
  17965. @example
  17966. select=between(t\,10\,20)*eq(pict_type\,I)
  17967. @end example
  17968. @item
  17969. Select frames with a minimum distance of 10 seconds:
  17970. @example
  17971. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  17972. @end example
  17973. @item
  17974. Use aselect to select only audio frames with samples number > 100:
  17975. @example
  17976. aselect='gt(samples_n\,100)'
  17977. @end example
  17978. @item
  17979. Create a mosaic of the first scenes:
  17980. @example
  17981. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  17982. @end example
  17983. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  17984. choice.
  17985. @item
  17986. Send even and odd frames to separate outputs, and compose them:
  17987. @example
  17988. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  17989. @end example
  17990. @item
  17991. Select useful frames from an ffconcat file which is using inpoints and
  17992. outpoints but where the source files are not intra frame only.
  17993. @example
  17994. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  17995. @end example
  17996. @end itemize
  17997. @section sendcmd, asendcmd
  17998. Send commands to filters in the filtergraph.
  17999. These filters read commands to be sent to other filters in the
  18000. filtergraph.
  18001. @code{sendcmd} must be inserted between two video filters,
  18002. @code{asendcmd} must be inserted between two audio filters, but apart
  18003. from that they act the same way.
  18004. The specification of commands can be provided in the filter arguments
  18005. with the @var{commands} option, or in a file specified by the
  18006. @var{filename} option.
  18007. These filters accept the following options:
  18008. @table @option
  18009. @item commands, c
  18010. Set the commands to be read and sent to the other filters.
  18011. @item filename, f
  18012. Set the filename of the commands to be read and sent to the other
  18013. filters.
  18014. @end table
  18015. @subsection Commands syntax
  18016. A commands description consists of a sequence of interval
  18017. specifications, comprising a list of commands to be executed when a
  18018. particular event related to that interval occurs. The occurring event
  18019. is typically the current frame time entering or leaving a given time
  18020. interval.
  18021. An interval is specified by the following syntax:
  18022. @example
  18023. @var{START}[-@var{END}] @var{COMMANDS};
  18024. @end example
  18025. The time interval is specified by the @var{START} and @var{END} times.
  18026. @var{END} is optional and defaults to the maximum time.
  18027. The current frame time is considered within the specified interval if
  18028. it is included in the interval [@var{START}, @var{END}), that is when
  18029. the time is greater or equal to @var{START} and is lesser than
  18030. @var{END}.
  18031. @var{COMMANDS} consists of a sequence of one or more command
  18032. specifications, separated by ",", relating to that interval. The
  18033. syntax of a command specification is given by:
  18034. @example
  18035. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18036. @end example
  18037. @var{FLAGS} is optional and specifies the type of events relating to
  18038. the time interval which enable sending the specified command, and must
  18039. be a non-null sequence of identifier flags separated by "+" or "|" and
  18040. enclosed between "[" and "]".
  18041. The following flags are recognized:
  18042. @table @option
  18043. @item enter
  18044. The command is sent when the current frame timestamp enters the
  18045. specified interval. In other words, the command is sent when the
  18046. previous frame timestamp was not in the given interval, and the
  18047. current is.
  18048. @item leave
  18049. The command is sent when the current frame timestamp leaves the
  18050. specified interval. In other words, the command is sent when the
  18051. previous frame timestamp was in the given interval, and the
  18052. current is not.
  18053. @item expr
  18054. The command @var{ARG} is interpreted as expression and result of
  18055. expression is passed as @var{ARG}.
  18056. The expression is evaluated through the eval API and can contain the following
  18057. constants:
  18058. @table @option
  18059. @item POS
  18060. Original position in the file of the frame, or undefined if undefined
  18061. for the current frame.
  18062. @item PTS
  18063. The presentation timestamp in input.
  18064. @item N
  18065. The count of the input frame for video or audio, starting from 0.
  18066. @item T
  18067. The time in seconds of the current frame.
  18068. @item TS
  18069. The start time in seconds of the current command interval.
  18070. @item TE
  18071. The end time in seconds of the current command interval.
  18072. @item TI
  18073. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18074. @end table
  18075. @end table
  18076. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18077. assumed.
  18078. @var{TARGET} specifies the target of the command, usually the name of
  18079. the filter class or a specific filter instance name.
  18080. @var{COMMAND} specifies the name of the command for the target filter.
  18081. @var{ARG} is optional and specifies the optional list of argument for
  18082. the given @var{COMMAND}.
  18083. Between one interval specification and another, whitespaces, or
  18084. sequences of characters starting with @code{#} until the end of line,
  18085. are ignored and can be used to annotate comments.
  18086. A simplified BNF description of the commands specification syntax
  18087. follows:
  18088. @example
  18089. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18090. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18091. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18092. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18093. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18094. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18095. @end example
  18096. @subsection Examples
  18097. @itemize
  18098. @item
  18099. Specify audio tempo change at second 4:
  18100. @example
  18101. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18102. @end example
  18103. @item
  18104. Target a specific filter instance:
  18105. @example
  18106. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18107. @end example
  18108. @item
  18109. Specify a list of drawtext and hue commands in a file.
  18110. @example
  18111. # show text in the interval 5-10
  18112. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18113. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18114. # desaturate the image in the interval 15-20
  18115. 15.0-20.0 [enter] hue s 0,
  18116. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18117. [leave] hue s 1,
  18118. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18119. # apply an exponential saturation fade-out effect, starting from time 25
  18120. 25 [enter] hue s exp(25-t)
  18121. @end example
  18122. A filtergraph allowing to read and process the above command list
  18123. stored in a file @file{test.cmd}, can be specified with:
  18124. @example
  18125. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18126. @end example
  18127. @end itemize
  18128. @anchor{setpts}
  18129. @section setpts, asetpts
  18130. Change the PTS (presentation timestamp) of the input frames.
  18131. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18132. This filter accepts the following options:
  18133. @table @option
  18134. @item expr
  18135. The expression which is evaluated for each frame to construct its timestamp.
  18136. @end table
  18137. The expression is evaluated through the eval API and can contain the following
  18138. constants:
  18139. @table @option
  18140. @item FRAME_RATE, FR
  18141. frame rate, only defined for constant frame-rate video
  18142. @item PTS
  18143. The presentation timestamp in input
  18144. @item N
  18145. The count of the input frame for video or the number of consumed samples,
  18146. not including the current frame for audio, starting from 0.
  18147. @item NB_CONSUMED_SAMPLES
  18148. The number of consumed samples, not including the current frame (only
  18149. audio)
  18150. @item NB_SAMPLES, S
  18151. The number of samples in the current frame (only audio)
  18152. @item SAMPLE_RATE, SR
  18153. The audio sample rate.
  18154. @item STARTPTS
  18155. The PTS of the first frame.
  18156. @item STARTT
  18157. the time in seconds of the first frame
  18158. @item INTERLACED
  18159. State whether the current frame is interlaced.
  18160. @item T
  18161. the time in seconds of the current frame
  18162. @item POS
  18163. original position in the file of the frame, or undefined if undefined
  18164. for the current frame
  18165. @item PREV_INPTS
  18166. The previous input PTS.
  18167. @item PREV_INT
  18168. previous input time in seconds
  18169. @item PREV_OUTPTS
  18170. The previous output PTS.
  18171. @item PREV_OUTT
  18172. previous output time in seconds
  18173. @item RTCTIME
  18174. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18175. instead.
  18176. @item RTCSTART
  18177. The wallclock (RTC) time at the start of the movie in microseconds.
  18178. @item TB
  18179. The timebase of the input timestamps.
  18180. @end table
  18181. @subsection Examples
  18182. @itemize
  18183. @item
  18184. Start counting PTS from zero
  18185. @example
  18186. setpts=PTS-STARTPTS
  18187. @end example
  18188. @item
  18189. Apply fast motion effect:
  18190. @example
  18191. setpts=0.5*PTS
  18192. @end example
  18193. @item
  18194. Apply slow motion effect:
  18195. @example
  18196. setpts=2.0*PTS
  18197. @end example
  18198. @item
  18199. Set fixed rate of 25 frames per second:
  18200. @example
  18201. setpts=N/(25*TB)
  18202. @end example
  18203. @item
  18204. Set fixed rate 25 fps with some jitter:
  18205. @example
  18206. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18207. @end example
  18208. @item
  18209. Apply an offset of 10 seconds to the input PTS:
  18210. @example
  18211. setpts=PTS+10/TB
  18212. @end example
  18213. @item
  18214. Generate timestamps from a "live source" and rebase onto the current timebase:
  18215. @example
  18216. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18217. @end example
  18218. @item
  18219. Generate timestamps by counting samples:
  18220. @example
  18221. asetpts=N/SR/TB
  18222. @end example
  18223. @end itemize
  18224. @section setrange
  18225. Force color range for the output video frame.
  18226. The @code{setrange} filter marks the color range property for the
  18227. output frames. It does not change the input frame, but only sets the
  18228. corresponding property, which affects how the frame is treated by
  18229. following filters.
  18230. The filter accepts the following options:
  18231. @table @option
  18232. @item range
  18233. Available values are:
  18234. @table @samp
  18235. @item auto
  18236. Keep the same color range property.
  18237. @item unspecified, unknown
  18238. Set the color range as unspecified.
  18239. @item limited, tv, mpeg
  18240. Set the color range as limited.
  18241. @item full, pc, jpeg
  18242. Set the color range as full.
  18243. @end table
  18244. @end table
  18245. @section settb, asettb
  18246. Set the timebase to use for the output frames timestamps.
  18247. It is mainly useful for testing timebase configuration.
  18248. It accepts the following parameters:
  18249. @table @option
  18250. @item expr, tb
  18251. The expression which is evaluated into the output timebase.
  18252. @end table
  18253. The value for @option{tb} is an arithmetic expression representing a
  18254. rational. The expression can contain the constants "AVTB" (the default
  18255. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18256. audio only). Default value is "intb".
  18257. @subsection Examples
  18258. @itemize
  18259. @item
  18260. Set the timebase to 1/25:
  18261. @example
  18262. settb=expr=1/25
  18263. @end example
  18264. @item
  18265. Set the timebase to 1/10:
  18266. @example
  18267. settb=expr=0.1
  18268. @end example
  18269. @item
  18270. Set the timebase to 1001/1000:
  18271. @example
  18272. settb=1+0.001
  18273. @end example
  18274. @item
  18275. Set the timebase to 2*intb:
  18276. @example
  18277. settb=2*intb
  18278. @end example
  18279. @item
  18280. Set the default timebase value:
  18281. @example
  18282. settb=AVTB
  18283. @end example
  18284. @end itemize
  18285. @section showcqt
  18286. Convert input audio to a video output representing frequency spectrum
  18287. logarithmically using Brown-Puckette constant Q transform algorithm with
  18288. direct frequency domain coefficient calculation (but the transform itself
  18289. is not really constant Q, instead the Q factor is actually variable/clamped),
  18290. with musical tone scale, from E0 to D#10.
  18291. The filter accepts the following options:
  18292. @table @option
  18293. @item size, s
  18294. Specify the video size for the output. It must be even. For the syntax of this option,
  18295. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18296. Default value is @code{1920x1080}.
  18297. @item fps, rate, r
  18298. Set the output frame rate. Default value is @code{25}.
  18299. @item bar_h
  18300. Set the bargraph height. It must be even. Default value is @code{-1} which
  18301. computes the bargraph height automatically.
  18302. @item axis_h
  18303. Set the axis height. It must be even. Default value is @code{-1} which computes
  18304. the axis height automatically.
  18305. @item sono_h
  18306. Set the sonogram height. It must be even. Default value is @code{-1} which
  18307. computes the sonogram height automatically.
  18308. @item fullhd
  18309. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18310. instead. Default value is @code{1}.
  18311. @item sono_v, volume
  18312. Specify the sonogram volume expression. It can contain variables:
  18313. @table @option
  18314. @item bar_v
  18315. the @var{bar_v} evaluated expression
  18316. @item frequency, freq, f
  18317. the frequency where it is evaluated
  18318. @item timeclamp, tc
  18319. the value of @var{timeclamp} option
  18320. @end table
  18321. and functions:
  18322. @table @option
  18323. @item a_weighting(f)
  18324. A-weighting of equal loudness
  18325. @item b_weighting(f)
  18326. B-weighting of equal loudness
  18327. @item c_weighting(f)
  18328. C-weighting of equal loudness.
  18329. @end table
  18330. Default value is @code{16}.
  18331. @item bar_v, volume2
  18332. Specify the bargraph volume expression. It can contain variables:
  18333. @table @option
  18334. @item sono_v
  18335. the @var{sono_v} evaluated expression
  18336. @item frequency, freq, f
  18337. the frequency where it is evaluated
  18338. @item timeclamp, tc
  18339. the value of @var{timeclamp} option
  18340. @end table
  18341. and functions:
  18342. @table @option
  18343. @item a_weighting(f)
  18344. A-weighting of equal loudness
  18345. @item b_weighting(f)
  18346. B-weighting of equal loudness
  18347. @item c_weighting(f)
  18348. C-weighting of equal loudness.
  18349. @end table
  18350. Default value is @code{sono_v}.
  18351. @item sono_g, gamma
  18352. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18353. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18354. Acceptable range is @code{[1, 7]}.
  18355. @item bar_g, gamma2
  18356. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18357. @code{[1, 7]}.
  18358. @item bar_t
  18359. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18360. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18361. @item timeclamp, tc
  18362. Specify the transform timeclamp. At low frequency, there is trade-off between
  18363. accuracy in time domain and frequency domain. If timeclamp is lower,
  18364. event in time domain is represented more accurately (such as fast bass drum),
  18365. otherwise event in frequency domain is represented more accurately
  18366. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18367. @item attack
  18368. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18369. limits future samples by applying asymmetric windowing in time domain, useful
  18370. when low latency is required. Accepted range is @code{[0, 1]}.
  18371. @item basefreq
  18372. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18373. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18374. @item endfreq
  18375. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18376. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18377. @item coeffclamp
  18378. This option is deprecated and ignored.
  18379. @item tlength
  18380. Specify the transform length in time domain. Use this option to control accuracy
  18381. trade-off between time domain and frequency domain at every frequency sample.
  18382. It can contain variables:
  18383. @table @option
  18384. @item frequency, freq, f
  18385. the frequency where it is evaluated
  18386. @item timeclamp, tc
  18387. the value of @var{timeclamp} option.
  18388. @end table
  18389. Default value is @code{384*tc/(384+tc*f)}.
  18390. @item count
  18391. Specify the transform count for every video frame. Default value is @code{6}.
  18392. Acceptable range is @code{[1, 30]}.
  18393. @item fcount
  18394. Specify the transform count for every single pixel. Default value is @code{0},
  18395. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18396. @item fontfile
  18397. Specify font file for use with freetype to draw the axis. If not specified,
  18398. use embedded font. Note that drawing with font file or embedded font is not
  18399. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18400. option instead.
  18401. @item font
  18402. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18403. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18404. escaping.
  18405. @item fontcolor
  18406. Specify font color expression. This is arithmetic expression that should return
  18407. integer value 0xRRGGBB. It can contain variables:
  18408. @table @option
  18409. @item frequency, freq, f
  18410. the frequency where it is evaluated
  18411. @item timeclamp, tc
  18412. the value of @var{timeclamp} option
  18413. @end table
  18414. and functions:
  18415. @table @option
  18416. @item midi(f)
  18417. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  18418. @item r(x), g(x), b(x)
  18419. red, green, and blue value of intensity x.
  18420. @end table
  18421. Default value is @code{st(0, (midi(f)-59.5)/12);
  18422. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  18423. r(1-ld(1)) + b(ld(1))}.
  18424. @item axisfile
  18425. Specify image file to draw the axis. This option override @var{fontfile} and
  18426. @var{fontcolor} option.
  18427. @item axis, text
  18428. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  18429. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  18430. Default value is @code{1}.
  18431. @item csp
  18432. Set colorspace. The accepted values are:
  18433. @table @samp
  18434. @item unspecified
  18435. Unspecified (default)
  18436. @item bt709
  18437. BT.709
  18438. @item fcc
  18439. FCC
  18440. @item bt470bg
  18441. BT.470BG or BT.601-6 625
  18442. @item smpte170m
  18443. SMPTE-170M or BT.601-6 525
  18444. @item smpte240m
  18445. SMPTE-240M
  18446. @item bt2020ncl
  18447. BT.2020 with non-constant luminance
  18448. @end table
  18449. @item cscheme
  18450. Set spectrogram color scheme. This is list of floating point values with format
  18451. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  18452. The default is @code{1|0.5|0|0|0.5|1}.
  18453. @end table
  18454. @subsection Examples
  18455. @itemize
  18456. @item
  18457. Playing audio while showing the spectrum:
  18458. @example
  18459. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  18460. @end example
  18461. @item
  18462. Same as above, but with frame rate 30 fps:
  18463. @example
  18464. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  18465. @end example
  18466. @item
  18467. Playing at 1280x720:
  18468. @example
  18469. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  18470. @end example
  18471. @item
  18472. Disable sonogram display:
  18473. @example
  18474. sono_h=0
  18475. @end example
  18476. @item
  18477. A1 and its harmonics: A1, A2, (near)E3, A3:
  18478. @example
  18479. 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),
  18480. asplit[a][out1]; [a] showcqt [out0]'
  18481. @end example
  18482. @item
  18483. Same as above, but with more accuracy in frequency domain:
  18484. @example
  18485. 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),
  18486. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  18487. @end example
  18488. @item
  18489. Custom volume:
  18490. @example
  18491. bar_v=10:sono_v=bar_v*a_weighting(f)
  18492. @end example
  18493. @item
  18494. Custom gamma, now spectrum is linear to the amplitude.
  18495. @example
  18496. bar_g=2:sono_g=2
  18497. @end example
  18498. @item
  18499. Custom tlength equation:
  18500. @example
  18501. 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)))'
  18502. @end example
  18503. @item
  18504. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  18505. @example
  18506. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  18507. @end example
  18508. @item
  18509. Custom font using fontconfig:
  18510. @example
  18511. font='Courier New,Monospace,mono|bold'
  18512. @end example
  18513. @item
  18514. Custom frequency range with custom axis using image file:
  18515. @example
  18516. axisfile=myaxis.png:basefreq=40:endfreq=10000
  18517. @end example
  18518. @end itemize
  18519. @section showfreqs
  18520. Convert input audio to video output representing the audio power spectrum.
  18521. Audio amplitude is on Y-axis while frequency is on X-axis.
  18522. The filter accepts the following options:
  18523. @table @option
  18524. @item size, s
  18525. Specify size of video. For the syntax of this option, check the
  18526. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18527. Default is @code{1024x512}.
  18528. @item mode
  18529. Set display mode.
  18530. This set how each frequency bin will be represented.
  18531. It accepts the following values:
  18532. @table @samp
  18533. @item line
  18534. @item bar
  18535. @item dot
  18536. @end table
  18537. Default is @code{bar}.
  18538. @item ascale
  18539. Set amplitude scale.
  18540. It accepts the following values:
  18541. @table @samp
  18542. @item lin
  18543. Linear scale.
  18544. @item sqrt
  18545. Square root scale.
  18546. @item cbrt
  18547. Cubic root scale.
  18548. @item log
  18549. Logarithmic scale.
  18550. @end table
  18551. Default is @code{log}.
  18552. @item fscale
  18553. Set frequency scale.
  18554. It accepts the following values:
  18555. @table @samp
  18556. @item lin
  18557. Linear scale.
  18558. @item log
  18559. Logarithmic scale.
  18560. @item rlog
  18561. Reverse logarithmic scale.
  18562. @end table
  18563. Default is @code{lin}.
  18564. @item win_size
  18565. Set window size. Allowed range is from 16 to 65536.
  18566. Default is @code{2048}
  18567. @item win_func
  18568. Set windowing function.
  18569. It accepts the following values:
  18570. @table @samp
  18571. @item rect
  18572. @item bartlett
  18573. @item hanning
  18574. @item hamming
  18575. @item blackman
  18576. @item welch
  18577. @item flattop
  18578. @item bharris
  18579. @item bnuttall
  18580. @item bhann
  18581. @item sine
  18582. @item nuttall
  18583. @item lanczos
  18584. @item gauss
  18585. @item tukey
  18586. @item dolph
  18587. @item cauchy
  18588. @item parzen
  18589. @item poisson
  18590. @item bohman
  18591. @end table
  18592. Default is @code{hanning}.
  18593. @item overlap
  18594. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18595. which means optimal overlap for selected window function will be picked.
  18596. @item averaging
  18597. Set time averaging. Setting this to 0 will display current maximal peaks.
  18598. Default is @code{1}, which means time averaging is disabled.
  18599. @item colors
  18600. Specify list of colors separated by space or by '|' which will be used to
  18601. draw channel frequencies. Unrecognized or missing colors will be replaced
  18602. by white color.
  18603. @item cmode
  18604. Set channel display mode.
  18605. It accepts the following values:
  18606. @table @samp
  18607. @item combined
  18608. @item separate
  18609. @end table
  18610. Default is @code{combined}.
  18611. @item minamp
  18612. Set minimum amplitude used in @code{log} amplitude scaler.
  18613. @end table
  18614. @section showspatial
  18615. Convert stereo input audio to a video output, representing the spatial relationship
  18616. between two channels.
  18617. The filter accepts the following options:
  18618. @table @option
  18619. @item size, s
  18620. Specify the video size for the output. For the syntax of this option, check the
  18621. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18622. Default value is @code{512x512}.
  18623. @item win_size
  18624. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  18625. @item win_func
  18626. Set window function.
  18627. It accepts the following values:
  18628. @table @samp
  18629. @item rect
  18630. @item bartlett
  18631. @item hann
  18632. @item hanning
  18633. @item hamming
  18634. @item blackman
  18635. @item welch
  18636. @item flattop
  18637. @item bharris
  18638. @item bnuttall
  18639. @item bhann
  18640. @item sine
  18641. @item nuttall
  18642. @item lanczos
  18643. @item gauss
  18644. @item tukey
  18645. @item dolph
  18646. @item cauchy
  18647. @item parzen
  18648. @item poisson
  18649. @item bohman
  18650. @end table
  18651. Default value is @code{hann}.
  18652. @item overlap
  18653. Set ratio of overlap window. Default value is @code{0.5}.
  18654. When value is @code{1} overlap is set to recommended size for specific
  18655. window function currently used.
  18656. @end table
  18657. @anchor{showspectrum}
  18658. @section showspectrum
  18659. Convert input audio to a video output, representing the audio frequency
  18660. spectrum.
  18661. The filter accepts the following options:
  18662. @table @option
  18663. @item size, s
  18664. Specify the video size for the output. For the syntax of this option, check the
  18665. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18666. Default value is @code{640x512}.
  18667. @item slide
  18668. Specify how the spectrum should slide along the window.
  18669. It accepts the following values:
  18670. @table @samp
  18671. @item replace
  18672. the samples start again on the left when they reach the right
  18673. @item scroll
  18674. the samples scroll from right to left
  18675. @item fullframe
  18676. frames are only produced when the samples reach the right
  18677. @item rscroll
  18678. the samples scroll from left to right
  18679. @end table
  18680. Default value is @code{replace}.
  18681. @item mode
  18682. Specify display mode.
  18683. It accepts the following values:
  18684. @table @samp
  18685. @item combined
  18686. all channels are displayed in the same row
  18687. @item separate
  18688. all channels are displayed in separate rows
  18689. @end table
  18690. Default value is @samp{combined}.
  18691. @item color
  18692. Specify display color mode.
  18693. It accepts the following values:
  18694. @table @samp
  18695. @item channel
  18696. each channel is displayed in a separate color
  18697. @item intensity
  18698. each channel is displayed using the same color scheme
  18699. @item rainbow
  18700. each channel is displayed using the rainbow color scheme
  18701. @item moreland
  18702. each channel is displayed using the moreland color scheme
  18703. @item nebulae
  18704. each channel is displayed using the nebulae color scheme
  18705. @item fire
  18706. each channel is displayed using the fire color scheme
  18707. @item fiery
  18708. each channel is displayed using the fiery color scheme
  18709. @item fruit
  18710. each channel is displayed using the fruit color scheme
  18711. @item cool
  18712. each channel is displayed using the cool color scheme
  18713. @item magma
  18714. each channel is displayed using the magma color scheme
  18715. @item green
  18716. each channel is displayed using the green color scheme
  18717. @item viridis
  18718. each channel is displayed using the viridis color scheme
  18719. @item plasma
  18720. each channel is displayed using the plasma color scheme
  18721. @item cividis
  18722. each channel is displayed using the cividis color scheme
  18723. @item terrain
  18724. each channel is displayed using the terrain color scheme
  18725. @end table
  18726. Default value is @samp{channel}.
  18727. @item scale
  18728. Specify scale used for calculating intensity color values.
  18729. It accepts the following values:
  18730. @table @samp
  18731. @item lin
  18732. linear
  18733. @item sqrt
  18734. square root, default
  18735. @item cbrt
  18736. cubic root
  18737. @item log
  18738. logarithmic
  18739. @item 4thrt
  18740. 4th root
  18741. @item 5thrt
  18742. 5th root
  18743. @end table
  18744. Default value is @samp{sqrt}.
  18745. @item fscale
  18746. Specify frequency scale.
  18747. It accepts the following values:
  18748. @table @samp
  18749. @item lin
  18750. linear
  18751. @item log
  18752. logarithmic
  18753. @end table
  18754. Default value is @samp{lin}.
  18755. @item saturation
  18756. Set saturation modifier for displayed colors. Negative values provide
  18757. alternative color scheme. @code{0} is no saturation at all.
  18758. Saturation must be in [-10.0, 10.0] range.
  18759. Default value is @code{1}.
  18760. @item win_func
  18761. Set window function.
  18762. It accepts the following values:
  18763. @table @samp
  18764. @item rect
  18765. @item bartlett
  18766. @item hann
  18767. @item hanning
  18768. @item hamming
  18769. @item blackman
  18770. @item welch
  18771. @item flattop
  18772. @item bharris
  18773. @item bnuttall
  18774. @item bhann
  18775. @item sine
  18776. @item nuttall
  18777. @item lanczos
  18778. @item gauss
  18779. @item tukey
  18780. @item dolph
  18781. @item cauchy
  18782. @item parzen
  18783. @item poisson
  18784. @item bohman
  18785. @end table
  18786. Default value is @code{hann}.
  18787. @item orientation
  18788. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18789. @code{horizontal}. Default is @code{vertical}.
  18790. @item overlap
  18791. Set ratio of overlap window. Default value is @code{0}.
  18792. When value is @code{1} overlap is set to recommended size for specific
  18793. window function currently used.
  18794. @item gain
  18795. Set scale gain for calculating intensity color values.
  18796. Default value is @code{1}.
  18797. @item data
  18798. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  18799. @item rotation
  18800. Set color rotation, must be in [-1.0, 1.0] range.
  18801. Default value is @code{0}.
  18802. @item start
  18803. Set start frequency from which to display spectrogram. Default is @code{0}.
  18804. @item stop
  18805. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18806. @item fps
  18807. Set upper frame rate limit. Default is @code{auto}, unlimited.
  18808. @item legend
  18809. Draw time and frequency axes and legends. Default is disabled.
  18810. @end table
  18811. The usage is very similar to the showwaves filter; see the examples in that
  18812. section.
  18813. @subsection Examples
  18814. @itemize
  18815. @item
  18816. Large window with logarithmic color scaling:
  18817. @example
  18818. showspectrum=s=1280x480:scale=log
  18819. @end example
  18820. @item
  18821. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  18822. @example
  18823. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18824. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  18825. @end example
  18826. @end itemize
  18827. @section showspectrumpic
  18828. Convert input audio to a single video frame, representing the audio frequency
  18829. spectrum.
  18830. The filter accepts the following options:
  18831. @table @option
  18832. @item size, s
  18833. Specify the video size for the output. For the syntax of this option, check the
  18834. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18835. Default value is @code{4096x2048}.
  18836. @item mode
  18837. Specify display mode.
  18838. It accepts the following values:
  18839. @table @samp
  18840. @item combined
  18841. all channels are displayed in the same row
  18842. @item separate
  18843. all channels are displayed in separate rows
  18844. @end table
  18845. Default value is @samp{combined}.
  18846. @item color
  18847. Specify display color mode.
  18848. It accepts the following values:
  18849. @table @samp
  18850. @item channel
  18851. each channel is displayed in a separate color
  18852. @item intensity
  18853. each channel is displayed using the same color scheme
  18854. @item rainbow
  18855. each channel is displayed using the rainbow color scheme
  18856. @item moreland
  18857. each channel is displayed using the moreland color scheme
  18858. @item nebulae
  18859. each channel is displayed using the nebulae color scheme
  18860. @item fire
  18861. each channel is displayed using the fire color scheme
  18862. @item fiery
  18863. each channel is displayed using the fiery color scheme
  18864. @item fruit
  18865. each channel is displayed using the fruit color scheme
  18866. @item cool
  18867. each channel is displayed using the cool color scheme
  18868. @item magma
  18869. each channel is displayed using the magma color scheme
  18870. @item green
  18871. each channel is displayed using the green color scheme
  18872. @item viridis
  18873. each channel is displayed using the viridis color scheme
  18874. @item plasma
  18875. each channel is displayed using the plasma color scheme
  18876. @item cividis
  18877. each channel is displayed using the cividis color scheme
  18878. @item terrain
  18879. each channel is displayed using the terrain color scheme
  18880. @end table
  18881. Default value is @samp{intensity}.
  18882. @item scale
  18883. Specify scale used for calculating intensity color values.
  18884. It accepts the following values:
  18885. @table @samp
  18886. @item lin
  18887. linear
  18888. @item sqrt
  18889. square root, default
  18890. @item cbrt
  18891. cubic root
  18892. @item log
  18893. logarithmic
  18894. @item 4thrt
  18895. 4th root
  18896. @item 5thrt
  18897. 5th root
  18898. @end table
  18899. Default value is @samp{log}.
  18900. @item fscale
  18901. Specify frequency scale.
  18902. It accepts the following values:
  18903. @table @samp
  18904. @item lin
  18905. linear
  18906. @item log
  18907. logarithmic
  18908. @end table
  18909. Default value is @samp{lin}.
  18910. @item saturation
  18911. Set saturation modifier for displayed colors. Negative values provide
  18912. alternative color scheme. @code{0} is no saturation at all.
  18913. Saturation must be in [-10.0, 10.0] range.
  18914. Default value is @code{1}.
  18915. @item win_func
  18916. Set window function.
  18917. It accepts the following values:
  18918. @table @samp
  18919. @item rect
  18920. @item bartlett
  18921. @item hann
  18922. @item hanning
  18923. @item hamming
  18924. @item blackman
  18925. @item welch
  18926. @item flattop
  18927. @item bharris
  18928. @item bnuttall
  18929. @item bhann
  18930. @item sine
  18931. @item nuttall
  18932. @item lanczos
  18933. @item gauss
  18934. @item tukey
  18935. @item dolph
  18936. @item cauchy
  18937. @item parzen
  18938. @item poisson
  18939. @item bohman
  18940. @end table
  18941. Default value is @code{hann}.
  18942. @item orientation
  18943. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18944. @code{horizontal}. Default is @code{vertical}.
  18945. @item gain
  18946. Set scale gain for calculating intensity color values.
  18947. Default value is @code{1}.
  18948. @item legend
  18949. Draw time and frequency axes and legends. Default is enabled.
  18950. @item rotation
  18951. Set color rotation, must be in [-1.0, 1.0] range.
  18952. Default value is @code{0}.
  18953. @item start
  18954. Set start frequency from which to display spectrogram. Default is @code{0}.
  18955. @item stop
  18956. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18957. @end table
  18958. @subsection Examples
  18959. @itemize
  18960. @item
  18961. Extract an audio spectrogram of a whole audio track
  18962. in a 1024x1024 picture using @command{ffmpeg}:
  18963. @example
  18964. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  18965. @end example
  18966. @end itemize
  18967. @section showvolume
  18968. Convert input audio volume to a video output.
  18969. The filter accepts the following options:
  18970. @table @option
  18971. @item rate, r
  18972. Set video rate.
  18973. @item b
  18974. Set border width, allowed range is [0, 5]. Default is 1.
  18975. @item w
  18976. Set channel width, allowed range is [80, 8192]. Default is 400.
  18977. @item h
  18978. Set channel height, allowed range is [1, 900]. Default is 20.
  18979. @item f
  18980. Set fade, allowed range is [0, 1]. Default is 0.95.
  18981. @item c
  18982. Set volume color expression.
  18983. The expression can use the following variables:
  18984. @table @option
  18985. @item VOLUME
  18986. Current max volume of channel in dB.
  18987. @item PEAK
  18988. Current peak.
  18989. @item CHANNEL
  18990. Current channel number, starting from 0.
  18991. @end table
  18992. @item t
  18993. If set, displays channel names. Default is enabled.
  18994. @item v
  18995. If set, displays volume values. Default is enabled.
  18996. @item o
  18997. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  18998. default is @code{h}.
  18999. @item s
  19000. Set step size, allowed range is [0, 5]. Default is 0, which means
  19001. step is disabled.
  19002. @item p
  19003. Set background opacity, allowed range is [0, 1]. Default is 0.
  19004. @item m
  19005. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19006. default is @code{p}.
  19007. @item ds
  19008. Set display scale, can be linear: @code{lin} or log: @code{log},
  19009. default is @code{lin}.
  19010. @item dm
  19011. In second.
  19012. If set to > 0., display a line for the max level
  19013. in the previous seconds.
  19014. default is disabled: @code{0.}
  19015. @item dmc
  19016. The color of the max line. Use when @code{dm} option is set to > 0.
  19017. default is: @code{orange}
  19018. @end table
  19019. @section showwaves
  19020. Convert input audio to a video output, representing the samples waves.
  19021. The filter accepts the following options:
  19022. @table @option
  19023. @item size, s
  19024. Specify the video size for the output. For the syntax of this option, check the
  19025. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19026. Default value is @code{600x240}.
  19027. @item mode
  19028. Set display mode.
  19029. Available values are:
  19030. @table @samp
  19031. @item point
  19032. Draw a point for each sample.
  19033. @item line
  19034. Draw a vertical line for each sample.
  19035. @item p2p
  19036. Draw a point for each sample and a line between them.
  19037. @item cline
  19038. Draw a centered vertical line for each sample.
  19039. @end table
  19040. Default value is @code{point}.
  19041. @item n
  19042. Set the number of samples which are printed on the same column. A
  19043. larger value will decrease the frame rate. Must be a positive
  19044. integer. This option can be set only if the value for @var{rate}
  19045. is not explicitly specified.
  19046. @item rate, r
  19047. Set the (approximate) output frame rate. This is done by setting the
  19048. option @var{n}. Default value is "25".
  19049. @item split_channels
  19050. Set if channels should be drawn separately or overlap. Default value is 0.
  19051. @item colors
  19052. Set colors separated by '|' which are going to be used for drawing of each channel.
  19053. @item scale
  19054. Set amplitude scale.
  19055. Available values are:
  19056. @table @samp
  19057. @item lin
  19058. Linear.
  19059. @item log
  19060. Logarithmic.
  19061. @item sqrt
  19062. Square root.
  19063. @item cbrt
  19064. Cubic root.
  19065. @end table
  19066. Default is linear.
  19067. @item draw
  19068. Set the draw mode. This is mostly useful to set for high @var{n}.
  19069. Available values are:
  19070. @table @samp
  19071. @item scale
  19072. Scale pixel values for each drawn sample.
  19073. @item full
  19074. Draw every sample directly.
  19075. @end table
  19076. Default value is @code{scale}.
  19077. @end table
  19078. @subsection Examples
  19079. @itemize
  19080. @item
  19081. Output the input file audio and the corresponding video representation
  19082. at the same time:
  19083. @example
  19084. amovie=a.mp3,asplit[out0],showwaves[out1]
  19085. @end example
  19086. @item
  19087. Create a synthetic signal and show it with showwaves, forcing a
  19088. frame rate of 30 frames per second:
  19089. @example
  19090. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19091. @end example
  19092. @end itemize
  19093. @section showwavespic
  19094. Convert input audio to a single video frame, representing the samples waves.
  19095. The filter accepts the following options:
  19096. @table @option
  19097. @item size, s
  19098. Specify the video size for the output. For the syntax of this option, check the
  19099. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19100. Default value is @code{600x240}.
  19101. @item split_channels
  19102. Set if channels should be drawn separately or overlap. Default value is 0.
  19103. @item colors
  19104. Set colors separated by '|' which are going to be used for drawing of each channel.
  19105. @item scale
  19106. Set amplitude scale.
  19107. Available values are:
  19108. @table @samp
  19109. @item lin
  19110. Linear.
  19111. @item log
  19112. Logarithmic.
  19113. @item sqrt
  19114. Square root.
  19115. @item cbrt
  19116. Cubic root.
  19117. @end table
  19118. Default is linear.
  19119. @item draw
  19120. Set the draw mode.
  19121. Available values are:
  19122. @table @samp
  19123. @item scale
  19124. Scale pixel values for each drawn sample.
  19125. @item full
  19126. Draw every sample directly.
  19127. @end table
  19128. Default value is @code{scale}.
  19129. @end table
  19130. @subsection Examples
  19131. @itemize
  19132. @item
  19133. Extract a channel split representation of the wave form of a whole audio track
  19134. in a 1024x800 picture using @command{ffmpeg}:
  19135. @example
  19136. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19137. @end example
  19138. @end itemize
  19139. @section sidedata, asidedata
  19140. Delete frame side data, or select frames based on it.
  19141. This filter accepts the following options:
  19142. @table @option
  19143. @item mode
  19144. Set mode of operation of the filter.
  19145. Can be one of the following:
  19146. @table @samp
  19147. @item select
  19148. Select every frame with side data of @code{type}.
  19149. @item delete
  19150. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19151. data in the frame.
  19152. @end table
  19153. @item type
  19154. Set side data type used with all modes. Must be set for @code{select} mode. For
  19155. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19156. in @file{libavutil/frame.h}. For example, to choose
  19157. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19158. @end table
  19159. @section spectrumsynth
  19160. Synthesize audio from 2 input video spectrums, first input stream represents
  19161. magnitude across time and second represents phase across time.
  19162. The filter will transform from frequency domain as displayed in videos back
  19163. to time domain as presented in audio output.
  19164. This filter is primarily created for reversing processed @ref{showspectrum}
  19165. filter outputs, but can synthesize sound from other spectrograms too.
  19166. But in such case results are going to be poor if the phase data is not
  19167. available, because in such cases phase data need to be recreated, usually
  19168. it's just recreated from random noise.
  19169. For best results use gray only output (@code{channel} color mode in
  19170. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19171. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19172. @code{data} option. Inputs videos should generally use @code{fullframe}
  19173. slide mode as that saves resources needed for decoding video.
  19174. The filter accepts the following options:
  19175. @table @option
  19176. @item sample_rate
  19177. Specify sample rate of output audio, the sample rate of audio from which
  19178. spectrum was generated may differ.
  19179. @item channels
  19180. Set number of channels represented in input video spectrums.
  19181. @item scale
  19182. Set scale which was used when generating magnitude input spectrum.
  19183. Can be @code{lin} or @code{log}. Default is @code{log}.
  19184. @item slide
  19185. Set slide which was used when generating inputs spectrums.
  19186. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19187. Default is @code{fullframe}.
  19188. @item win_func
  19189. Set window function used for resynthesis.
  19190. @item overlap
  19191. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19192. which means optimal overlap for selected window function will be picked.
  19193. @item orientation
  19194. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19195. Default is @code{vertical}.
  19196. @end table
  19197. @subsection Examples
  19198. @itemize
  19199. @item
  19200. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19201. then resynthesize videos back to audio with spectrumsynth:
  19202. @example
  19203. 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
  19204. 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
  19205. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19206. @end example
  19207. @end itemize
  19208. @section split, asplit
  19209. Split input into several identical outputs.
  19210. @code{asplit} works with audio input, @code{split} with video.
  19211. The filter accepts a single parameter which specifies the number of outputs. If
  19212. unspecified, it defaults to 2.
  19213. @subsection Examples
  19214. @itemize
  19215. @item
  19216. Create two separate outputs from the same input:
  19217. @example
  19218. [in] split [out0][out1]
  19219. @end example
  19220. @item
  19221. To create 3 or more outputs, you need to specify the number of
  19222. outputs, like in:
  19223. @example
  19224. [in] asplit=3 [out0][out1][out2]
  19225. @end example
  19226. @item
  19227. Create two separate outputs from the same input, one cropped and
  19228. one padded:
  19229. @example
  19230. [in] split [splitout1][splitout2];
  19231. [splitout1] crop=100:100:0:0 [cropout];
  19232. [splitout2] pad=200:200:100:100 [padout];
  19233. @end example
  19234. @item
  19235. Create 5 copies of the input audio with @command{ffmpeg}:
  19236. @example
  19237. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19238. @end example
  19239. @end itemize
  19240. @section zmq, azmq
  19241. Receive commands sent through a libzmq client, and forward them to
  19242. filters in the filtergraph.
  19243. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19244. must be inserted between two video filters, @code{azmq} between two
  19245. audio filters. Both are capable to send messages to any filter type.
  19246. To enable these filters you need to install the libzmq library and
  19247. headers and configure FFmpeg with @code{--enable-libzmq}.
  19248. For more information about libzmq see:
  19249. @url{http://www.zeromq.org/}
  19250. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19251. receives messages sent through a network interface defined by the
  19252. @option{bind_address} (or the abbreviation "@option{b}") option.
  19253. Default value of this option is @file{tcp://localhost:5555}. You may
  19254. want to alter this value to your needs, but do not forget to escape any
  19255. ':' signs (see @ref{filtergraph escaping}).
  19256. The received message must be in the form:
  19257. @example
  19258. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19259. @end example
  19260. @var{TARGET} specifies the target of the command, usually the name of
  19261. the filter class or a specific filter instance name. The default
  19262. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19263. but you can override this by using the @samp{filter_name@@id} syntax
  19264. (see @ref{Filtergraph syntax}).
  19265. @var{COMMAND} specifies the name of the command for the target filter.
  19266. @var{ARG} is optional and specifies the optional argument list for the
  19267. given @var{COMMAND}.
  19268. Upon reception, the message is processed and the corresponding command
  19269. is injected into the filtergraph. Depending on the result, the filter
  19270. will send a reply to the client, adopting the format:
  19271. @example
  19272. @var{ERROR_CODE} @var{ERROR_REASON}
  19273. @var{MESSAGE}
  19274. @end example
  19275. @var{MESSAGE} is optional.
  19276. @subsection Examples
  19277. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19278. be used to send commands processed by these filters.
  19279. Consider the following filtergraph generated by @command{ffplay}.
  19280. In this example the last overlay filter has an instance name. All other
  19281. filters will have default instance names.
  19282. @example
  19283. ffplay -dumpgraph 1 -f lavfi "
  19284. color=s=100x100:c=red [l];
  19285. color=s=100x100:c=blue [r];
  19286. nullsrc=s=200x100, zmq [bg];
  19287. [bg][l] overlay [bg+l];
  19288. [bg+l][r] overlay@@my=x=100 "
  19289. @end example
  19290. To change the color of the left side of the video, the following
  19291. command can be used:
  19292. @example
  19293. echo Parsed_color_0 c yellow | tools/zmqsend
  19294. @end example
  19295. To change the right side:
  19296. @example
  19297. echo Parsed_color_1 c pink | tools/zmqsend
  19298. @end example
  19299. To change the position of the right side:
  19300. @example
  19301. echo overlay@@my x 150 | tools/zmqsend
  19302. @end example
  19303. @c man end MULTIMEDIA FILTERS
  19304. @chapter Multimedia Sources
  19305. @c man begin MULTIMEDIA SOURCES
  19306. Below is a description of the currently available multimedia sources.
  19307. @section amovie
  19308. This is the same as @ref{movie} source, except it selects an audio
  19309. stream by default.
  19310. @anchor{movie}
  19311. @section movie
  19312. Read audio and/or video stream(s) from a movie container.
  19313. It accepts the following parameters:
  19314. @table @option
  19315. @item filename
  19316. The name of the resource to read (not necessarily a file; it can also be a
  19317. device or a stream accessed through some protocol).
  19318. @item format_name, f
  19319. Specifies the format assumed for the movie to read, and can be either
  19320. the name of a container or an input device. If not specified, the
  19321. format is guessed from @var{movie_name} or by probing.
  19322. @item seek_point, sp
  19323. Specifies the seek point in seconds. The frames will be output
  19324. starting from this seek point. The parameter is evaluated with
  19325. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19326. postfix. The default value is "0".
  19327. @item streams, s
  19328. Specifies the streams to read. Several streams can be specified,
  19329. separated by "+". The source will then have as many outputs, in the
  19330. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19331. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19332. respectively the default (best suited) video and audio stream. Default
  19333. is "dv", or "da" if the filter is called as "amovie".
  19334. @item stream_index, si
  19335. Specifies the index of the video stream to read. If the value is -1,
  19336. the most suitable video stream will be automatically selected. The default
  19337. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19338. audio instead of video.
  19339. @item loop
  19340. Specifies how many times to read the stream in sequence.
  19341. If the value is 0, the stream will be looped infinitely.
  19342. Default value is "1".
  19343. Note that when the movie is looped the source timestamps are not
  19344. changed, so it will generate non monotonically increasing timestamps.
  19345. @item discontinuity
  19346. Specifies the time difference between frames above which the point is
  19347. considered a timestamp discontinuity which is removed by adjusting the later
  19348. timestamps.
  19349. @end table
  19350. It allows overlaying a second video on top of the main input of
  19351. a filtergraph, as shown in this graph:
  19352. @example
  19353. input -----------> deltapts0 --> overlay --> output
  19354. ^
  19355. |
  19356. movie --> scale--> deltapts1 -------+
  19357. @end example
  19358. @subsection Examples
  19359. @itemize
  19360. @item
  19361. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19362. on top of the input labelled "in":
  19363. @example
  19364. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19365. [in] setpts=PTS-STARTPTS [main];
  19366. [main][over] overlay=16:16 [out]
  19367. @end example
  19368. @item
  19369. Read from a video4linux2 device, and overlay it on top of the input
  19370. labelled "in":
  19371. @example
  19372. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19373. [in] setpts=PTS-STARTPTS [main];
  19374. [main][over] overlay=16:16 [out]
  19375. @end example
  19376. @item
  19377. Read the first video stream and the audio stream with id 0x81 from
  19378. dvd.vob; the video is connected to the pad named "video" and the audio is
  19379. connected to the pad named "audio":
  19380. @example
  19381. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19382. @end example
  19383. @end itemize
  19384. @subsection Commands
  19385. Both movie and amovie support the following commands:
  19386. @table @option
  19387. @item seek
  19388. Perform seek using "av_seek_frame".
  19389. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19390. @itemize
  19391. @item
  19392. @var{stream_index}: If stream_index is -1, a default
  19393. stream is selected, and @var{timestamp} is automatically converted
  19394. from AV_TIME_BASE units to the stream specific time_base.
  19395. @item
  19396. @var{timestamp}: Timestamp in AVStream.time_base units
  19397. or, if no stream is specified, in AV_TIME_BASE units.
  19398. @item
  19399. @var{flags}: Flags which select direction and seeking mode.
  19400. @end itemize
  19401. @item get_duration
  19402. Get movie duration in AV_TIME_BASE units.
  19403. @end table
  19404. @c man end MULTIMEDIA SOURCES