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.

26169 lines
696KB

  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 adenorm
  570. Remedy denormals in audio by adding extremely low-level noise.
  571. A description of the accepted parameters follows.
  572. @table @option
  573. @item level
  574. Set level of added noise in dB. Default is @code{-351}.
  575. Allowed range is from -451 to -90.
  576. @item type
  577. Set type of added noise.
  578. @table @option
  579. @item dc
  580. Add DC signal.
  581. @item ac
  582. Add AC signal.
  583. @item square
  584. Add square signal.
  585. @item pulse
  586. Add pulse signal.
  587. @end table
  588. Default is @code{dc}.
  589. @end table
  590. @section aderivative, aintegral
  591. Compute derivative/integral of audio stream.
  592. Applying both filters one after another produces original audio.
  593. @section aecho
  594. Apply echoing to the input audio.
  595. Echoes are reflected sound and can occur naturally amongst mountains
  596. (and sometimes large buildings) when talking or shouting; digital echo
  597. effects emulate this behaviour and are often used to help fill out the
  598. sound of a single instrument or vocal. The time difference between the
  599. original signal and the reflection is the @code{delay}, and the
  600. loudness of the reflected signal is the @code{decay}.
  601. Multiple echoes can have different delays and decays.
  602. A description of the accepted parameters follows.
  603. @table @option
  604. @item in_gain
  605. Set input gain of reflected signal. Default is @code{0.6}.
  606. @item out_gain
  607. Set output gain of reflected signal. Default is @code{0.3}.
  608. @item delays
  609. Set list of time intervals in milliseconds between original signal and reflections
  610. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  611. Default is @code{1000}.
  612. @item decays
  613. Set list of loudness of reflected signals separated by '|'.
  614. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  615. Default is @code{0.5}.
  616. @end table
  617. @subsection Examples
  618. @itemize
  619. @item
  620. Make it sound as if there are twice as many instruments as are actually playing:
  621. @example
  622. aecho=0.8:0.88:60:0.4
  623. @end example
  624. @item
  625. If delay is very short, then it sounds like a (metallic) robot playing music:
  626. @example
  627. aecho=0.8:0.88:6:0.4
  628. @end example
  629. @item
  630. A longer delay will sound like an open air concert in the mountains:
  631. @example
  632. aecho=0.8:0.9:1000:0.3
  633. @end example
  634. @item
  635. Same as above but with one more mountain:
  636. @example
  637. aecho=0.8:0.9:1000|1800:0.3|0.25
  638. @end example
  639. @end itemize
  640. @section aemphasis
  641. Audio emphasis filter creates or restores material directly taken from LPs or
  642. emphased CDs with different filter curves. E.g. to store music on vinyl the
  643. signal has to be altered by a filter first to even out the disadvantages of
  644. this recording medium.
  645. Once the material is played back the inverse filter has to be applied to
  646. restore the distortion of the frequency response.
  647. The filter accepts the following options:
  648. @table @option
  649. @item level_in
  650. Set input gain.
  651. @item level_out
  652. Set output gain.
  653. @item mode
  654. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  655. use @code{production} mode. Default is @code{reproduction} mode.
  656. @item type
  657. Set filter type. Selects medium. Can be one of the following:
  658. @table @option
  659. @item col
  660. select Columbia.
  661. @item emi
  662. select EMI.
  663. @item bsi
  664. select BSI (78RPM).
  665. @item riaa
  666. select RIAA.
  667. @item cd
  668. select Compact Disc (CD).
  669. @item 50fm
  670. select 50µs (FM).
  671. @item 75fm
  672. select 75µs (FM).
  673. @item 50kf
  674. select 50µs (FM-KF).
  675. @item 75kf
  676. select 75µs (FM-KF).
  677. @end table
  678. @end table
  679. @section aeval
  680. Modify an audio signal according to the specified expressions.
  681. This filter accepts one or more expressions (one for each channel),
  682. which are evaluated and used to modify a corresponding audio signal.
  683. It accepts the following parameters:
  684. @table @option
  685. @item exprs
  686. Set the '|'-separated expressions list for each separate channel. If
  687. the number of input channels is greater than the number of
  688. expressions, the last specified expression is used for the remaining
  689. output channels.
  690. @item channel_layout, c
  691. Set output channel layout. If not specified, the channel layout is
  692. specified by the number of expressions. If set to @samp{same}, it will
  693. use by default the same input channel layout.
  694. @end table
  695. Each expression in @var{exprs} can contain the following constants and functions:
  696. @table @option
  697. @item ch
  698. channel number of the current expression
  699. @item n
  700. number of the evaluated sample, starting from 0
  701. @item s
  702. sample rate
  703. @item t
  704. time of the evaluated sample expressed in seconds
  705. @item nb_in_channels
  706. @item nb_out_channels
  707. input and output number of channels
  708. @item val(CH)
  709. the value of input channel with number @var{CH}
  710. @end table
  711. Note: this filter is slow. For faster processing you should use a
  712. dedicated filter.
  713. @subsection Examples
  714. @itemize
  715. @item
  716. Half volume:
  717. @example
  718. aeval=val(ch)/2:c=same
  719. @end example
  720. @item
  721. Invert phase of the second channel:
  722. @example
  723. aeval=val(0)|-val(1)
  724. @end example
  725. @end itemize
  726. @anchor{afade}
  727. @section afade
  728. Apply fade-in/out effect to input audio.
  729. A description of the accepted parameters follows.
  730. @table @option
  731. @item type, t
  732. Specify the effect type, can be either @code{in} for fade-in, or
  733. @code{out} for a fade-out effect. Default is @code{in}.
  734. @item start_sample, ss
  735. Specify the number of the start sample for starting to apply the fade
  736. effect. Default is 0.
  737. @item nb_samples, ns
  738. Specify the number of samples for which the fade effect has to last. At
  739. the end of the fade-in effect the output audio will have the same
  740. volume as the input audio, at the end of the fade-out transition
  741. the output audio will be silence. Default is 44100.
  742. @item start_time, st
  743. Specify the start time of the fade effect. Default is 0.
  744. The value must be specified as a time duration; see
  745. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  746. for the accepted syntax.
  747. If set this option is used instead of @var{start_sample}.
  748. @item duration, d
  749. Specify the duration of the fade effect. See
  750. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  751. for the accepted syntax.
  752. At the end of the fade-in effect the output audio will have the same
  753. volume as the input audio, at the end of the fade-out transition
  754. the output audio will be silence.
  755. By default the duration is determined by @var{nb_samples}.
  756. If set this option is used instead of @var{nb_samples}.
  757. @item curve
  758. Set curve for fade transition.
  759. It accepts the following values:
  760. @table @option
  761. @item tri
  762. select triangular, linear slope (default)
  763. @item qsin
  764. select quarter of sine wave
  765. @item hsin
  766. select half of sine wave
  767. @item esin
  768. select exponential sine wave
  769. @item log
  770. select logarithmic
  771. @item ipar
  772. select inverted parabola
  773. @item qua
  774. select quadratic
  775. @item cub
  776. select cubic
  777. @item squ
  778. select square root
  779. @item cbr
  780. select cubic root
  781. @item par
  782. select parabola
  783. @item exp
  784. select exponential
  785. @item iqsin
  786. select inverted quarter of sine wave
  787. @item ihsin
  788. select inverted half of sine wave
  789. @item dese
  790. select double-exponential seat
  791. @item desi
  792. select double-exponential sigmoid
  793. @item losi
  794. select logistic sigmoid
  795. @item nofade
  796. no fade applied
  797. @end table
  798. @end table
  799. @subsection Examples
  800. @itemize
  801. @item
  802. Fade in first 15 seconds of audio:
  803. @example
  804. afade=t=in:ss=0:d=15
  805. @end example
  806. @item
  807. Fade out last 25 seconds of a 900 seconds audio:
  808. @example
  809. afade=t=out:st=875:d=25
  810. @end example
  811. @end itemize
  812. @section afftdn
  813. Denoise audio samples with FFT.
  814. A description of the accepted parameters follows.
  815. @table @option
  816. @item nr
  817. Set the noise reduction in dB, allowed range is 0.01 to 97.
  818. Default value is 12 dB.
  819. @item nf
  820. Set the noise floor in dB, allowed range is -80 to -20.
  821. Default value is -50 dB.
  822. @item nt
  823. Set the noise type.
  824. It accepts the following values:
  825. @table @option
  826. @item w
  827. Select white noise.
  828. @item v
  829. Select vinyl noise.
  830. @item s
  831. Select shellac noise.
  832. @item c
  833. Select custom noise, defined in @code{bn} option.
  834. Default value is white noise.
  835. @end table
  836. @item bn
  837. Set custom band noise for every one of 15 bands.
  838. Bands are separated by ' ' or '|'.
  839. @item rf
  840. Set the residual floor in dB, allowed range is -80 to -20.
  841. Default value is -38 dB.
  842. @item tn
  843. Enable noise tracking. By default is disabled.
  844. With this enabled, noise floor is automatically adjusted.
  845. @item tr
  846. Enable residual tracking. By default is disabled.
  847. @item om
  848. Set the output mode.
  849. It accepts the following values:
  850. @table @option
  851. @item i
  852. Pass input unchanged.
  853. @item o
  854. Pass noise filtered out.
  855. @item n
  856. Pass only noise.
  857. Default value is @var{o}.
  858. @end table
  859. @end table
  860. @subsection Commands
  861. This filter supports the following commands:
  862. @table @option
  863. @item sample_noise, sn
  864. Start or stop measuring noise profile.
  865. Syntax for the command is : "start" or "stop" string.
  866. After measuring noise profile is stopped it will be
  867. automatically applied in filtering.
  868. @item noise_reduction, nr
  869. Change noise reduction. Argument is single float number.
  870. Syntax for the command is : "@var{noise_reduction}"
  871. @item noise_floor, nf
  872. Change noise floor. Argument is single float number.
  873. Syntax for the command is : "@var{noise_floor}"
  874. @item output_mode, om
  875. Change output mode operation.
  876. Syntax for the command is : "i", "o" or "n" string.
  877. @end table
  878. @section afftfilt
  879. Apply arbitrary expressions to samples in frequency domain.
  880. @table @option
  881. @item real
  882. Set frequency domain real expression for each separate channel separated
  883. by '|'. Default is "re".
  884. If the number of input channels is greater than the number of
  885. expressions, the last specified expression is used for the remaining
  886. output channels.
  887. @item imag
  888. Set frequency domain imaginary expression for each separate channel
  889. separated by '|'. Default is "im".
  890. Each expression in @var{real} and @var{imag} can contain the following
  891. constants and functions:
  892. @table @option
  893. @item sr
  894. sample rate
  895. @item b
  896. current frequency bin number
  897. @item nb
  898. number of available bins
  899. @item ch
  900. channel number of the current expression
  901. @item chs
  902. number of channels
  903. @item pts
  904. current frame pts
  905. @item re
  906. current real part of frequency bin of current channel
  907. @item im
  908. current imaginary part of frequency bin of current channel
  909. @item real(b, ch)
  910. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  911. @item imag(b, ch)
  912. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  913. @end table
  914. @item win_size
  915. Set window size. Allowed range is from 16 to 131072.
  916. Default is @code{4096}
  917. @item win_func
  918. Set window function. Default is @code{hann}.
  919. @item overlap
  920. Set window overlap. If set to 1, the recommended overlap for selected
  921. window function will be picked. Default is @code{0.75}.
  922. @end table
  923. @subsection Examples
  924. @itemize
  925. @item
  926. Leave almost only low frequencies in audio:
  927. @example
  928. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  929. @end example
  930. @item
  931. Apply robotize effect:
  932. @example
  933. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  934. @end example
  935. @item
  936. Apply whisper effect:
  937. @example
  938. 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"
  939. @end example
  940. @end itemize
  941. @anchor{afir}
  942. @section afir
  943. Apply an arbitrary Finite Impulse Response filter.
  944. This filter is designed for applying long FIR filters,
  945. up to 60 seconds long.
  946. It can be used as component for digital crossover filters,
  947. room equalization, cross talk cancellation, wavefield synthesis,
  948. auralization, ambiophonics, ambisonics and spatialization.
  949. This filter uses the streams higher than first one as FIR coefficients.
  950. If the non-first stream holds a single channel, it will be used
  951. for all input channels in the first stream, otherwise
  952. the number of channels in the non-first stream must be same as
  953. the number of channels in the first stream.
  954. It accepts the following parameters:
  955. @table @option
  956. @item dry
  957. Set dry gain. This sets input gain.
  958. @item wet
  959. Set wet gain. This sets final output gain.
  960. @item length
  961. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  962. @item gtype
  963. Enable applying gain measured from power of IR.
  964. Set which approach to use for auto gain measurement.
  965. @table @option
  966. @item none
  967. Do not apply any gain.
  968. @item peak
  969. select peak gain, very conservative approach. This is default value.
  970. @item dc
  971. select DC gain, limited application.
  972. @item gn
  973. select gain to noise approach, this is most popular one.
  974. @end table
  975. @item irgain
  976. Set gain to be applied to IR coefficients before filtering.
  977. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  978. @item irfmt
  979. Set format of IR stream. Can be @code{mono} or @code{input}.
  980. Default is @code{input}.
  981. @item maxir
  982. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  983. Allowed range is 0.1 to 60 seconds.
  984. @item response
  985. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  986. By default it is disabled.
  987. @item channel
  988. Set for which IR channel to display frequency response. By default is first channel
  989. displayed. This option is used only when @var{response} is enabled.
  990. @item size
  991. Set video stream size. This option is used only when @var{response} is enabled.
  992. @item rate
  993. Set video stream frame rate. This option is used only when @var{response} is enabled.
  994. @item minp
  995. Set minimal partition size used for convolution. Default is @var{8192}.
  996. Allowed range is from @var{1} to @var{32768}.
  997. Lower values decreases latency at cost of higher CPU usage.
  998. @item maxp
  999. Set maximal partition size used for convolution. Default is @var{8192}.
  1000. Allowed range is from @var{8} to @var{32768}.
  1001. Lower values may increase CPU usage.
  1002. @item nbirs
  1003. Set number of input impulse responses streams which will be switchable at runtime.
  1004. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1005. @item ir
  1006. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1007. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1008. This option can be changed at runtime via @ref{commands}.
  1009. @end table
  1010. @subsection Examples
  1011. @itemize
  1012. @item
  1013. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1014. @example
  1015. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1016. @end example
  1017. @end itemize
  1018. @anchor{aformat}
  1019. @section aformat
  1020. Set output format constraints for the input audio. The framework will
  1021. negotiate the most appropriate format to minimize conversions.
  1022. It accepts the following parameters:
  1023. @table @option
  1024. @item sample_fmts, f
  1025. A '|'-separated list of requested sample formats.
  1026. @item sample_rates, r
  1027. A '|'-separated list of requested sample rates.
  1028. @item channel_layouts, cl
  1029. A '|'-separated list of requested channel layouts.
  1030. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1031. for the required syntax.
  1032. @end table
  1033. If a parameter is omitted, all values are allowed.
  1034. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1035. @example
  1036. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1037. @end example
  1038. @section afreqshift
  1039. Apply frequency shift to input audio samples.
  1040. The filter accepts the following options:
  1041. @table @option
  1042. @item shift
  1043. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1044. Default value is 0.0.
  1045. @end table
  1046. @subsection Commands
  1047. This filter supports the above option as @ref{commands}.
  1048. @section agate
  1049. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1050. processing reduces disturbing noise between useful signals.
  1051. Gating is done by detecting the volume below a chosen level @var{threshold}
  1052. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1053. floor is set via @var{range}. Because an exact manipulation of the signal
  1054. would cause distortion of the waveform the reduction can be levelled over
  1055. time. This is done by setting @var{attack} and @var{release}.
  1056. @var{attack} determines how long the signal has to fall below the threshold
  1057. before any reduction will occur and @var{release} sets the time the signal
  1058. has to rise above the threshold to reduce the reduction again.
  1059. Shorter signals than the chosen attack time will be left untouched.
  1060. @table @option
  1061. @item level_in
  1062. Set input level before filtering.
  1063. Default is 1. Allowed range is from 0.015625 to 64.
  1064. @item mode
  1065. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1066. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1067. will be amplified, expanding dynamic range in upward direction.
  1068. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1069. @item range
  1070. Set the level of gain reduction when the signal is below the threshold.
  1071. Default is 0.06125. Allowed range is from 0 to 1.
  1072. Setting this to 0 disables reduction and then filter behaves like expander.
  1073. @item threshold
  1074. If a signal rises above this level the gain reduction is released.
  1075. Default is 0.125. Allowed range is from 0 to 1.
  1076. @item ratio
  1077. Set a ratio by which the signal is reduced.
  1078. Default is 2. Allowed range is from 1 to 9000.
  1079. @item attack
  1080. Amount of milliseconds the signal has to rise above the threshold before gain
  1081. reduction stops.
  1082. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1083. @item release
  1084. Amount of milliseconds the signal has to fall below the threshold before the
  1085. reduction is increased again. Default is 250 milliseconds.
  1086. Allowed range is from 0.01 to 9000.
  1087. @item makeup
  1088. Set amount of amplification of signal after processing.
  1089. Default is 1. Allowed range is from 1 to 64.
  1090. @item knee
  1091. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1092. Default is 2.828427125. Allowed range is from 1 to 8.
  1093. @item detection
  1094. Choose if exact signal should be taken for detection or an RMS like one.
  1095. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1096. @item link
  1097. Choose if the average level between all channels or the louder channel affects
  1098. the reduction.
  1099. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1100. @end table
  1101. @section aiir
  1102. Apply an arbitrary Infinite Impulse Response filter.
  1103. It accepts the following parameters:
  1104. @table @option
  1105. @item zeros, z
  1106. Set numerator/zeros coefficients.
  1107. @item poles, p
  1108. Set denominator/poles coefficients.
  1109. @item gains, k
  1110. Set channels gains.
  1111. @item dry_gain
  1112. Set input gain.
  1113. @item wet_gain
  1114. Set output gain.
  1115. @item format, f
  1116. Set coefficients format.
  1117. @table @samp
  1118. @item sf
  1119. analog transfer function
  1120. @item tf
  1121. digital transfer function
  1122. @item zp
  1123. Z-plane zeros/poles, cartesian (default)
  1124. @item pr
  1125. Z-plane zeros/poles, polar radians
  1126. @item pd
  1127. Z-plane zeros/poles, polar degrees
  1128. @item sp
  1129. S-plane zeros/poles
  1130. @end table
  1131. @item process, r
  1132. Set type of processing.
  1133. @table @samp
  1134. @item d
  1135. direct processing
  1136. @item s
  1137. serial processing
  1138. @item p
  1139. parallel processing
  1140. @end table
  1141. @item precision, e
  1142. Set filtering precision.
  1143. @table @samp
  1144. @item dbl
  1145. double-precision floating-point (default)
  1146. @item flt
  1147. single-precision floating-point
  1148. @item i32
  1149. 32-bit integers
  1150. @item i16
  1151. 16-bit integers
  1152. @end table
  1153. @item normalize, n
  1154. Normalize filter coefficients, by default is enabled.
  1155. Enabling it will normalize magnitude response at DC to 0dB.
  1156. @item mix
  1157. How much to use filtered signal in output. Default is 1.
  1158. Range is between 0 and 1.
  1159. @item response
  1160. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1161. By default it is disabled.
  1162. @item channel
  1163. Set for which IR channel to display frequency response. By default is first channel
  1164. displayed. This option is used only when @var{response} is enabled.
  1165. @item size
  1166. Set video stream size. This option is used only when @var{response} is enabled.
  1167. @end table
  1168. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1169. order.
  1170. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1171. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1172. imaginary unit.
  1173. Different coefficients and gains can be provided for every channel, in such case
  1174. use '|' to separate coefficients or gains. Last provided coefficients will be
  1175. used for all remaining channels.
  1176. @subsection Examples
  1177. @itemize
  1178. @item
  1179. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1180. @example
  1181. 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
  1182. @end example
  1183. @item
  1184. Same as above but in @code{zp} format:
  1185. @example
  1186. 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
  1187. @end example
  1188. @item
  1189. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1190. @example
  1191. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1192. @end example
  1193. @end itemize
  1194. @section alimiter
  1195. The limiter prevents an input signal from rising over a desired threshold.
  1196. This limiter uses lookahead technology to prevent your signal from distorting.
  1197. It means that there is a small delay after the signal is processed. Keep in mind
  1198. that the delay it produces is the attack time you set.
  1199. The filter accepts the following options:
  1200. @table @option
  1201. @item level_in
  1202. Set input gain. Default is 1.
  1203. @item level_out
  1204. Set output gain. Default is 1.
  1205. @item limit
  1206. Don't let signals above this level pass the limiter. Default is 1.
  1207. @item attack
  1208. The limiter will reach its attenuation level in this amount of time in
  1209. milliseconds. Default is 5 milliseconds.
  1210. @item release
  1211. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1212. Default is 50 milliseconds.
  1213. @item asc
  1214. When gain reduction is always needed ASC takes care of releasing to an
  1215. average reduction level rather than reaching a reduction of 0 in the release
  1216. time.
  1217. @item asc_level
  1218. Select how much the release time is affected by ASC, 0 means nearly no changes
  1219. in release time while 1 produces higher release times.
  1220. @item level
  1221. Auto level output signal. Default is enabled.
  1222. This normalizes audio back to 0dB if enabled.
  1223. @end table
  1224. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1225. with @ref{aresample} before applying this filter.
  1226. @section allpass
  1227. Apply a two-pole all-pass filter with central frequency (in Hz)
  1228. @var{frequency}, and filter-width @var{width}.
  1229. An all-pass filter changes the audio's frequency to phase relationship
  1230. without changing its frequency to amplitude relationship.
  1231. The filter accepts the following options:
  1232. @table @option
  1233. @item frequency, f
  1234. Set frequency in Hz.
  1235. @item width_type, t
  1236. Set method to specify band-width of filter.
  1237. @table @option
  1238. @item h
  1239. Hz
  1240. @item q
  1241. Q-Factor
  1242. @item o
  1243. octave
  1244. @item s
  1245. slope
  1246. @item k
  1247. kHz
  1248. @end table
  1249. @item width, w
  1250. Specify the band-width of a filter in width_type units.
  1251. @item mix, m
  1252. How much to use filtered signal in output. Default is 1.
  1253. Range is between 0 and 1.
  1254. @item channels, c
  1255. Specify which channels to filter, by default all available are filtered.
  1256. @item normalize, n
  1257. Normalize biquad coefficients, by default is disabled.
  1258. Enabling it will normalize magnitude response at DC to 0dB.
  1259. @item order, o
  1260. Set the filter order, can be 1 or 2. Default is 2.
  1261. @item transform, a
  1262. Set transform type of IIR filter.
  1263. @table @option
  1264. @item di
  1265. @item dii
  1266. @item tdii
  1267. @item latt
  1268. @end table
  1269. @end table
  1270. @subsection Commands
  1271. This filter supports the following commands:
  1272. @table @option
  1273. @item frequency, f
  1274. Change allpass frequency.
  1275. Syntax for the command is : "@var{frequency}"
  1276. @item width_type, t
  1277. Change allpass width_type.
  1278. Syntax for the command is : "@var{width_type}"
  1279. @item width, w
  1280. Change allpass width.
  1281. Syntax for the command is : "@var{width}"
  1282. @item mix, m
  1283. Change allpass mix.
  1284. Syntax for the command is : "@var{mix}"
  1285. @end table
  1286. @section aloop
  1287. Loop audio samples.
  1288. The filter accepts the following options:
  1289. @table @option
  1290. @item loop
  1291. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1292. Default is 0.
  1293. @item size
  1294. Set maximal number of samples. Default is 0.
  1295. @item start
  1296. Set first sample of loop. Default is 0.
  1297. @end table
  1298. @anchor{amerge}
  1299. @section amerge
  1300. Merge two or more audio streams into a single multi-channel stream.
  1301. The filter accepts the following options:
  1302. @table @option
  1303. @item inputs
  1304. Set the number of inputs. Default is 2.
  1305. @end table
  1306. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1307. the channel layout of the output will be set accordingly and the channels
  1308. will be reordered as necessary. If the channel layouts of the inputs are not
  1309. disjoint, the output will have all the channels of the first input then all
  1310. the channels of the second input, in that order, and the channel layout of
  1311. the output will be the default value corresponding to the total number of
  1312. channels.
  1313. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1314. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1315. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1316. first input, b1 is the first channel of the second input).
  1317. On the other hand, if both input are in stereo, the output channels will be
  1318. in the default order: a1, a2, b1, b2, and the channel layout will be
  1319. arbitrarily set to 4.0, which may or may not be the expected value.
  1320. All inputs must have the same sample rate, and format.
  1321. If inputs do not have the same duration, the output will stop with the
  1322. shortest.
  1323. @subsection Examples
  1324. @itemize
  1325. @item
  1326. Merge two mono files into a stereo stream:
  1327. @example
  1328. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1329. @end example
  1330. @item
  1331. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1332. @example
  1333. 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
  1334. @end example
  1335. @end itemize
  1336. @section amix
  1337. Mixes multiple audio inputs into a single output.
  1338. Note that this filter only supports float samples (the @var{amerge}
  1339. and @var{pan} audio filters support many formats). If the @var{amix}
  1340. input has integer samples then @ref{aresample} will be automatically
  1341. inserted to perform the conversion to float samples.
  1342. For example
  1343. @example
  1344. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1345. @end example
  1346. will mix 3 input audio streams to a single output with the same duration as the
  1347. first input and a dropout transition time of 3 seconds.
  1348. It accepts the following parameters:
  1349. @table @option
  1350. @item inputs
  1351. The number of inputs. If unspecified, it defaults to 2.
  1352. @item duration
  1353. How to determine the end-of-stream.
  1354. @table @option
  1355. @item longest
  1356. The duration of the longest input. (default)
  1357. @item shortest
  1358. The duration of the shortest input.
  1359. @item first
  1360. The duration of the first input.
  1361. @end table
  1362. @item dropout_transition
  1363. The transition time, in seconds, for volume renormalization when an input
  1364. stream ends. The default value is 2 seconds.
  1365. @item weights
  1366. Specify weight of each input audio stream as sequence.
  1367. Each weight is separated by space. By default all inputs have same weight.
  1368. @end table
  1369. @subsection Commands
  1370. This filter supports the following commands:
  1371. @table @option
  1372. @item weights
  1373. Syntax is same as option with same name.
  1374. @end table
  1375. @section amultiply
  1376. Multiply first audio stream with second audio stream and store result
  1377. in output audio stream. Multiplication is done by multiplying each
  1378. sample from first stream with sample at same position from second stream.
  1379. With this element-wise multiplication one can create amplitude fades and
  1380. amplitude modulations.
  1381. @section anequalizer
  1382. High-order parametric multiband equalizer for each channel.
  1383. It accepts the following parameters:
  1384. @table @option
  1385. @item params
  1386. This option string is in format:
  1387. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1388. Each equalizer band is separated by '|'.
  1389. @table @option
  1390. @item chn
  1391. Set channel number to which equalization will be applied.
  1392. If input doesn't have that channel the entry is ignored.
  1393. @item f
  1394. Set central frequency for band.
  1395. If input doesn't have that frequency the entry is ignored.
  1396. @item w
  1397. Set band width in hertz.
  1398. @item g
  1399. Set band gain in dB.
  1400. @item t
  1401. Set filter type for band, optional, can be:
  1402. @table @samp
  1403. @item 0
  1404. Butterworth, this is default.
  1405. @item 1
  1406. Chebyshev type 1.
  1407. @item 2
  1408. Chebyshev type 2.
  1409. @end table
  1410. @end table
  1411. @item curves
  1412. With this option activated frequency response of anequalizer is displayed
  1413. in video stream.
  1414. @item size
  1415. Set video stream size. Only useful if curves option is activated.
  1416. @item mgain
  1417. Set max gain that will be displayed. Only useful if curves option is activated.
  1418. Setting this to a reasonable value makes it possible to display gain which is derived from
  1419. neighbour bands which are too close to each other and thus produce higher gain
  1420. when both are activated.
  1421. @item fscale
  1422. Set frequency scale used to draw frequency response in video output.
  1423. Can be linear or logarithmic. Default is logarithmic.
  1424. @item colors
  1425. Set color for each channel curve which is going to be displayed in video stream.
  1426. This is list of color names separated by space or by '|'.
  1427. Unrecognised or missing colors will be replaced by white color.
  1428. @end table
  1429. @subsection Examples
  1430. @itemize
  1431. @item
  1432. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1433. for first 2 channels using Chebyshev type 1 filter:
  1434. @example
  1435. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1436. @end example
  1437. @end itemize
  1438. @subsection Commands
  1439. This filter supports the following commands:
  1440. @table @option
  1441. @item change
  1442. Alter existing filter parameters.
  1443. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1444. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1445. error is returned.
  1446. @var{freq} set new frequency parameter.
  1447. @var{width} set new width parameter in herz.
  1448. @var{gain} set new gain parameter in dB.
  1449. Full filter invocation with asendcmd may look like this:
  1450. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1451. @end table
  1452. @section anlmdn
  1453. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1454. Each sample is adjusted by looking for other samples with similar contexts. This
  1455. context similarity is defined by comparing their surrounding patches of size
  1456. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1457. The filter accepts the following options:
  1458. @table @option
  1459. @item s
  1460. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1461. @item p
  1462. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1463. Default value is 2 milliseconds.
  1464. @item r
  1465. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1466. Default value is 6 milliseconds.
  1467. @item o
  1468. Set the output mode.
  1469. It accepts the following values:
  1470. @table @option
  1471. @item i
  1472. Pass input unchanged.
  1473. @item o
  1474. Pass noise filtered out.
  1475. @item n
  1476. Pass only noise.
  1477. Default value is @var{o}.
  1478. @end table
  1479. @item m
  1480. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1481. @end table
  1482. @subsection Commands
  1483. This filter supports the following commands:
  1484. @table @option
  1485. @item s
  1486. Change denoise strength. Argument is single float number.
  1487. Syntax for the command is : "@var{s}"
  1488. @item o
  1489. Change output mode.
  1490. Syntax for the command is : "i", "o" or "n" string.
  1491. @end table
  1492. @section anlms
  1493. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1494. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1495. relate to producing the least mean square of the error signal (difference between the desired,
  1496. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1497. A description of the accepted options follows.
  1498. @table @option
  1499. @item order
  1500. Set filter order.
  1501. @item mu
  1502. Set filter mu.
  1503. @item eps
  1504. Set the filter eps.
  1505. @item leakage
  1506. Set the filter leakage.
  1507. @item out_mode
  1508. It accepts the following values:
  1509. @table @option
  1510. @item i
  1511. Pass the 1st input.
  1512. @item d
  1513. Pass the 2nd input.
  1514. @item o
  1515. Pass filtered samples.
  1516. @item n
  1517. Pass difference between desired and filtered samples.
  1518. Default value is @var{o}.
  1519. @end table
  1520. @end table
  1521. @subsection Examples
  1522. @itemize
  1523. @item
  1524. One of many usages of this filter is noise reduction, input audio is filtered
  1525. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1526. @example
  1527. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1528. @end example
  1529. @end itemize
  1530. @subsection Commands
  1531. This filter supports the same commands as options, excluding option @code{order}.
  1532. @section anull
  1533. Pass the audio source unchanged to the output.
  1534. @section apad
  1535. Pad the end of an audio stream with silence.
  1536. This can be used together with @command{ffmpeg} @option{-shortest} to
  1537. extend audio streams to the same length as the video stream.
  1538. A description of the accepted options follows.
  1539. @table @option
  1540. @item packet_size
  1541. Set silence packet size. Default value is 4096.
  1542. @item pad_len
  1543. Set the number of samples of silence to add to the end. After the
  1544. value is reached, the stream is terminated. This option is mutually
  1545. exclusive with @option{whole_len}.
  1546. @item whole_len
  1547. Set the minimum total number of samples in the output audio stream. If
  1548. the value is longer than the input audio length, silence is added to
  1549. the end, until the value is reached. This option is mutually exclusive
  1550. with @option{pad_len}.
  1551. @item pad_dur
  1552. Specify the duration of samples of silence to add. See
  1553. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1554. for the accepted syntax. Used only if set to non-zero value.
  1555. @item whole_dur
  1556. Specify the minimum total duration in the output audio stream. See
  1557. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1558. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1559. the input audio length, silence is added to the end, until the value is reached.
  1560. This option is mutually exclusive with @option{pad_dur}
  1561. @end table
  1562. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1563. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1564. the input stream indefinitely.
  1565. @subsection Examples
  1566. @itemize
  1567. @item
  1568. Add 1024 samples of silence to the end of the input:
  1569. @example
  1570. apad=pad_len=1024
  1571. @end example
  1572. @item
  1573. Make sure the audio output will contain at least 10000 samples, pad
  1574. the input with silence if required:
  1575. @example
  1576. apad=whole_len=10000
  1577. @end example
  1578. @item
  1579. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1580. video stream will always result the shortest and will be converted
  1581. until the end in the output file when using the @option{shortest}
  1582. option:
  1583. @example
  1584. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1585. @end example
  1586. @end itemize
  1587. @section aphaser
  1588. Add a phasing effect to the input audio.
  1589. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1590. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1591. A description of the accepted parameters follows.
  1592. @table @option
  1593. @item in_gain
  1594. Set input gain. Default is 0.4.
  1595. @item out_gain
  1596. Set output gain. Default is 0.74
  1597. @item delay
  1598. Set delay in milliseconds. Default is 3.0.
  1599. @item decay
  1600. Set decay. Default is 0.4.
  1601. @item speed
  1602. Set modulation speed in Hz. Default is 0.5.
  1603. @item type
  1604. Set modulation type. Default is triangular.
  1605. It accepts the following values:
  1606. @table @samp
  1607. @item triangular, t
  1608. @item sinusoidal, s
  1609. @end table
  1610. @end table
  1611. @section aphaseshift
  1612. Apply phase shift to input audio samples.
  1613. The filter accepts the following options:
  1614. @table @option
  1615. @item shift
  1616. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1617. Default value is 0.0.
  1618. @end table
  1619. @subsection Commands
  1620. This filter supports the above option as @ref{commands}.
  1621. @section apulsator
  1622. Audio pulsator is something between an autopanner and a tremolo.
  1623. But it can produce funny stereo effects as well. Pulsator changes the volume
  1624. of the left and right channel based on a LFO (low frequency oscillator) with
  1625. different waveforms and shifted phases.
  1626. This filter have the ability to define an offset between left and right
  1627. channel. An offset of 0 means that both LFO shapes match each other.
  1628. The left and right channel are altered equally - a conventional tremolo.
  1629. An offset of 50% means that the shape of the right channel is exactly shifted
  1630. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1631. an autopanner. At 1 both curves match again. Every setting in between moves the
  1632. phase shift gapless between all stages and produces some "bypassing" sounds with
  1633. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1634. the 0.5) the faster the signal passes from the left to the right speaker.
  1635. The filter accepts the following options:
  1636. @table @option
  1637. @item level_in
  1638. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1639. @item level_out
  1640. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1641. @item mode
  1642. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1643. sawup or sawdown. Default is sine.
  1644. @item amount
  1645. Set modulation. Define how much of original signal is affected by the LFO.
  1646. @item offset_l
  1647. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1648. @item offset_r
  1649. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1650. @item width
  1651. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1652. @item timing
  1653. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1654. @item bpm
  1655. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1656. is set to bpm.
  1657. @item ms
  1658. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1659. is set to ms.
  1660. @item hz
  1661. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1662. if timing is set to hz.
  1663. @end table
  1664. @anchor{aresample}
  1665. @section aresample
  1666. Resample the input audio to the specified parameters, using the
  1667. libswresample library. If none are specified then the filter will
  1668. automatically convert between its input and output.
  1669. This filter is also able to stretch/squeeze the audio data to make it match
  1670. the timestamps or to inject silence / cut out audio to make it match the
  1671. timestamps, do a combination of both or do neither.
  1672. The filter accepts the syntax
  1673. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1674. expresses a sample rate and @var{resampler_options} is a list of
  1675. @var{key}=@var{value} pairs, separated by ":". See the
  1676. @ref{Resampler Options,,"Resampler Options" section in the
  1677. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1678. for the complete list of supported options.
  1679. @subsection Examples
  1680. @itemize
  1681. @item
  1682. Resample the input audio to 44100Hz:
  1683. @example
  1684. aresample=44100
  1685. @end example
  1686. @item
  1687. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1688. samples per second compensation:
  1689. @example
  1690. aresample=async=1000
  1691. @end example
  1692. @end itemize
  1693. @section areverse
  1694. Reverse an audio clip.
  1695. Warning: This filter requires memory to buffer the entire clip, so trimming
  1696. is suggested.
  1697. @subsection Examples
  1698. @itemize
  1699. @item
  1700. Take the first 5 seconds of a clip, and reverse it.
  1701. @example
  1702. atrim=end=5,areverse
  1703. @end example
  1704. @end itemize
  1705. @section arnndn
  1706. Reduce noise from speech using Recurrent Neural Networks.
  1707. This filter accepts the following options:
  1708. @table @option
  1709. @item model, m
  1710. Set train model file to load. This option is always required.
  1711. @end table
  1712. @section asetnsamples
  1713. Set the number of samples per each output audio frame.
  1714. The last output packet may contain a different number of samples, as
  1715. the filter will flush all the remaining samples when the input audio
  1716. signals its end.
  1717. The filter accepts the following options:
  1718. @table @option
  1719. @item nb_out_samples, n
  1720. Set the number of frames per each output audio frame. The number is
  1721. intended as the number of samples @emph{per each channel}.
  1722. Default value is 1024.
  1723. @item pad, p
  1724. If set to 1, the filter will pad the last audio frame with zeroes, so
  1725. that the last frame will contain the same number of samples as the
  1726. previous ones. Default value is 1.
  1727. @end table
  1728. For example, to set the number of per-frame samples to 1234 and
  1729. disable padding for the last frame, use:
  1730. @example
  1731. asetnsamples=n=1234:p=0
  1732. @end example
  1733. @section asetrate
  1734. Set the sample rate without altering the PCM data.
  1735. This will result in a change of speed and pitch.
  1736. The filter accepts the following options:
  1737. @table @option
  1738. @item sample_rate, r
  1739. Set the output sample rate. Default is 44100 Hz.
  1740. @end table
  1741. @section ashowinfo
  1742. Show a line containing various information for each input audio frame.
  1743. The input audio is not modified.
  1744. The shown line contains a sequence of key/value pairs of the form
  1745. @var{key}:@var{value}.
  1746. The following values are shown in the output:
  1747. @table @option
  1748. @item n
  1749. The (sequential) number of the input frame, starting from 0.
  1750. @item pts
  1751. The presentation timestamp of the input frame, in time base units; the time base
  1752. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1753. @item pts_time
  1754. The presentation timestamp of the input frame in seconds.
  1755. @item pos
  1756. position of the frame in the input stream, -1 if this information in
  1757. unavailable and/or meaningless (for example in case of synthetic audio)
  1758. @item fmt
  1759. The sample format.
  1760. @item chlayout
  1761. The channel layout.
  1762. @item rate
  1763. The sample rate for the audio frame.
  1764. @item nb_samples
  1765. The number of samples (per channel) in the frame.
  1766. @item checksum
  1767. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1768. audio, the data is treated as if all the planes were concatenated.
  1769. @item plane_checksums
  1770. A list of Adler-32 checksums for each data plane.
  1771. @end table
  1772. @section asoftclip
  1773. Apply audio soft clipping.
  1774. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1775. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1776. This filter accepts the following options:
  1777. @table @option
  1778. @item type
  1779. Set type of soft-clipping.
  1780. It accepts the following values:
  1781. @table @option
  1782. @item hard
  1783. @item tanh
  1784. @item atan
  1785. @item cubic
  1786. @item exp
  1787. @item alg
  1788. @item quintic
  1789. @item sin
  1790. @item erf
  1791. @end table
  1792. @item param
  1793. Set additional parameter which controls sigmoid function.
  1794. @item oversample
  1795. Set oversampling factor.
  1796. @end table
  1797. @subsection Commands
  1798. This filter supports the all above options as @ref{commands}.
  1799. @section asr
  1800. Automatic Speech Recognition
  1801. This filter uses PocketSphinx for speech recognition. To enable
  1802. compilation of this filter, you need to configure FFmpeg with
  1803. @code{--enable-pocketsphinx}.
  1804. It accepts the following options:
  1805. @table @option
  1806. @item rate
  1807. Set sampling rate of input audio. Defaults is @code{16000}.
  1808. This need to match speech models, otherwise one will get poor results.
  1809. @item hmm
  1810. Set dictionary containing acoustic model files.
  1811. @item dict
  1812. Set pronunciation dictionary.
  1813. @item lm
  1814. Set language model file.
  1815. @item lmctl
  1816. Set language model set.
  1817. @item lmname
  1818. Set which language model to use.
  1819. @item logfn
  1820. Set output for log messages.
  1821. @end table
  1822. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1823. @anchor{astats}
  1824. @section astats
  1825. Display time domain statistical information about the audio channels.
  1826. Statistics are calculated and displayed for each audio channel and,
  1827. where applicable, an overall figure is also given.
  1828. It accepts the following option:
  1829. @table @option
  1830. @item length
  1831. Short window length in seconds, used for peak and trough RMS measurement.
  1832. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1833. @item metadata
  1834. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1835. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1836. disabled.
  1837. Available keys for each channel are:
  1838. DC_offset
  1839. Min_level
  1840. Max_level
  1841. Min_difference
  1842. Max_difference
  1843. Mean_difference
  1844. RMS_difference
  1845. Peak_level
  1846. RMS_peak
  1847. RMS_trough
  1848. Crest_factor
  1849. Flat_factor
  1850. Peak_count
  1851. Noise_floor
  1852. Noise_floor_count
  1853. Bit_depth
  1854. Dynamic_range
  1855. Zero_crossings
  1856. Zero_crossings_rate
  1857. Number_of_NaNs
  1858. Number_of_Infs
  1859. Number_of_denormals
  1860. and for Overall:
  1861. DC_offset
  1862. Min_level
  1863. Max_level
  1864. Min_difference
  1865. Max_difference
  1866. Mean_difference
  1867. RMS_difference
  1868. Peak_level
  1869. RMS_level
  1870. RMS_peak
  1871. RMS_trough
  1872. Flat_factor
  1873. Peak_count
  1874. Noise_floor
  1875. Noise_floor_count
  1876. Bit_depth
  1877. Number_of_samples
  1878. Number_of_NaNs
  1879. Number_of_Infs
  1880. Number_of_denormals
  1881. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1882. this @code{lavfi.astats.Overall.Peak_count}.
  1883. For description what each key means read below.
  1884. @item reset
  1885. Set number of frame after which stats are going to be recalculated.
  1886. Default is disabled.
  1887. @item measure_perchannel
  1888. Select the entries which need to be measured per channel. The metadata keys can
  1889. be used as flags, default is @option{all} which measures everything.
  1890. @option{none} disables all per channel measurement.
  1891. @item measure_overall
  1892. Select the entries which need to be measured overall. The metadata keys can
  1893. be used as flags, default is @option{all} which measures everything.
  1894. @option{none} disables all overall measurement.
  1895. @end table
  1896. A description of each shown parameter follows:
  1897. @table @option
  1898. @item DC offset
  1899. Mean amplitude displacement from zero.
  1900. @item Min level
  1901. Minimal sample level.
  1902. @item Max level
  1903. Maximal sample level.
  1904. @item Min difference
  1905. Minimal difference between two consecutive samples.
  1906. @item Max difference
  1907. Maximal difference between two consecutive samples.
  1908. @item Mean difference
  1909. Mean difference between two consecutive samples.
  1910. The average of each difference between two consecutive samples.
  1911. @item RMS difference
  1912. Root Mean Square difference between two consecutive samples.
  1913. @item Peak level dB
  1914. @item RMS level dB
  1915. Standard peak and RMS level measured in dBFS.
  1916. @item RMS peak dB
  1917. @item RMS trough dB
  1918. Peak and trough values for RMS level measured over a short window.
  1919. @item Crest factor
  1920. Standard ratio of peak to RMS level (note: not in dB).
  1921. @item Flat factor
  1922. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1923. (i.e. either @var{Min level} or @var{Max level}).
  1924. @item Peak count
  1925. Number of occasions (not the number of samples) that the signal attained either
  1926. @var{Min level} or @var{Max level}.
  1927. @item Noise floor dB
  1928. Minimum local peak measured in dBFS over a short window.
  1929. @item Noise floor count
  1930. Number of occasions (not the number of samples) that the signal attained
  1931. @var{Noise floor}.
  1932. @item Bit depth
  1933. Overall bit depth of audio. Number of bits used for each sample.
  1934. @item Dynamic range
  1935. Measured dynamic range of audio in dB.
  1936. @item Zero crossings
  1937. Number of points where the waveform crosses the zero level axis.
  1938. @item Zero crossings rate
  1939. Rate of Zero crossings and number of audio samples.
  1940. @end table
  1941. @section asubboost
  1942. Boost subwoofer frequencies.
  1943. The filter accepts the following options:
  1944. @table @option
  1945. @item dry
  1946. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  1947. Default value is 0.5.
  1948. @item wet
  1949. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  1950. Default value is 0.8.
  1951. @item decay
  1952. Set delay line decay gain value. Allowed range is from 0 to 1.
  1953. Default value is 0.7.
  1954. @item feedback
  1955. Set delay line feedback gain value. Allowed range is from 0 to 1.
  1956. Default value is 0.5.
  1957. @item cutoff
  1958. Set cutoff frequency in herz. Allowed range is 50 to 900.
  1959. Default value is 100.
  1960. @item slope
  1961. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  1962. Default value is 0.5.
  1963. @item delay
  1964. Set delay. Allowed range is from 1 to 100.
  1965. Default value is 20.
  1966. @end table
  1967. @subsection Commands
  1968. This filter supports the all above options as @ref{commands}.
  1969. @section atempo
  1970. Adjust audio tempo.
  1971. The filter accepts exactly one parameter, the audio tempo. If not
  1972. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1973. be in the [0.5, 100.0] range.
  1974. Note that tempo greater than 2 will skip some samples rather than
  1975. blend them in. If for any reason this is a concern it is always
  1976. possible to daisy-chain several instances of atempo to achieve the
  1977. desired product tempo.
  1978. @subsection Examples
  1979. @itemize
  1980. @item
  1981. Slow down audio to 80% tempo:
  1982. @example
  1983. atempo=0.8
  1984. @end example
  1985. @item
  1986. To speed up audio to 300% tempo:
  1987. @example
  1988. atempo=3
  1989. @end example
  1990. @item
  1991. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1992. @example
  1993. atempo=sqrt(3),atempo=sqrt(3)
  1994. @end example
  1995. @end itemize
  1996. @subsection Commands
  1997. This filter supports the following commands:
  1998. @table @option
  1999. @item tempo
  2000. Change filter tempo scale factor.
  2001. Syntax for the command is : "@var{tempo}"
  2002. @end table
  2003. @section atrim
  2004. Trim the input so that the output contains one continuous subpart of the input.
  2005. It accepts the following parameters:
  2006. @table @option
  2007. @item start
  2008. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2009. sample with the timestamp @var{start} will be the first sample in the output.
  2010. @item end
  2011. Specify time of the first audio sample that will be dropped, i.e. the
  2012. audio sample immediately preceding the one with the timestamp @var{end} will be
  2013. the last sample in the output.
  2014. @item start_pts
  2015. Same as @var{start}, except this option sets the start timestamp in samples
  2016. instead of seconds.
  2017. @item end_pts
  2018. Same as @var{end}, except this option sets the end timestamp in samples instead
  2019. of seconds.
  2020. @item duration
  2021. The maximum duration of the output in seconds.
  2022. @item start_sample
  2023. The number of the first sample that should be output.
  2024. @item end_sample
  2025. The number of the first sample that should be dropped.
  2026. @end table
  2027. @option{start}, @option{end}, and @option{duration} are expressed as time
  2028. duration specifications; see
  2029. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2030. Note that the first two sets of the start/end options and the @option{duration}
  2031. option look at the frame timestamp, while the _sample options simply count the
  2032. samples that pass through the filter. So start/end_pts and start/end_sample will
  2033. give different results when the timestamps are wrong, inexact or do not start at
  2034. zero. Also note that this filter does not modify the timestamps. If you wish
  2035. to have the output timestamps start at zero, insert the asetpts filter after the
  2036. atrim filter.
  2037. If multiple start or end options are set, this filter tries to be greedy and
  2038. keep all samples that match at least one of the specified constraints. To keep
  2039. only the part that matches all the constraints at once, chain multiple atrim
  2040. filters.
  2041. The defaults are such that all the input is kept. So it is possible to set e.g.
  2042. just the end values to keep everything before the specified time.
  2043. Examples:
  2044. @itemize
  2045. @item
  2046. Drop everything except the second minute of input:
  2047. @example
  2048. ffmpeg -i INPUT -af atrim=60:120
  2049. @end example
  2050. @item
  2051. Keep only the first 1000 samples:
  2052. @example
  2053. ffmpeg -i INPUT -af atrim=end_sample=1000
  2054. @end example
  2055. @end itemize
  2056. @section axcorrelate
  2057. Calculate normalized cross-correlation between two input audio streams.
  2058. Resulted samples are always between -1 and 1 inclusive.
  2059. If result is 1 it means two input samples are highly correlated in that selected segment.
  2060. Result 0 means they are not correlated at all.
  2061. If result is -1 it means two input samples are out of phase, which means they cancel each
  2062. other.
  2063. The filter accepts the following options:
  2064. @table @option
  2065. @item size
  2066. Set size of segment over which cross-correlation is calculated.
  2067. Default is 256. Allowed range is from 2 to 131072.
  2068. @item algo
  2069. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2070. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2071. are always zero and thus need much less calculations to make.
  2072. This is generally not true, but is valid for typical audio streams.
  2073. @end table
  2074. @subsection Examples
  2075. @itemize
  2076. @item
  2077. Calculate correlation between channels in stereo audio stream:
  2078. @example
  2079. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2080. @end example
  2081. @end itemize
  2082. @section bandpass
  2083. Apply a two-pole Butterworth band-pass filter with central
  2084. frequency @var{frequency}, and (3dB-point) band-width width.
  2085. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2086. instead of the default: constant 0dB peak gain.
  2087. The filter roll off at 6dB per octave (20dB per decade).
  2088. The filter accepts the following options:
  2089. @table @option
  2090. @item frequency, f
  2091. Set the filter's central frequency. Default is @code{3000}.
  2092. @item csg
  2093. Constant skirt gain if set to 1. Defaults to 0.
  2094. @item width_type, t
  2095. Set method to specify band-width of filter.
  2096. @table @option
  2097. @item h
  2098. Hz
  2099. @item q
  2100. Q-Factor
  2101. @item o
  2102. octave
  2103. @item s
  2104. slope
  2105. @item k
  2106. kHz
  2107. @end table
  2108. @item width, w
  2109. Specify the band-width of a filter in width_type units.
  2110. @item mix, m
  2111. How much to use filtered signal in output. Default is 1.
  2112. Range is between 0 and 1.
  2113. @item channels, c
  2114. Specify which channels to filter, by default all available are filtered.
  2115. @item normalize, n
  2116. Normalize biquad coefficients, by default is disabled.
  2117. Enabling it will normalize magnitude response at DC to 0dB.
  2118. @item transform, a
  2119. Set transform type of IIR filter.
  2120. @table @option
  2121. @item di
  2122. @item dii
  2123. @item tdii
  2124. @item latt
  2125. @end table
  2126. @end table
  2127. @subsection Commands
  2128. This filter supports the following commands:
  2129. @table @option
  2130. @item frequency, f
  2131. Change bandpass frequency.
  2132. Syntax for the command is : "@var{frequency}"
  2133. @item width_type, t
  2134. Change bandpass width_type.
  2135. Syntax for the command is : "@var{width_type}"
  2136. @item width, w
  2137. Change bandpass width.
  2138. Syntax for the command is : "@var{width}"
  2139. @item mix, m
  2140. Change bandpass mix.
  2141. Syntax for the command is : "@var{mix}"
  2142. @end table
  2143. @section bandreject
  2144. Apply a two-pole Butterworth band-reject filter with central
  2145. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2146. The filter roll off at 6dB per octave (20dB per decade).
  2147. The filter accepts the following options:
  2148. @table @option
  2149. @item frequency, f
  2150. Set the filter's central frequency. Default is @code{3000}.
  2151. @item width_type, t
  2152. Set method to specify band-width of filter.
  2153. @table @option
  2154. @item h
  2155. Hz
  2156. @item q
  2157. Q-Factor
  2158. @item o
  2159. octave
  2160. @item s
  2161. slope
  2162. @item k
  2163. kHz
  2164. @end table
  2165. @item width, w
  2166. Specify the band-width of a filter in width_type units.
  2167. @item mix, m
  2168. How much to use filtered signal in output. Default is 1.
  2169. Range is between 0 and 1.
  2170. @item channels, c
  2171. Specify which channels to filter, by default all available are filtered.
  2172. @item normalize, n
  2173. Normalize biquad coefficients, by default is disabled.
  2174. Enabling it will normalize magnitude response at DC to 0dB.
  2175. @item transform, a
  2176. Set transform type of IIR filter.
  2177. @table @option
  2178. @item di
  2179. @item dii
  2180. @item tdii
  2181. @item latt
  2182. @end table
  2183. @end table
  2184. @subsection Commands
  2185. This filter supports the following commands:
  2186. @table @option
  2187. @item frequency, f
  2188. Change bandreject frequency.
  2189. Syntax for the command is : "@var{frequency}"
  2190. @item width_type, t
  2191. Change bandreject width_type.
  2192. Syntax for the command is : "@var{width_type}"
  2193. @item width, w
  2194. Change bandreject width.
  2195. Syntax for the command is : "@var{width}"
  2196. @item mix, m
  2197. Change bandreject mix.
  2198. Syntax for the command is : "@var{mix}"
  2199. @end table
  2200. @section bass, lowshelf
  2201. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2202. shelving filter with a response similar to that of a standard
  2203. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2204. The filter accepts the following options:
  2205. @table @option
  2206. @item gain, g
  2207. Give the gain at 0 Hz. Its useful range is about -20
  2208. (for a large cut) to +20 (for a large boost).
  2209. Beware of clipping when using a positive gain.
  2210. @item frequency, f
  2211. Set the filter's central frequency and so can be used
  2212. to extend or reduce the frequency range to be boosted or cut.
  2213. The default value is @code{100} Hz.
  2214. @item width_type, t
  2215. Set method to specify band-width of filter.
  2216. @table @option
  2217. @item h
  2218. Hz
  2219. @item q
  2220. Q-Factor
  2221. @item o
  2222. octave
  2223. @item s
  2224. slope
  2225. @item k
  2226. kHz
  2227. @end table
  2228. @item width, w
  2229. Determine how steep is the filter's shelf transition.
  2230. @item mix, m
  2231. How much to use filtered signal in output. Default is 1.
  2232. Range is between 0 and 1.
  2233. @item channels, c
  2234. Specify which channels to filter, by default all available are filtered.
  2235. @item normalize, n
  2236. Normalize biquad coefficients, by default is disabled.
  2237. Enabling it will normalize magnitude response at DC to 0dB.
  2238. @item transform, a
  2239. Set transform type of IIR filter.
  2240. @table @option
  2241. @item di
  2242. @item dii
  2243. @item tdii
  2244. @item latt
  2245. @end table
  2246. @end table
  2247. @subsection Commands
  2248. This filter supports the following commands:
  2249. @table @option
  2250. @item frequency, f
  2251. Change bass frequency.
  2252. Syntax for the command is : "@var{frequency}"
  2253. @item width_type, t
  2254. Change bass width_type.
  2255. Syntax for the command is : "@var{width_type}"
  2256. @item width, w
  2257. Change bass width.
  2258. Syntax for the command is : "@var{width}"
  2259. @item gain, g
  2260. Change bass gain.
  2261. Syntax for the command is : "@var{gain}"
  2262. @item mix, m
  2263. Change bass mix.
  2264. Syntax for the command is : "@var{mix}"
  2265. @end table
  2266. @section biquad
  2267. Apply a biquad IIR filter with the given coefficients.
  2268. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2269. are the numerator and denominator coefficients respectively.
  2270. and @var{channels}, @var{c} specify which channels to filter, by default all
  2271. available are filtered.
  2272. @subsection Commands
  2273. This filter supports the following commands:
  2274. @table @option
  2275. @item a0
  2276. @item a1
  2277. @item a2
  2278. @item b0
  2279. @item b1
  2280. @item b2
  2281. Change biquad parameter.
  2282. Syntax for the command is : "@var{value}"
  2283. @item mix, m
  2284. How much to use filtered signal in output. Default is 1.
  2285. Range is between 0 and 1.
  2286. @item channels, c
  2287. Specify which channels to filter, by default all available are filtered.
  2288. @item normalize, n
  2289. Normalize biquad coefficients, by default is disabled.
  2290. Enabling it will normalize magnitude response at DC to 0dB.
  2291. @item transform, a
  2292. Set transform type of IIR filter.
  2293. @table @option
  2294. @item di
  2295. @item dii
  2296. @item tdii
  2297. @item latt
  2298. @end table
  2299. @end table
  2300. @section bs2b
  2301. Bauer stereo to binaural transformation, which improves headphone listening of
  2302. stereo audio records.
  2303. To enable compilation of this filter you need to configure FFmpeg with
  2304. @code{--enable-libbs2b}.
  2305. It accepts the following parameters:
  2306. @table @option
  2307. @item profile
  2308. Pre-defined crossfeed level.
  2309. @table @option
  2310. @item default
  2311. Default level (fcut=700, feed=50).
  2312. @item cmoy
  2313. Chu Moy circuit (fcut=700, feed=60).
  2314. @item jmeier
  2315. Jan Meier circuit (fcut=650, feed=95).
  2316. @end table
  2317. @item fcut
  2318. Cut frequency (in Hz).
  2319. @item feed
  2320. Feed level (in Hz).
  2321. @end table
  2322. @section channelmap
  2323. Remap input channels to new locations.
  2324. It accepts the following parameters:
  2325. @table @option
  2326. @item map
  2327. Map channels from input to output. The argument is a '|'-separated list of
  2328. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2329. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2330. channel (e.g. FL for front left) or its index in the input channel layout.
  2331. @var{out_channel} is the name of the output channel or its index in the output
  2332. channel layout. If @var{out_channel} is not given then it is implicitly an
  2333. index, starting with zero and increasing by one for each mapping.
  2334. @item channel_layout
  2335. The channel layout of the output stream.
  2336. @end table
  2337. If no mapping is present, the filter will implicitly map input channels to
  2338. output channels, preserving indices.
  2339. @subsection Examples
  2340. @itemize
  2341. @item
  2342. For example, assuming a 5.1+downmix input MOV file,
  2343. @example
  2344. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2345. @end example
  2346. will create an output WAV file tagged as stereo from the downmix channels of
  2347. the input.
  2348. @item
  2349. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2350. @example
  2351. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2352. @end example
  2353. @end itemize
  2354. @section channelsplit
  2355. Split each channel from an input audio stream into a separate output stream.
  2356. It accepts the following parameters:
  2357. @table @option
  2358. @item channel_layout
  2359. The channel layout of the input stream. The default is "stereo".
  2360. @item channels
  2361. A channel layout describing the channels to be extracted as separate output streams
  2362. or "all" to extract each input channel as a separate stream. The default is "all".
  2363. Choosing channels not present in channel layout in the input will result in an error.
  2364. @end table
  2365. @subsection Examples
  2366. @itemize
  2367. @item
  2368. For example, assuming a stereo input MP3 file,
  2369. @example
  2370. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2371. @end example
  2372. will create an output Matroska file with two audio streams, one containing only
  2373. the left channel and the other the right channel.
  2374. @item
  2375. Split a 5.1 WAV file into per-channel files:
  2376. @example
  2377. ffmpeg -i in.wav -filter_complex
  2378. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2379. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2380. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2381. side_right.wav
  2382. @end example
  2383. @item
  2384. Extract only LFE from a 5.1 WAV file:
  2385. @example
  2386. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2387. -map '[LFE]' lfe.wav
  2388. @end example
  2389. @end itemize
  2390. @section chorus
  2391. Add a chorus effect to the audio.
  2392. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2393. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2394. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2395. The modulation depth defines the range the modulated delay is played before or after
  2396. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2397. sound tuned around the original one, like in a chorus where some vocals are slightly
  2398. off key.
  2399. It accepts the following parameters:
  2400. @table @option
  2401. @item in_gain
  2402. Set input gain. Default is 0.4.
  2403. @item out_gain
  2404. Set output gain. Default is 0.4.
  2405. @item delays
  2406. Set delays. A typical delay is around 40ms to 60ms.
  2407. @item decays
  2408. Set decays.
  2409. @item speeds
  2410. Set speeds.
  2411. @item depths
  2412. Set depths.
  2413. @end table
  2414. @subsection Examples
  2415. @itemize
  2416. @item
  2417. A single delay:
  2418. @example
  2419. chorus=0.7:0.9:55:0.4:0.25:2
  2420. @end example
  2421. @item
  2422. Two delays:
  2423. @example
  2424. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2425. @end example
  2426. @item
  2427. Fuller sounding chorus with three delays:
  2428. @example
  2429. 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
  2430. @end example
  2431. @end itemize
  2432. @section compand
  2433. Compress or expand the audio's dynamic range.
  2434. It accepts the following parameters:
  2435. @table @option
  2436. @item attacks
  2437. @item decays
  2438. A list of times in seconds for each channel over which the instantaneous level
  2439. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2440. increase of volume and @var{decays} refers to decrease of volume. For most
  2441. situations, the attack time (response to the audio getting louder) should be
  2442. shorter than the decay time, because the human ear is more sensitive to sudden
  2443. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2444. a typical value for decay is 0.8 seconds.
  2445. If specified number of attacks & decays is lower than number of channels, the last
  2446. set attack/decay will be used for all remaining channels.
  2447. @item points
  2448. A list of points for the transfer function, specified in dB relative to the
  2449. maximum possible signal amplitude. Each key points list must be defined using
  2450. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2451. @code{x0/y0 x1/y1 x2/y2 ....}
  2452. The input values must be in strictly increasing order but the transfer function
  2453. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2454. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2455. function are @code{-70/-70|-60/-20|1/0}.
  2456. @item soft-knee
  2457. Set the curve radius in dB for all joints. It defaults to 0.01.
  2458. @item gain
  2459. Set the additional gain in dB to be applied at all points on the transfer
  2460. function. This allows for easy adjustment of the overall gain.
  2461. It defaults to 0.
  2462. @item volume
  2463. Set an initial volume, in dB, to be assumed for each channel when filtering
  2464. starts. This permits the user to supply a nominal level initially, so that, for
  2465. example, a very large gain is not applied to initial signal levels before the
  2466. companding has begun to operate. A typical value for audio which is initially
  2467. quiet is -90 dB. It defaults to 0.
  2468. @item delay
  2469. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2470. delayed before being fed to the volume adjuster. Specifying a delay
  2471. approximately equal to the attack/decay times allows the filter to effectively
  2472. operate in predictive rather than reactive mode. It defaults to 0.
  2473. @end table
  2474. @subsection Examples
  2475. @itemize
  2476. @item
  2477. Make music with both quiet and loud passages suitable for listening to in a
  2478. noisy environment:
  2479. @example
  2480. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2481. @end example
  2482. Another example for audio with whisper and explosion parts:
  2483. @example
  2484. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2485. @end example
  2486. @item
  2487. A noise gate for when the noise is at a lower level than the signal:
  2488. @example
  2489. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2490. @end example
  2491. @item
  2492. Here is another noise gate, this time for when the noise is at a higher level
  2493. than the signal (making it, in some ways, similar to squelch):
  2494. @example
  2495. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2496. @end example
  2497. @item
  2498. 2:1 compression starting at -6dB:
  2499. @example
  2500. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2501. @end example
  2502. @item
  2503. 2:1 compression starting at -9dB:
  2504. @example
  2505. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2506. @end example
  2507. @item
  2508. 2:1 compression starting at -12dB:
  2509. @example
  2510. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2511. @end example
  2512. @item
  2513. 2:1 compression starting at -18dB:
  2514. @example
  2515. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2516. @end example
  2517. @item
  2518. 3:1 compression starting at -15dB:
  2519. @example
  2520. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2521. @end example
  2522. @item
  2523. Compressor/Gate:
  2524. @example
  2525. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2526. @end example
  2527. @item
  2528. Expander:
  2529. @example
  2530. 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
  2531. @end example
  2532. @item
  2533. Hard limiter at -6dB:
  2534. @example
  2535. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2536. @end example
  2537. @item
  2538. Hard limiter at -12dB:
  2539. @example
  2540. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2541. @end example
  2542. @item
  2543. Hard noise gate at -35 dB:
  2544. @example
  2545. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2546. @end example
  2547. @item
  2548. Soft limiter:
  2549. @example
  2550. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2551. @end example
  2552. @end itemize
  2553. @section compensationdelay
  2554. Compensation Delay Line is a metric based delay to compensate differing
  2555. positions of microphones or speakers.
  2556. For example, you have recorded guitar with two microphones placed in
  2557. different locations. Because the front of sound wave has fixed speed in
  2558. normal conditions, the phasing of microphones can vary and depends on
  2559. their location and interposition. The best sound mix can be achieved when
  2560. these microphones are in phase (synchronized). Note that a distance of
  2561. ~30 cm between microphones makes one microphone capture the signal in
  2562. antiphase to the other microphone. That makes the final mix sound moody.
  2563. This filter helps to solve phasing problems by adding different delays
  2564. to each microphone track and make them synchronized.
  2565. The best result can be reached when you take one track as base and
  2566. synchronize other tracks one by one with it.
  2567. Remember that synchronization/delay tolerance depends on sample rate, too.
  2568. Higher sample rates will give more tolerance.
  2569. The filter accepts the following parameters:
  2570. @table @option
  2571. @item mm
  2572. Set millimeters distance. This is compensation distance for fine tuning.
  2573. Default is 0.
  2574. @item cm
  2575. Set cm distance. This is compensation distance for tightening distance setup.
  2576. Default is 0.
  2577. @item m
  2578. Set meters distance. This is compensation distance for hard distance setup.
  2579. Default is 0.
  2580. @item dry
  2581. Set dry amount. Amount of unprocessed (dry) signal.
  2582. Default is 0.
  2583. @item wet
  2584. Set wet amount. Amount of processed (wet) signal.
  2585. Default is 1.
  2586. @item temp
  2587. Set temperature in degrees Celsius. This is the temperature of the environment.
  2588. Default is 20.
  2589. @end table
  2590. @section crossfeed
  2591. Apply headphone crossfeed filter.
  2592. Crossfeed is the process of blending the left and right channels of stereo
  2593. audio recording.
  2594. It is mainly used to reduce extreme stereo separation of low frequencies.
  2595. The intent is to produce more speaker like sound to the listener.
  2596. The filter accepts the following options:
  2597. @table @option
  2598. @item strength
  2599. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2600. This sets gain of low shelf filter for side part of stereo image.
  2601. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2602. @item range
  2603. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2604. This sets cut off frequency of low shelf filter. Default is cut off near
  2605. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2606. @item slope
  2607. Set curve slope of low shelf filter. Default is 0.5.
  2608. Allowed range is from 0.01 to 1.
  2609. @item level_in
  2610. Set input gain. Default is 0.9.
  2611. @item level_out
  2612. Set output gain. Default is 1.
  2613. @end table
  2614. @subsection Commands
  2615. This filter supports the all above options as @ref{commands}.
  2616. @section crystalizer
  2617. Simple algorithm to expand audio dynamic range.
  2618. The filter accepts the following options:
  2619. @table @option
  2620. @item i
  2621. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2622. (unchanged sound) to 10.0 (maximum effect).
  2623. @item c
  2624. Enable clipping. By default is enabled.
  2625. @end table
  2626. @subsection Commands
  2627. This filter supports the all above options as @ref{commands}.
  2628. @section dcshift
  2629. Apply a DC shift to the audio.
  2630. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2631. in the recording chain) from the audio. The effect of a DC offset is reduced
  2632. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2633. a signal has a DC offset.
  2634. @table @option
  2635. @item shift
  2636. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2637. the audio.
  2638. @item limitergain
  2639. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2640. used to prevent clipping.
  2641. @end table
  2642. @section deesser
  2643. Apply de-essing to the audio samples.
  2644. @table @option
  2645. @item i
  2646. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2647. Default is 0.
  2648. @item m
  2649. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2650. Default is 0.5.
  2651. @item f
  2652. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2653. Default is 0.5.
  2654. @item s
  2655. Set the output mode.
  2656. It accepts the following values:
  2657. @table @option
  2658. @item i
  2659. Pass input unchanged.
  2660. @item o
  2661. Pass ess filtered out.
  2662. @item e
  2663. Pass only ess.
  2664. Default value is @var{o}.
  2665. @end table
  2666. @end table
  2667. @section drmeter
  2668. Measure audio dynamic range.
  2669. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2670. is found in transition material. And anything less that 8 have very poor dynamics
  2671. and is very compressed.
  2672. The filter accepts the following options:
  2673. @table @option
  2674. @item length
  2675. Set window length in seconds used to split audio into segments of equal length.
  2676. Default is 3 seconds.
  2677. @end table
  2678. @section dynaudnorm
  2679. Dynamic Audio Normalizer.
  2680. This filter applies a certain amount of gain to the input audio in order
  2681. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2682. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2683. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2684. This allows for applying extra gain to the "quiet" sections of the audio
  2685. while avoiding distortions or clipping the "loud" sections. In other words:
  2686. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2687. sections, in the sense that the volume of each section is brought to the
  2688. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2689. this goal *without* applying "dynamic range compressing". It will retain 100%
  2690. of the dynamic range *within* each section of the audio file.
  2691. @table @option
  2692. @item framelen, f
  2693. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2694. Default is 500 milliseconds.
  2695. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2696. referred to as frames. This is required, because a peak magnitude has no
  2697. meaning for just a single sample value. Instead, we need to determine the
  2698. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2699. normalizer would simply use the peak magnitude of the complete file, the
  2700. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2701. frame. The length of a frame is specified in milliseconds. By default, the
  2702. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2703. been found to give good results with most files.
  2704. Note that the exact frame length, in number of samples, will be determined
  2705. automatically, based on the sampling rate of the individual input audio file.
  2706. @item gausssize, g
  2707. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2708. number. Default is 31.
  2709. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2710. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2711. is specified in frames, centered around the current frame. For the sake of
  2712. simplicity, this must be an odd number. Consequently, the default value of 31
  2713. takes into account the current frame, as well as the 15 preceding frames and
  2714. the 15 subsequent frames. Using a larger window results in a stronger
  2715. smoothing effect and thus in less gain variation, i.e. slower gain
  2716. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2717. effect and thus in more gain variation, i.e. faster gain adaptation.
  2718. In other words, the more you increase this value, the more the Dynamic Audio
  2719. Normalizer will behave like a "traditional" normalization filter. On the
  2720. contrary, the more you decrease this value, the more the Dynamic Audio
  2721. Normalizer will behave like a dynamic range compressor.
  2722. @item peak, p
  2723. Set the target peak value. This specifies the highest permissible magnitude
  2724. level for the normalized audio input. This filter will try to approach the
  2725. target peak magnitude as closely as possible, but at the same time it also
  2726. makes sure that the normalized signal will never exceed the peak magnitude.
  2727. A frame's maximum local gain factor is imposed directly by the target peak
  2728. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2729. It is not recommended to go above this value.
  2730. @item maxgain, m
  2731. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2732. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2733. factor for each input frame, i.e. the maximum gain factor that does not
  2734. result in clipping or distortion. The maximum gain factor is determined by
  2735. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2736. additionally bounds the frame's maximum gain factor by a predetermined
  2737. (global) maximum gain factor. This is done in order to avoid excessive gain
  2738. factors in "silent" or almost silent frames. By default, the maximum gain
  2739. factor is 10.0, For most inputs the default value should be sufficient and
  2740. it usually is not recommended to increase this value. Though, for input
  2741. with an extremely low overall volume level, it may be necessary to allow even
  2742. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2743. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2744. Instead, a "sigmoid" threshold function will be applied. This way, the
  2745. gain factors will smoothly approach the threshold value, but never exceed that
  2746. value.
  2747. @item targetrms, r
  2748. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2749. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2750. This means that the maximum local gain factor for each frame is defined
  2751. (only) by the frame's highest magnitude sample. This way, the samples can
  2752. be amplified as much as possible without exceeding the maximum signal
  2753. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2754. Normalizer can also take into account the frame's root mean square,
  2755. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2756. determine the power of a time-varying signal. It is therefore considered
  2757. that the RMS is a better approximation of the "perceived loudness" than
  2758. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2759. frames to a constant RMS value, a uniform "perceived loudness" can be
  2760. established. If a target RMS value has been specified, a frame's local gain
  2761. factor is defined as the factor that would result in exactly that RMS value.
  2762. Note, however, that the maximum local gain factor is still restricted by the
  2763. frame's highest magnitude sample, in order to prevent clipping.
  2764. @item coupling, n
  2765. Enable channels coupling. By default is enabled.
  2766. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2767. amount. This means the same gain factor will be applied to all channels, i.e.
  2768. the maximum possible gain factor is determined by the "loudest" channel.
  2769. However, in some recordings, it may happen that the volume of the different
  2770. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2771. In this case, this option can be used to disable the channel coupling. This way,
  2772. the gain factor will be determined independently for each channel, depending
  2773. only on the individual channel's highest magnitude sample. This allows for
  2774. harmonizing the volume of the different channels.
  2775. @item correctdc, c
  2776. Enable DC bias correction. By default is disabled.
  2777. An audio signal (in the time domain) is a sequence of sample values.
  2778. In the Dynamic Audio Normalizer these sample values are represented in the
  2779. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2780. audio signal, or "waveform", should be centered around the zero point.
  2781. That means if we calculate the mean value of all samples in a file, or in a
  2782. single frame, then the result should be 0.0 or at least very close to that
  2783. value. If, however, there is a significant deviation of the mean value from
  2784. 0.0, in either positive or negative direction, this is referred to as a
  2785. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2786. Audio Normalizer provides optional DC bias correction.
  2787. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2788. the mean value, or "DC correction" offset, of each input frame and subtract
  2789. that value from all of the frame's sample values which ensures those samples
  2790. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2791. boundaries, the DC correction offset values will be interpolated smoothly
  2792. between neighbouring frames.
  2793. @item altboundary, b
  2794. Enable alternative boundary mode. By default is disabled.
  2795. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2796. around each frame. This includes the preceding frames as well as the
  2797. subsequent frames. However, for the "boundary" frames, located at the very
  2798. beginning and at the very end of the audio file, not all neighbouring
  2799. frames are available. In particular, for the first few frames in the audio
  2800. file, the preceding frames are not known. And, similarly, for the last few
  2801. frames in the audio file, the subsequent frames are not known. Thus, the
  2802. question arises which gain factors should be assumed for the missing frames
  2803. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2804. to deal with this situation. The default boundary mode assumes a gain factor
  2805. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2806. "fade out" at the beginning and at the end of the input, respectively.
  2807. @item compress, s
  2808. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2809. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2810. compression. This means that signal peaks will not be pruned and thus the
  2811. full dynamic range will be retained within each local neighbourhood. However,
  2812. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2813. normalization algorithm with a more "traditional" compression.
  2814. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2815. (thresholding) function. If (and only if) the compression feature is enabled,
  2816. all input frames will be processed by a soft knee thresholding function prior
  2817. to the actual normalization process. Put simply, the thresholding function is
  2818. going to prune all samples whose magnitude exceeds a certain threshold value.
  2819. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2820. value. Instead, the threshold value will be adjusted for each individual
  2821. frame.
  2822. In general, smaller parameters result in stronger compression, and vice versa.
  2823. Values below 3.0 are not recommended, because audible distortion may appear.
  2824. @item threshold, t
  2825. Set the target threshold value. This specifies the lowest permissible
  2826. magnitude level for the audio input which will be normalized.
  2827. If input frame volume is above this value frame will be normalized.
  2828. Otherwise frame may not be normalized at all. The default value is set
  2829. to 0, which means all input frames will be normalized.
  2830. This option is mostly useful if digital noise is not wanted to be amplified.
  2831. @end table
  2832. @subsection Commands
  2833. This filter supports the all above options as @ref{commands}.
  2834. @section earwax
  2835. Make audio easier to listen to on headphones.
  2836. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2837. so that when listened to on headphones the stereo image is moved from
  2838. inside your head (standard for headphones) to outside and in front of
  2839. the listener (standard for speakers).
  2840. Ported from SoX.
  2841. @section equalizer
  2842. Apply a two-pole peaking equalisation (EQ) filter. With this
  2843. filter, the signal-level at and around a selected frequency can
  2844. be increased or decreased, whilst (unlike bandpass and bandreject
  2845. filters) that at all other frequencies is unchanged.
  2846. In order to produce complex equalisation curves, this filter can
  2847. be given several times, each with a different central frequency.
  2848. The filter accepts the following options:
  2849. @table @option
  2850. @item frequency, f
  2851. Set the filter's central frequency in Hz.
  2852. @item width_type, t
  2853. Set method to specify band-width of filter.
  2854. @table @option
  2855. @item h
  2856. Hz
  2857. @item q
  2858. Q-Factor
  2859. @item o
  2860. octave
  2861. @item s
  2862. slope
  2863. @item k
  2864. kHz
  2865. @end table
  2866. @item width, w
  2867. Specify the band-width of a filter in width_type units.
  2868. @item gain, g
  2869. Set the required gain or attenuation in dB.
  2870. Beware of clipping when using a positive gain.
  2871. @item mix, m
  2872. How much to use filtered signal in output. Default is 1.
  2873. Range is between 0 and 1.
  2874. @item channels, c
  2875. Specify which channels to filter, by default all available are filtered.
  2876. @item normalize, n
  2877. Normalize biquad coefficients, by default is disabled.
  2878. Enabling it will normalize magnitude response at DC to 0dB.
  2879. @item transform, a
  2880. Set transform type of IIR filter.
  2881. @table @option
  2882. @item di
  2883. @item dii
  2884. @item tdii
  2885. @item latt
  2886. @end table
  2887. @end table
  2888. @subsection Examples
  2889. @itemize
  2890. @item
  2891. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2892. @example
  2893. equalizer=f=1000:t=h:width=200:g=-10
  2894. @end example
  2895. @item
  2896. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2897. @example
  2898. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2899. @end example
  2900. @end itemize
  2901. @subsection Commands
  2902. This filter supports the following commands:
  2903. @table @option
  2904. @item frequency, f
  2905. Change equalizer frequency.
  2906. Syntax for the command is : "@var{frequency}"
  2907. @item width_type, t
  2908. Change equalizer width_type.
  2909. Syntax for the command is : "@var{width_type}"
  2910. @item width, w
  2911. Change equalizer width.
  2912. Syntax for the command is : "@var{width}"
  2913. @item gain, g
  2914. Change equalizer gain.
  2915. Syntax for the command is : "@var{gain}"
  2916. @item mix, m
  2917. Change equalizer mix.
  2918. Syntax for the command is : "@var{mix}"
  2919. @end table
  2920. @section extrastereo
  2921. Linearly increases the difference between left and right channels which
  2922. adds some sort of "live" effect to playback.
  2923. The filter accepts the following options:
  2924. @table @option
  2925. @item m
  2926. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2927. (average of both channels), with 1.0 sound will be unchanged, with
  2928. -1.0 left and right channels will be swapped.
  2929. @item c
  2930. Enable clipping. By default is enabled.
  2931. @end table
  2932. @subsection Commands
  2933. This filter supports the all above options as @ref{commands}.
  2934. @section firequalizer
  2935. Apply FIR Equalization using arbitrary frequency response.
  2936. The filter accepts the following option:
  2937. @table @option
  2938. @item gain
  2939. Set gain curve equation (in dB). The expression can contain variables:
  2940. @table @option
  2941. @item f
  2942. the evaluated frequency
  2943. @item sr
  2944. sample rate
  2945. @item ch
  2946. channel number, set to 0 when multichannels evaluation is disabled
  2947. @item chid
  2948. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2949. multichannels evaluation is disabled
  2950. @item chs
  2951. number of channels
  2952. @item chlayout
  2953. channel_layout, see libavutil/channel_layout.h
  2954. @end table
  2955. and functions:
  2956. @table @option
  2957. @item gain_interpolate(f)
  2958. interpolate gain on frequency f based on gain_entry
  2959. @item cubic_interpolate(f)
  2960. same as gain_interpolate, but smoother
  2961. @end table
  2962. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2963. @item gain_entry
  2964. Set gain entry for gain_interpolate function. The expression can
  2965. contain functions:
  2966. @table @option
  2967. @item entry(f, g)
  2968. store gain entry at frequency f with value g
  2969. @end table
  2970. This option is also available as command.
  2971. @item delay
  2972. Set filter delay in seconds. Higher value means more accurate.
  2973. Default is @code{0.01}.
  2974. @item accuracy
  2975. Set filter accuracy in Hz. Lower value means more accurate.
  2976. Default is @code{5}.
  2977. @item wfunc
  2978. Set window function. Acceptable values are:
  2979. @table @option
  2980. @item rectangular
  2981. rectangular window, useful when gain curve is already smooth
  2982. @item hann
  2983. hann window (default)
  2984. @item hamming
  2985. hamming window
  2986. @item blackman
  2987. blackman window
  2988. @item nuttall3
  2989. 3-terms continuous 1st derivative nuttall window
  2990. @item mnuttall3
  2991. minimum 3-terms discontinuous nuttall window
  2992. @item nuttall
  2993. 4-terms continuous 1st derivative nuttall window
  2994. @item bnuttall
  2995. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2996. @item bharris
  2997. blackman-harris window
  2998. @item tukey
  2999. tukey window
  3000. @end table
  3001. @item fixed
  3002. If enabled, use fixed number of audio samples. This improves speed when
  3003. filtering with large delay. Default is disabled.
  3004. @item multi
  3005. Enable multichannels evaluation on gain. Default is disabled.
  3006. @item zero_phase
  3007. Enable zero phase mode by subtracting timestamp to compensate delay.
  3008. Default is disabled.
  3009. @item scale
  3010. Set scale used by gain. Acceptable values are:
  3011. @table @option
  3012. @item linlin
  3013. linear frequency, linear gain
  3014. @item linlog
  3015. linear frequency, logarithmic (in dB) gain (default)
  3016. @item loglin
  3017. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3018. @item loglog
  3019. logarithmic frequency, logarithmic gain
  3020. @end table
  3021. @item dumpfile
  3022. Set file for dumping, suitable for gnuplot.
  3023. @item dumpscale
  3024. Set scale for dumpfile. Acceptable values are same with scale option.
  3025. Default is linlog.
  3026. @item fft2
  3027. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3028. Default is disabled.
  3029. @item min_phase
  3030. Enable minimum phase impulse response. Default is disabled.
  3031. @end table
  3032. @subsection Examples
  3033. @itemize
  3034. @item
  3035. lowpass at 1000 Hz:
  3036. @example
  3037. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3038. @end example
  3039. @item
  3040. lowpass at 1000 Hz with gain_entry:
  3041. @example
  3042. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3043. @end example
  3044. @item
  3045. custom equalization:
  3046. @example
  3047. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3048. @end example
  3049. @item
  3050. higher delay with zero phase to compensate delay:
  3051. @example
  3052. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3053. @end example
  3054. @item
  3055. lowpass on left channel, highpass on right channel:
  3056. @example
  3057. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3058. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3059. @end example
  3060. @end itemize
  3061. @section flanger
  3062. Apply a flanging effect to the audio.
  3063. The filter accepts the following options:
  3064. @table @option
  3065. @item delay
  3066. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3067. @item depth
  3068. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3069. @item regen
  3070. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3071. Default value is 0.
  3072. @item width
  3073. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3074. Default value is 71.
  3075. @item speed
  3076. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3077. @item shape
  3078. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3079. Default value is @var{sinusoidal}.
  3080. @item phase
  3081. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3082. Default value is 25.
  3083. @item interp
  3084. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3085. Default is @var{linear}.
  3086. @end table
  3087. @section haas
  3088. Apply Haas effect to audio.
  3089. Note that this makes most sense to apply on mono signals.
  3090. With this filter applied to mono signals it give some directionality and
  3091. stretches its stereo image.
  3092. The filter accepts the following options:
  3093. @table @option
  3094. @item level_in
  3095. Set input level. By default is @var{1}, or 0dB
  3096. @item level_out
  3097. Set output level. By default is @var{1}, or 0dB.
  3098. @item side_gain
  3099. Set gain applied to side part of signal. By default is @var{1}.
  3100. @item middle_source
  3101. Set kind of middle source. Can be one of the following:
  3102. @table @samp
  3103. @item left
  3104. Pick left channel.
  3105. @item right
  3106. Pick right channel.
  3107. @item mid
  3108. Pick middle part signal of stereo image.
  3109. @item side
  3110. Pick side part signal of stereo image.
  3111. @end table
  3112. @item middle_phase
  3113. Change middle phase. By default is disabled.
  3114. @item left_delay
  3115. Set left channel delay. By default is @var{2.05} milliseconds.
  3116. @item left_balance
  3117. Set left channel balance. By default is @var{-1}.
  3118. @item left_gain
  3119. Set left channel gain. By default is @var{1}.
  3120. @item left_phase
  3121. Change left phase. By default is disabled.
  3122. @item right_delay
  3123. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3124. @item right_balance
  3125. Set right channel balance. By default is @var{1}.
  3126. @item right_gain
  3127. Set right channel gain. By default is @var{1}.
  3128. @item right_phase
  3129. Change right phase. By default is enabled.
  3130. @end table
  3131. @section hdcd
  3132. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3133. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3134. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3135. of HDCD, and detects the Transient Filter flag.
  3136. @example
  3137. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3138. @end example
  3139. When using the filter with wav, note the default encoding for wav is 16-bit,
  3140. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3141. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3142. @example
  3143. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3144. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3145. @end example
  3146. The filter accepts the following options:
  3147. @table @option
  3148. @item disable_autoconvert
  3149. Disable any automatic format conversion or resampling in the filter graph.
  3150. @item process_stereo
  3151. Process the stereo channels together. If target_gain does not match between
  3152. channels, consider it invalid and use the last valid target_gain.
  3153. @item cdt_ms
  3154. Set the code detect timer period in ms.
  3155. @item force_pe
  3156. Always extend peaks above -3dBFS even if PE isn't signaled.
  3157. @item analyze_mode
  3158. Replace audio with a solid tone and adjust the amplitude to signal some
  3159. specific aspect of the decoding process. The output file can be loaded in
  3160. an audio editor alongside the original to aid analysis.
  3161. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3162. Modes are:
  3163. @table @samp
  3164. @item 0, off
  3165. Disabled
  3166. @item 1, lle
  3167. Gain adjustment level at each sample
  3168. @item 2, pe
  3169. Samples where peak extend occurs
  3170. @item 3, cdt
  3171. Samples where the code detect timer is active
  3172. @item 4, tgm
  3173. Samples where the target gain does not match between channels
  3174. @end table
  3175. @end table
  3176. @section headphone
  3177. Apply head-related transfer functions (HRTFs) to create virtual
  3178. loudspeakers around the user for binaural listening via headphones.
  3179. The HRIRs are provided via additional streams, for each channel
  3180. one stereo input stream is needed.
  3181. The filter accepts the following options:
  3182. @table @option
  3183. @item map
  3184. Set mapping of input streams for convolution.
  3185. The argument is a '|'-separated list of channel names in order as they
  3186. are given as additional stream inputs for filter.
  3187. This also specify number of input streams. Number of input streams
  3188. must be not less than number of channels in first stream plus one.
  3189. @item gain
  3190. Set gain applied to audio. Value is in dB. Default is 0.
  3191. @item type
  3192. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3193. processing audio in time domain which is slow.
  3194. @var{freq} is processing audio in frequency domain which is fast.
  3195. Default is @var{freq}.
  3196. @item lfe
  3197. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3198. @item size
  3199. Set size of frame in number of samples which will be processed at once.
  3200. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3201. @item hrir
  3202. Set format of hrir stream.
  3203. Default value is @var{stereo}. Alternative value is @var{multich}.
  3204. If value is set to @var{stereo}, number of additional streams should
  3205. be greater or equal to number of input channels in first input stream.
  3206. Also each additional stream should have stereo number of channels.
  3207. If value is set to @var{multich}, number of additional streams should
  3208. be exactly one. Also number of input channels of additional stream
  3209. should be equal or greater than twice number of channels of first input
  3210. stream.
  3211. @end table
  3212. @subsection Examples
  3213. @itemize
  3214. @item
  3215. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3216. each amovie filter use stereo file with IR coefficients as input.
  3217. The files give coefficients for each position of virtual loudspeaker:
  3218. @example
  3219. ffmpeg -i input.wav
  3220. -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"
  3221. output.wav
  3222. @end example
  3223. @item
  3224. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3225. but now in @var{multich} @var{hrir} format.
  3226. @example
  3227. 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"
  3228. output.wav
  3229. @end example
  3230. @end itemize
  3231. @section highpass
  3232. Apply a high-pass filter with 3dB point frequency.
  3233. The filter can be either single-pole, or double-pole (the default).
  3234. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3235. The filter accepts the following options:
  3236. @table @option
  3237. @item frequency, f
  3238. Set frequency in Hz. Default is 3000.
  3239. @item poles, p
  3240. Set number of poles. Default is 2.
  3241. @item width_type, t
  3242. Set method to specify band-width of filter.
  3243. @table @option
  3244. @item h
  3245. Hz
  3246. @item q
  3247. Q-Factor
  3248. @item o
  3249. octave
  3250. @item s
  3251. slope
  3252. @item k
  3253. kHz
  3254. @end table
  3255. @item width, w
  3256. Specify the band-width of a filter in width_type units.
  3257. Applies only to double-pole filter.
  3258. The default is 0.707q and gives a Butterworth response.
  3259. @item mix, m
  3260. How much to use filtered signal in output. Default is 1.
  3261. Range is between 0 and 1.
  3262. @item channels, c
  3263. Specify which channels to filter, by default all available are filtered.
  3264. @item normalize, n
  3265. Normalize biquad coefficients, by default is disabled.
  3266. Enabling it will normalize magnitude response at DC to 0dB.
  3267. @item transform, a
  3268. Set transform type of IIR filter.
  3269. @table @option
  3270. @item di
  3271. @item dii
  3272. @item tdii
  3273. @item latt
  3274. @end table
  3275. @end table
  3276. @subsection Commands
  3277. This filter supports the following commands:
  3278. @table @option
  3279. @item frequency, f
  3280. Change highpass frequency.
  3281. Syntax for the command is : "@var{frequency}"
  3282. @item width_type, t
  3283. Change highpass width_type.
  3284. Syntax for the command is : "@var{width_type}"
  3285. @item width, w
  3286. Change highpass width.
  3287. Syntax for the command is : "@var{width}"
  3288. @item mix, m
  3289. Change highpass mix.
  3290. Syntax for the command is : "@var{mix}"
  3291. @end table
  3292. @section join
  3293. Join multiple input streams into one multi-channel stream.
  3294. It accepts the following parameters:
  3295. @table @option
  3296. @item inputs
  3297. The number of input streams. It defaults to 2.
  3298. @item channel_layout
  3299. The desired output channel layout. It defaults to stereo.
  3300. @item map
  3301. Map channels from inputs to output. The argument is a '|'-separated list of
  3302. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3303. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3304. can be either the name of the input channel (e.g. FL for front left) or its
  3305. index in the specified input stream. @var{out_channel} is the name of the output
  3306. channel.
  3307. @end table
  3308. The filter will attempt to guess the mappings when they are not specified
  3309. explicitly. It does so by first trying to find an unused matching input channel
  3310. and if that fails it picks the first unused input channel.
  3311. Join 3 inputs (with properly set channel layouts):
  3312. @example
  3313. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3314. @end example
  3315. Build a 5.1 output from 6 single-channel streams:
  3316. @example
  3317. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3318. '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'
  3319. out
  3320. @end example
  3321. @section ladspa
  3322. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3323. To enable compilation of this filter you need to configure FFmpeg with
  3324. @code{--enable-ladspa}.
  3325. @table @option
  3326. @item file, f
  3327. Specifies the name of LADSPA plugin library to load. If the environment
  3328. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3329. each one of the directories specified by the colon separated list in
  3330. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3331. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3332. @file{/usr/lib/ladspa/}.
  3333. @item plugin, p
  3334. Specifies the plugin within the library. Some libraries contain only
  3335. one plugin, but others contain many of them. If this is not set filter
  3336. will list all available plugins within the specified library.
  3337. @item controls, c
  3338. Set the '|' separated list of controls which are zero or more floating point
  3339. values that determine the behavior of the loaded plugin (for example delay,
  3340. threshold or gain).
  3341. Controls need to be defined using the following syntax:
  3342. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3343. @var{valuei} is the value set on the @var{i}-th control.
  3344. Alternatively they can be also defined using the following syntax:
  3345. @var{value0}|@var{value1}|@var{value2}|..., where
  3346. @var{valuei} is the value set on the @var{i}-th control.
  3347. If @option{controls} is set to @code{help}, all available controls and
  3348. their valid ranges are printed.
  3349. @item sample_rate, s
  3350. Specify the sample rate, default to 44100. Only used if plugin have
  3351. zero inputs.
  3352. @item nb_samples, n
  3353. Set the number of samples per channel per each output frame, default
  3354. is 1024. Only used if plugin have zero inputs.
  3355. @item duration, d
  3356. Set the minimum duration of the sourced audio. See
  3357. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3358. for the accepted syntax.
  3359. Note that the resulting duration may be greater than the specified duration,
  3360. as the generated audio is always cut at the end of a complete frame.
  3361. If not specified, or the expressed duration is negative, the audio is
  3362. supposed to be generated forever.
  3363. Only used if plugin have zero inputs.
  3364. @item latency, l
  3365. Enable latency compensation, by default is disabled.
  3366. Only used if plugin have inputs.
  3367. @end table
  3368. @subsection Examples
  3369. @itemize
  3370. @item
  3371. List all available plugins within amp (LADSPA example plugin) library:
  3372. @example
  3373. ladspa=file=amp
  3374. @end example
  3375. @item
  3376. List all available controls and their valid ranges for @code{vcf_notch}
  3377. plugin from @code{VCF} library:
  3378. @example
  3379. ladspa=f=vcf:p=vcf_notch:c=help
  3380. @end example
  3381. @item
  3382. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3383. plugin library:
  3384. @example
  3385. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3386. @end example
  3387. @item
  3388. Add reverberation to the audio using TAP-plugins
  3389. (Tom's Audio Processing plugins):
  3390. @example
  3391. ladspa=file=tap_reverb:tap_reverb
  3392. @end example
  3393. @item
  3394. Generate white noise, with 0.2 amplitude:
  3395. @example
  3396. ladspa=file=cmt:noise_source_white:c=c0=.2
  3397. @end example
  3398. @item
  3399. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3400. @code{C* Audio Plugin Suite} (CAPS) library:
  3401. @example
  3402. ladspa=file=caps:Click:c=c1=20'
  3403. @end example
  3404. @item
  3405. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3406. @example
  3407. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3408. @end example
  3409. @item
  3410. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3411. @code{SWH Plugins} collection:
  3412. @example
  3413. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3414. @end example
  3415. @item
  3416. Attenuate low frequencies using Multiband EQ from Steve Harris
  3417. @code{SWH Plugins} collection:
  3418. @example
  3419. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3420. @end example
  3421. @item
  3422. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3423. (CAPS) library:
  3424. @example
  3425. ladspa=caps:Narrower
  3426. @end example
  3427. @item
  3428. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3429. @example
  3430. ladspa=caps:White:.2
  3431. @end example
  3432. @item
  3433. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3434. @example
  3435. ladspa=caps:Fractal:c=c1=1
  3436. @end example
  3437. @item
  3438. Dynamic volume normalization using @code{VLevel} plugin:
  3439. @example
  3440. ladspa=vlevel-ladspa:vlevel_mono
  3441. @end example
  3442. @end itemize
  3443. @subsection Commands
  3444. This filter supports the following commands:
  3445. @table @option
  3446. @item cN
  3447. Modify the @var{N}-th control value.
  3448. If the specified value is not valid, it is ignored and prior one is kept.
  3449. @end table
  3450. @section loudnorm
  3451. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3452. Support for both single pass (livestreams, files) and double pass (files) modes.
  3453. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3454. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3455. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3456. The filter accepts the following options:
  3457. @table @option
  3458. @item I, i
  3459. Set integrated loudness target.
  3460. Range is -70.0 - -5.0. Default value is -24.0.
  3461. @item LRA, lra
  3462. Set loudness range target.
  3463. Range is 1.0 - 20.0. Default value is 7.0.
  3464. @item TP, tp
  3465. Set maximum true peak.
  3466. Range is -9.0 - +0.0. Default value is -2.0.
  3467. @item measured_I, measured_i
  3468. Measured IL of input file.
  3469. Range is -99.0 - +0.0.
  3470. @item measured_LRA, measured_lra
  3471. Measured LRA of input file.
  3472. Range is 0.0 - 99.0.
  3473. @item measured_TP, measured_tp
  3474. Measured true peak of input file.
  3475. Range is -99.0 - +99.0.
  3476. @item measured_thresh
  3477. Measured threshold of input file.
  3478. Range is -99.0 - +0.0.
  3479. @item offset
  3480. Set offset gain. Gain is applied before the true-peak limiter.
  3481. Range is -99.0 - +99.0. Default is +0.0.
  3482. @item linear
  3483. Normalize by linearly scaling the source audio.
  3484. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3485. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3486. be lower than source LRA and the change in integrated loudness shouldn't
  3487. result in a true peak which exceeds the target TP. If any of these
  3488. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3489. Options are @code{true} or @code{false}. Default is @code{true}.
  3490. @item dual_mono
  3491. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3492. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3493. If set to @code{true}, this option will compensate for this effect.
  3494. Multi-channel input files are not affected by this option.
  3495. Options are true or false. Default is false.
  3496. @item print_format
  3497. Set print format for stats. Options are summary, json, or none.
  3498. Default value is none.
  3499. @end table
  3500. @section lowpass
  3501. Apply a low-pass filter with 3dB point frequency.
  3502. The filter can be either single-pole or double-pole (the default).
  3503. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3504. The filter accepts the following options:
  3505. @table @option
  3506. @item frequency, f
  3507. Set frequency in Hz. Default is 500.
  3508. @item poles, p
  3509. Set number of poles. Default is 2.
  3510. @item width_type, t
  3511. Set method to specify band-width of filter.
  3512. @table @option
  3513. @item h
  3514. Hz
  3515. @item q
  3516. Q-Factor
  3517. @item o
  3518. octave
  3519. @item s
  3520. slope
  3521. @item k
  3522. kHz
  3523. @end table
  3524. @item width, w
  3525. Specify the band-width of a filter in width_type units.
  3526. Applies only to double-pole filter.
  3527. The default is 0.707q and gives a Butterworth response.
  3528. @item mix, m
  3529. How much to use filtered signal in output. Default is 1.
  3530. Range is between 0 and 1.
  3531. @item channels, c
  3532. Specify which channels to filter, by default all available are filtered.
  3533. @item normalize, n
  3534. Normalize biquad coefficients, by default is disabled.
  3535. Enabling it will normalize magnitude response at DC to 0dB.
  3536. @item transform, a
  3537. Set transform type of IIR filter.
  3538. @table @option
  3539. @item di
  3540. @item dii
  3541. @item tdii
  3542. @item latt
  3543. @end table
  3544. @end table
  3545. @subsection Examples
  3546. @itemize
  3547. @item
  3548. Lowpass only LFE channel, it LFE is not present it does nothing:
  3549. @example
  3550. lowpass=c=LFE
  3551. @end example
  3552. @end itemize
  3553. @subsection Commands
  3554. This filter supports the following commands:
  3555. @table @option
  3556. @item frequency, f
  3557. Change lowpass frequency.
  3558. Syntax for the command is : "@var{frequency}"
  3559. @item width_type, t
  3560. Change lowpass width_type.
  3561. Syntax for the command is : "@var{width_type}"
  3562. @item width, w
  3563. Change lowpass width.
  3564. Syntax for the command is : "@var{width}"
  3565. @item mix, m
  3566. Change lowpass mix.
  3567. Syntax for the command is : "@var{mix}"
  3568. @end table
  3569. @section lv2
  3570. Load a LV2 (LADSPA Version 2) plugin.
  3571. To enable compilation of this filter you need to configure FFmpeg with
  3572. @code{--enable-lv2}.
  3573. @table @option
  3574. @item plugin, p
  3575. Specifies the plugin URI. You may need to escape ':'.
  3576. @item controls, c
  3577. Set the '|' separated list of controls which are zero or more floating point
  3578. values that determine the behavior of the loaded plugin (for example delay,
  3579. threshold or gain).
  3580. If @option{controls} is set to @code{help}, all available controls and
  3581. their valid ranges are printed.
  3582. @item sample_rate, s
  3583. Specify the sample rate, default to 44100. Only used if plugin have
  3584. zero inputs.
  3585. @item nb_samples, n
  3586. Set the number of samples per channel per each output frame, default
  3587. is 1024. Only used if plugin have zero inputs.
  3588. @item duration, d
  3589. Set the minimum duration of the sourced audio. See
  3590. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3591. for the accepted syntax.
  3592. Note that the resulting duration may be greater than the specified duration,
  3593. as the generated audio is always cut at the end of a complete frame.
  3594. If not specified, or the expressed duration is negative, the audio is
  3595. supposed to be generated forever.
  3596. Only used if plugin have zero inputs.
  3597. @end table
  3598. @subsection Examples
  3599. @itemize
  3600. @item
  3601. Apply bass enhancer plugin from Calf:
  3602. @example
  3603. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3604. @end example
  3605. @item
  3606. Apply vinyl plugin from Calf:
  3607. @example
  3608. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3609. @end example
  3610. @item
  3611. Apply bit crusher plugin from ArtyFX:
  3612. @example
  3613. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3614. @end example
  3615. @end itemize
  3616. @section mcompand
  3617. Multiband Compress or expand the audio's dynamic range.
  3618. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3619. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3620. response when absent compander action.
  3621. It accepts the following parameters:
  3622. @table @option
  3623. @item args
  3624. This option syntax is:
  3625. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3626. For explanation of each item refer to compand filter documentation.
  3627. @end table
  3628. @anchor{pan}
  3629. @section pan
  3630. Mix channels with specific gain levels. The filter accepts the output
  3631. channel layout followed by a set of channels definitions.
  3632. This filter is also designed to efficiently remap the channels of an audio
  3633. stream.
  3634. The filter accepts parameters of the form:
  3635. "@var{l}|@var{outdef}|@var{outdef}|..."
  3636. @table @option
  3637. @item l
  3638. output channel layout or number of channels
  3639. @item outdef
  3640. output channel specification, of the form:
  3641. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3642. @item out_name
  3643. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3644. number (c0, c1, etc.)
  3645. @item gain
  3646. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3647. @item in_name
  3648. input channel to use, see out_name for details; it is not possible to mix
  3649. named and numbered input channels
  3650. @end table
  3651. If the `=' in a channel specification is replaced by `<', then the gains for
  3652. that specification will be renormalized so that the total is 1, thus
  3653. avoiding clipping noise.
  3654. @subsection Mixing examples
  3655. For example, if you want to down-mix from stereo to mono, but with a bigger
  3656. factor for the left channel:
  3657. @example
  3658. pan=1c|c0=0.9*c0+0.1*c1
  3659. @end example
  3660. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3661. 7-channels surround:
  3662. @example
  3663. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3664. @end example
  3665. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3666. that should be preferred (see "-ac" option) unless you have very specific
  3667. needs.
  3668. @subsection Remapping examples
  3669. The channel remapping will be effective if, and only if:
  3670. @itemize
  3671. @item gain coefficients are zeroes or ones,
  3672. @item only one input per channel output,
  3673. @end itemize
  3674. If all these conditions are satisfied, the filter will notify the user ("Pure
  3675. channel mapping detected"), and use an optimized and lossless method to do the
  3676. remapping.
  3677. For example, if you have a 5.1 source and want a stereo audio stream by
  3678. dropping the extra channels:
  3679. @example
  3680. pan="stereo| c0=FL | c1=FR"
  3681. @end example
  3682. Given the same source, you can also switch front left and front right channels
  3683. and keep the input channel layout:
  3684. @example
  3685. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3686. @end example
  3687. If the input is a stereo audio stream, you can mute the front left channel (and
  3688. still keep the stereo channel layout) with:
  3689. @example
  3690. pan="stereo|c1=c1"
  3691. @end example
  3692. Still with a stereo audio stream input, you can copy the right channel in both
  3693. front left and right:
  3694. @example
  3695. pan="stereo| c0=FR | c1=FR"
  3696. @end example
  3697. @section replaygain
  3698. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3699. outputs it unchanged.
  3700. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3701. @section resample
  3702. Convert the audio sample format, sample rate and channel layout. It is
  3703. not meant to be used directly.
  3704. @section rubberband
  3705. Apply time-stretching and pitch-shifting with librubberband.
  3706. To enable compilation of this filter, you need to configure FFmpeg with
  3707. @code{--enable-librubberband}.
  3708. The filter accepts the following options:
  3709. @table @option
  3710. @item tempo
  3711. Set tempo scale factor.
  3712. @item pitch
  3713. Set pitch scale factor.
  3714. @item transients
  3715. Set transients detector.
  3716. Possible values are:
  3717. @table @var
  3718. @item crisp
  3719. @item mixed
  3720. @item smooth
  3721. @end table
  3722. @item detector
  3723. Set detector.
  3724. Possible values are:
  3725. @table @var
  3726. @item compound
  3727. @item percussive
  3728. @item soft
  3729. @end table
  3730. @item phase
  3731. Set phase.
  3732. Possible values are:
  3733. @table @var
  3734. @item laminar
  3735. @item independent
  3736. @end table
  3737. @item window
  3738. Set processing window size.
  3739. Possible values are:
  3740. @table @var
  3741. @item standard
  3742. @item short
  3743. @item long
  3744. @end table
  3745. @item smoothing
  3746. Set smoothing.
  3747. Possible values are:
  3748. @table @var
  3749. @item off
  3750. @item on
  3751. @end table
  3752. @item formant
  3753. Enable formant preservation when shift pitching.
  3754. Possible values are:
  3755. @table @var
  3756. @item shifted
  3757. @item preserved
  3758. @end table
  3759. @item pitchq
  3760. Set pitch quality.
  3761. Possible values are:
  3762. @table @var
  3763. @item quality
  3764. @item speed
  3765. @item consistency
  3766. @end table
  3767. @item channels
  3768. Set channels.
  3769. Possible values are:
  3770. @table @var
  3771. @item apart
  3772. @item together
  3773. @end table
  3774. @end table
  3775. @subsection Commands
  3776. This filter supports the following commands:
  3777. @table @option
  3778. @item tempo
  3779. Change filter tempo scale factor.
  3780. Syntax for the command is : "@var{tempo}"
  3781. @item pitch
  3782. Change filter pitch scale factor.
  3783. Syntax for the command is : "@var{pitch}"
  3784. @end table
  3785. @section sidechaincompress
  3786. This filter acts like normal compressor but has the ability to compress
  3787. detected signal using second input signal.
  3788. It needs two input streams and returns one output stream.
  3789. First input stream will be processed depending on second stream signal.
  3790. The filtered signal then can be filtered with other filters in later stages of
  3791. processing. See @ref{pan} and @ref{amerge} filter.
  3792. The filter accepts the following options:
  3793. @table @option
  3794. @item level_in
  3795. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3796. @item mode
  3797. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3798. Default is @code{downward}.
  3799. @item threshold
  3800. If a signal of second stream raises above this level it will affect the gain
  3801. reduction of first stream.
  3802. By default is 0.125. Range is between 0.00097563 and 1.
  3803. @item ratio
  3804. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3805. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3806. Default is 2. Range is between 1 and 20.
  3807. @item attack
  3808. Amount of milliseconds the signal has to rise above the threshold before gain
  3809. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3810. @item release
  3811. Amount of milliseconds the signal has to fall below the threshold before
  3812. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3813. @item makeup
  3814. Set the amount by how much signal will be amplified after processing.
  3815. Default is 1. Range is from 1 to 64.
  3816. @item knee
  3817. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3818. Default is 2.82843. Range is between 1 and 8.
  3819. @item link
  3820. Choose if the @code{average} level between all channels of side-chain stream
  3821. or the louder(@code{maximum}) channel of side-chain stream affects the
  3822. reduction. Default is @code{average}.
  3823. @item detection
  3824. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3825. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3826. @item level_sc
  3827. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3828. @item mix
  3829. How much to use compressed signal in output. Default is 1.
  3830. Range is between 0 and 1.
  3831. @end table
  3832. @subsection Commands
  3833. This filter supports the all above options as @ref{commands}.
  3834. @subsection Examples
  3835. @itemize
  3836. @item
  3837. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3838. depending on the signal of 2nd input and later compressed signal to be
  3839. merged with 2nd input:
  3840. @example
  3841. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3842. @end example
  3843. @end itemize
  3844. @section sidechaingate
  3845. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3846. filter the detected signal before sending it to the gain reduction stage.
  3847. Normally a gate uses the full range signal to detect a level above the
  3848. threshold.
  3849. For example: If you cut all lower frequencies from your sidechain signal
  3850. the gate will decrease the volume of your track only if not enough highs
  3851. appear. With this technique you are able to reduce the resonation of a
  3852. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3853. guitar.
  3854. It needs two input streams and returns one output stream.
  3855. First input stream will be processed depending on second stream signal.
  3856. The filter accepts the following options:
  3857. @table @option
  3858. @item level_in
  3859. Set input level before filtering.
  3860. Default is 1. Allowed range is from 0.015625 to 64.
  3861. @item mode
  3862. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3863. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3864. will be amplified, expanding dynamic range in upward direction.
  3865. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3866. @item range
  3867. Set the level of gain reduction when the signal is below the threshold.
  3868. Default is 0.06125. Allowed range is from 0 to 1.
  3869. Setting this to 0 disables reduction and then filter behaves like expander.
  3870. @item threshold
  3871. If a signal rises above this level the gain reduction is released.
  3872. Default is 0.125. Allowed range is from 0 to 1.
  3873. @item ratio
  3874. Set a ratio about which the signal is reduced.
  3875. Default is 2. Allowed range is from 1 to 9000.
  3876. @item attack
  3877. Amount of milliseconds the signal has to rise above the threshold before gain
  3878. reduction stops.
  3879. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3880. @item release
  3881. Amount of milliseconds the signal has to fall below the threshold before the
  3882. reduction is increased again. Default is 250 milliseconds.
  3883. Allowed range is from 0.01 to 9000.
  3884. @item makeup
  3885. Set amount of amplification of signal after processing.
  3886. Default is 1. Allowed range is from 1 to 64.
  3887. @item knee
  3888. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3889. Default is 2.828427125. Allowed range is from 1 to 8.
  3890. @item detection
  3891. Choose if exact signal should be taken for detection or an RMS like one.
  3892. Default is rms. Can be peak or rms.
  3893. @item link
  3894. Choose if the average level between all channels or the louder channel affects
  3895. the reduction.
  3896. Default is average. Can be average or maximum.
  3897. @item level_sc
  3898. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3899. @end table
  3900. @section silencedetect
  3901. Detect silence in an audio stream.
  3902. This filter logs a message when it detects that the input audio volume is less
  3903. or equal to a noise tolerance value for a duration greater or equal to the
  3904. minimum detected noise duration.
  3905. The printed times and duration are expressed in seconds. The
  3906. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3907. is set on the first frame whose timestamp equals or exceeds the detection
  3908. duration and it contains the timestamp of the first frame of the silence.
  3909. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3910. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3911. keys are set on the first frame after the silence. If @option{mono} is
  3912. enabled, and each channel is evaluated separately, the @code{.X}
  3913. suffixed keys are used, and @code{X} corresponds to the channel number.
  3914. The filter accepts the following options:
  3915. @table @option
  3916. @item noise, n
  3917. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3918. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3919. @item duration, d
  3920. Set silence duration until notification (default is 2 seconds). See
  3921. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3922. for the accepted syntax.
  3923. @item mono, m
  3924. Process each channel separately, instead of combined. By default is disabled.
  3925. @end table
  3926. @subsection Examples
  3927. @itemize
  3928. @item
  3929. Detect 5 seconds of silence with -50dB noise tolerance:
  3930. @example
  3931. silencedetect=n=-50dB:d=5
  3932. @end example
  3933. @item
  3934. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3935. tolerance in @file{silence.mp3}:
  3936. @example
  3937. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3938. @end example
  3939. @end itemize
  3940. @section silenceremove
  3941. Remove silence from the beginning, middle or end of the audio.
  3942. The filter accepts the following options:
  3943. @table @option
  3944. @item start_periods
  3945. This value is used to indicate if audio should be trimmed at beginning of
  3946. the audio. A value of zero indicates no silence should be trimmed from the
  3947. beginning. When specifying a non-zero value, it trims audio up until it
  3948. finds non-silence. Normally, when trimming silence from beginning of audio
  3949. the @var{start_periods} will be @code{1} but it can be increased to higher
  3950. values to trim all audio up to specific count of non-silence periods.
  3951. Default value is @code{0}.
  3952. @item start_duration
  3953. Specify the amount of time that non-silence must be detected before it stops
  3954. trimming audio. By increasing the duration, bursts of noises can be treated
  3955. as silence and trimmed off. Default value is @code{0}.
  3956. @item start_threshold
  3957. This indicates what sample value should be treated as silence. For digital
  3958. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3959. you may wish to increase the value to account for background noise.
  3960. Can be specified in dB (in case "dB" is appended to the specified value)
  3961. or amplitude ratio. Default value is @code{0}.
  3962. @item start_silence
  3963. Specify max duration of silence at beginning that will be kept after
  3964. trimming. Default is 0, which is equal to trimming all samples detected
  3965. as silence.
  3966. @item start_mode
  3967. Specify mode of detection of silence end in start of multi-channel audio.
  3968. Can be @var{any} or @var{all}. Default is @var{any}.
  3969. With @var{any}, any sample that is detected as non-silence will cause
  3970. stopped trimming of silence.
  3971. With @var{all}, only if all channels are detected as non-silence will cause
  3972. stopped trimming of silence.
  3973. @item stop_periods
  3974. Set the count for trimming silence from the end of audio.
  3975. To remove silence from the middle of a file, specify a @var{stop_periods}
  3976. that is negative. This value is then treated as a positive value and is
  3977. used to indicate the effect should restart processing as specified by
  3978. @var{start_periods}, making it suitable for removing periods of silence
  3979. in the middle of the audio.
  3980. Default value is @code{0}.
  3981. @item stop_duration
  3982. Specify a duration of silence that must exist before audio is not copied any
  3983. more. By specifying a higher duration, silence that is wanted can be left in
  3984. the audio.
  3985. Default value is @code{0}.
  3986. @item stop_threshold
  3987. This is the same as @option{start_threshold} but for trimming silence from
  3988. the end of audio.
  3989. Can be specified in dB (in case "dB" is appended to the specified value)
  3990. or amplitude ratio. Default value is @code{0}.
  3991. @item stop_silence
  3992. Specify max duration of silence at end that will be kept after
  3993. trimming. Default is 0, which is equal to trimming all samples detected
  3994. as silence.
  3995. @item stop_mode
  3996. Specify mode of detection of silence start in end of multi-channel audio.
  3997. Can be @var{any} or @var{all}. Default is @var{any}.
  3998. With @var{any}, any sample that is detected as non-silence will cause
  3999. stopped trimming of silence.
  4000. With @var{all}, only if all channels are detected as non-silence will cause
  4001. stopped trimming of silence.
  4002. @item detection
  4003. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4004. and works better with digital silence which is exactly 0.
  4005. Default value is @code{rms}.
  4006. @item window
  4007. Set duration in number of seconds used to calculate size of window in number
  4008. of samples for detecting silence.
  4009. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4010. @end table
  4011. @subsection Examples
  4012. @itemize
  4013. @item
  4014. The following example shows how this filter can be used to start a recording
  4015. that does not contain the delay at the start which usually occurs between
  4016. pressing the record button and the start of the performance:
  4017. @example
  4018. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4019. @end example
  4020. @item
  4021. Trim all silence encountered from beginning to end where there is more than 1
  4022. second of silence in audio:
  4023. @example
  4024. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4025. @end example
  4026. @item
  4027. Trim all digital silence samples, using peak detection, from beginning to end
  4028. where there is more than 0 samples of digital silence in audio and digital
  4029. silence is detected in all channels at same positions in stream:
  4030. @example
  4031. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4032. @end example
  4033. @end itemize
  4034. @section sofalizer
  4035. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4036. loudspeakers around the user for binaural listening via headphones (audio
  4037. formats up to 9 channels supported).
  4038. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4039. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4040. Austrian Academy of Sciences.
  4041. To enable compilation of this filter you need to configure FFmpeg with
  4042. @code{--enable-libmysofa}.
  4043. The filter accepts the following options:
  4044. @table @option
  4045. @item sofa
  4046. Set the SOFA file used for rendering.
  4047. @item gain
  4048. Set gain applied to audio. Value is in dB. Default is 0.
  4049. @item rotation
  4050. Set rotation of virtual loudspeakers in deg. Default is 0.
  4051. @item elevation
  4052. Set elevation of virtual speakers in deg. Default is 0.
  4053. @item radius
  4054. Set distance in meters between loudspeakers and the listener with near-field
  4055. HRTFs. Default is 1.
  4056. @item type
  4057. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4058. processing audio in time domain which is slow.
  4059. @var{freq} is processing audio in frequency domain which is fast.
  4060. Default is @var{freq}.
  4061. @item speakers
  4062. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4063. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4064. Each virtual loudspeaker is described with short channel name following with
  4065. azimuth and elevation in degrees.
  4066. Each virtual loudspeaker description is separated by '|'.
  4067. For example to override front left and front right channel positions use:
  4068. 'speakers=FL 45 15|FR 345 15'.
  4069. Descriptions with unrecognised channel names are ignored.
  4070. @item lfegain
  4071. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4072. @item framesize
  4073. Set custom frame size in number of samples. Default is 1024.
  4074. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4075. is set to @var{freq}.
  4076. @item normalize
  4077. Should all IRs be normalized upon importing SOFA file.
  4078. By default is enabled.
  4079. @item interpolate
  4080. Should nearest IRs be interpolated with neighbor IRs if exact position
  4081. does not match. By default is disabled.
  4082. @item minphase
  4083. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4084. @item anglestep
  4085. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4086. @item radstep
  4087. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4088. @end table
  4089. @subsection Examples
  4090. @itemize
  4091. @item
  4092. Using ClubFritz6 sofa file:
  4093. @example
  4094. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4095. @end example
  4096. @item
  4097. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4098. @example
  4099. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4100. @end example
  4101. @item
  4102. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4103. and also with custom gain:
  4104. @example
  4105. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4106. @end example
  4107. @end itemize
  4108. @section speechnorm
  4109. Speech Normalizer.
  4110. This filter expands or compresses each half-cycle of audio samples
  4111. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4112. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4113. The filter accepts the following options:
  4114. @table @option
  4115. @item peak, p
  4116. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4117. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4118. @item expansion, e
  4119. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4120. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4121. would be such that local peak value reaches target peak value but never to surpass it and that
  4122. ratio between new and previous peak value does not surpass this option value.
  4123. @item compression, c
  4124. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4125. This option controls maximum local half-cycle of samples compression. This option is used
  4126. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4127. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4128. that peak's half-cycle will be compressed by current compression factor.
  4129. @item threshold, t
  4130. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4131. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4132. Any half-cycle samples with their local peak value below or same as this option value will be
  4133. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4134. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4135. @item raise, r
  4136. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4137. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4138. each new half-cycle until it reaches @option{expansion} value.
  4139. Setting this options too high may lead to distortions.
  4140. @item fall, f
  4141. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4142. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4143. each new half-cycle until it reaches @option{compression} value.
  4144. @item channels, h
  4145. Specify which channels to filter, by default all available channels are filtered.
  4146. @item invert, i
  4147. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4148. option. When enabled any half-cycle of samples with their local peak value below or same as
  4149. @option{threshold} option will be expanded otherwise it will be compressed.
  4150. @item link, l
  4151. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4152. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4153. is enabled the minimum of all possible gains for each filtered channel is used.
  4154. @end table
  4155. @subsection Commands
  4156. This filter supports the all above options as @ref{commands}.
  4157. @section stereotools
  4158. This filter has some handy utilities to manage stereo signals, for converting
  4159. M/S stereo recordings to L/R signal while having control over the parameters
  4160. or spreading the stereo image of master track.
  4161. The filter accepts the following options:
  4162. @table @option
  4163. @item level_in
  4164. Set input level before filtering for both channels. Defaults is 1.
  4165. Allowed range is from 0.015625 to 64.
  4166. @item level_out
  4167. Set output level after filtering for both channels. Defaults is 1.
  4168. Allowed range is from 0.015625 to 64.
  4169. @item balance_in
  4170. Set input balance between both channels. Default is 0.
  4171. Allowed range is from -1 to 1.
  4172. @item balance_out
  4173. Set output balance between both channels. Default is 0.
  4174. Allowed range is from -1 to 1.
  4175. @item softclip
  4176. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4177. clipping. Disabled by default.
  4178. @item mutel
  4179. Mute the left channel. Disabled by default.
  4180. @item muter
  4181. Mute the right channel. Disabled by default.
  4182. @item phasel
  4183. Change the phase of the left channel. Disabled by default.
  4184. @item phaser
  4185. Change the phase of the right channel. Disabled by default.
  4186. @item mode
  4187. Set stereo mode. Available values are:
  4188. @table @samp
  4189. @item lr>lr
  4190. Left/Right to Left/Right, this is default.
  4191. @item lr>ms
  4192. Left/Right to Mid/Side.
  4193. @item ms>lr
  4194. Mid/Side to Left/Right.
  4195. @item lr>ll
  4196. Left/Right to Left/Left.
  4197. @item lr>rr
  4198. Left/Right to Right/Right.
  4199. @item lr>l+r
  4200. Left/Right to Left + Right.
  4201. @item lr>rl
  4202. Left/Right to Right/Left.
  4203. @item ms>ll
  4204. Mid/Side to Left/Left.
  4205. @item ms>rr
  4206. Mid/Side to Right/Right.
  4207. @end table
  4208. @item slev
  4209. Set level of side signal. Default is 1.
  4210. Allowed range is from 0.015625 to 64.
  4211. @item sbal
  4212. Set balance of side signal. Default is 0.
  4213. Allowed range is from -1 to 1.
  4214. @item mlev
  4215. Set level of the middle signal. Default is 1.
  4216. Allowed range is from 0.015625 to 64.
  4217. @item mpan
  4218. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4219. @item base
  4220. Set stereo base between mono and inversed channels. Default is 0.
  4221. Allowed range is from -1 to 1.
  4222. @item delay
  4223. Set delay in milliseconds how much to delay left from right channel and
  4224. vice versa. Default is 0. Allowed range is from -20 to 20.
  4225. @item sclevel
  4226. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4227. @item phase
  4228. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4229. @item bmode_in, bmode_out
  4230. Set balance mode for balance_in/balance_out option.
  4231. Can be one of the following:
  4232. @table @samp
  4233. @item balance
  4234. Classic balance mode. Attenuate one channel at time.
  4235. Gain is raised up to 1.
  4236. @item amplitude
  4237. Similar as classic mode above but gain is raised up to 2.
  4238. @item power
  4239. Equal power distribution, from -6dB to +6dB range.
  4240. @end table
  4241. @end table
  4242. @subsection Examples
  4243. @itemize
  4244. @item
  4245. Apply karaoke like effect:
  4246. @example
  4247. stereotools=mlev=0.015625
  4248. @end example
  4249. @item
  4250. Convert M/S signal to L/R:
  4251. @example
  4252. "stereotools=mode=ms>lr"
  4253. @end example
  4254. @end itemize
  4255. @section stereowiden
  4256. This filter enhance the stereo effect by suppressing signal common to both
  4257. channels and by delaying the signal of left into right and vice versa,
  4258. thereby widening the stereo effect.
  4259. The filter accepts the following options:
  4260. @table @option
  4261. @item delay
  4262. Time in milliseconds of the delay of left signal into right and vice versa.
  4263. Default is 20 milliseconds.
  4264. @item feedback
  4265. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4266. effect of left signal in right output and vice versa which gives widening
  4267. effect. Default is 0.3.
  4268. @item crossfeed
  4269. Cross feed of left into right with inverted phase. This helps in suppressing
  4270. the mono. If the value is 1 it will cancel all the signal common to both
  4271. channels. Default is 0.3.
  4272. @item drymix
  4273. Set level of input signal of original channel. Default is 0.8.
  4274. @end table
  4275. @subsection Commands
  4276. This filter supports the all above options except @code{delay} as @ref{commands}.
  4277. @section superequalizer
  4278. Apply 18 band equalizer.
  4279. The filter accepts the following options:
  4280. @table @option
  4281. @item 1b
  4282. Set 65Hz band gain.
  4283. @item 2b
  4284. Set 92Hz band gain.
  4285. @item 3b
  4286. Set 131Hz band gain.
  4287. @item 4b
  4288. Set 185Hz band gain.
  4289. @item 5b
  4290. Set 262Hz band gain.
  4291. @item 6b
  4292. Set 370Hz band gain.
  4293. @item 7b
  4294. Set 523Hz band gain.
  4295. @item 8b
  4296. Set 740Hz band gain.
  4297. @item 9b
  4298. Set 1047Hz band gain.
  4299. @item 10b
  4300. Set 1480Hz band gain.
  4301. @item 11b
  4302. Set 2093Hz band gain.
  4303. @item 12b
  4304. Set 2960Hz band gain.
  4305. @item 13b
  4306. Set 4186Hz band gain.
  4307. @item 14b
  4308. Set 5920Hz band gain.
  4309. @item 15b
  4310. Set 8372Hz band gain.
  4311. @item 16b
  4312. Set 11840Hz band gain.
  4313. @item 17b
  4314. Set 16744Hz band gain.
  4315. @item 18b
  4316. Set 20000Hz band gain.
  4317. @end table
  4318. @section surround
  4319. Apply audio surround upmix filter.
  4320. This filter allows to produce multichannel output from audio stream.
  4321. The filter accepts the following options:
  4322. @table @option
  4323. @item chl_out
  4324. Set output channel layout. By default, this is @var{5.1}.
  4325. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4326. for the required syntax.
  4327. @item chl_in
  4328. Set input channel layout. By default, this is @var{stereo}.
  4329. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4330. for the required syntax.
  4331. @item level_in
  4332. Set input volume level. By default, this is @var{1}.
  4333. @item level_out
  4334. Set output volume level. By default, this is @var{1}.
  4335. @item lfe
  4336. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4337. @item lfe_low
  4338. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4339. @item lfe_high
  4340. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4341. @item lfe_mode
  4342. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4343. In @var{add} mode, LFE channel is created from input audio and added to output.
  4344. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4345. also all non-LFE output channels are subtracted with output LFE channel.
  4346. @item angle
  4347. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4348. Default is @var{90}.
  4349. @item fc_in
  4350. Set front center input volume. By default, this is @var{1}.
  4351. @item fc_out
  4352. Set front center output volume. By default, this is @var{1}.
  4353. @item fl_in
  4354. Set front left input volume. By default, this is @var{1}.
  4355. @item fl_out
  4356. Set front left output volume. By default, this is @var{1}.
  4357. @item fr_in
  4358. Set front right input volume. By default, this is @var{1}.
  4359. @item fr_out
  4360. Set front right output volume. By default, this is @var{1}.
  4361. @item sl_in
  4362. Set side left input volume. By default, this is @var{1}.
  4363. @item sl_out
  4364. Set side left output volume. By default, this is @var{1}.
  4365. @item sr_in
  4366. Set side right input volume. By default, this is @var{1}.
  4367. @item sr_out
  4368. Set side right output volume. By default, this is @var{1}.
  4369. @item bl_in
  4370. Set back left input volume. By default, this is @var{1}.
  4371. @item bl_out
  4372. Set back left output volume. By default, this is @var{1}.
  4373. @item br_in
  4374. Set back right input volume. By default, this is @var{1}.
  4375. @item br_out
  4376. Set back right output volume. By default, this is @var{1}.
  4377. @item bc_in
  4378. Set back center input volume. By default, this is @var{1}.
  4379. @item bc_out
  4380. Set back center output volume. By default, this is @var{1}.
  4381. @item lfe_in
  4382. Set LFE input volume. By default, this is @var{1}.
  4383. @item lfe_out
  4384. Set LFE output volume. By default, this is @var{1}.
  4385. @item allx
  4386. Set spread usage of stereo image across X axis for all channels.
  4387. @item ally
  4388. Set spread usage of stereo image across Y axis for all channels.
  4389. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4390. Set spread usage of stereo image across X axis for each channel.
  4391. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4392. Set spread usage of stereo image across Y axis for each channel.
  4393. @item win_size
  4394. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4395. @item win_func
  4396. Set window function.
  4397. It accepts the following values:
  4398. @table @samp
  4399. @item rect
  4400. @item bartlett
  4401. @item hann, hanning
  4402. @item hamming
  4403. @item blackman
  4404. @item welch
  4405. @item flattop
  4406. @item bharris
  4407. @item bnuttall
  4408. @item bhann
  4409. @item sine
  4410. @item nuttall
  4411. @item lanczos
  4412. @item gauss
  4413. @item tukey
  4414. @item dolph
  4415. @item cauchy
  4416. @item parzen
  4417. @item poisson
  4418. @item bohman
  4419. @end table
  4420. Default is @code{hann}.
  4421. @item overlap
  4422. Set window overlap. If set to 1, the recommended overlap for selected
  4423. window function will be picked. Default is @code{0.5}.
  4424. @end table
  4425. @section treble, highshelf
  4426. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4427. shelving filter with a response similar to that of a standard
  4428. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4429. The filter accepts the following options:
  4430. @table @option
  4431. @item gain, g
  4432. Give the gain at whichever is the lower of ~22 kHz and the
  4433. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4434. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4435. @item frequency, f
  4436. Set the filter's central frequency and so can be used
  4437. to extend or reduce the frequency range to be boosted or cut.
  4438. The default value is @code{3000} Hz.
  4439. @item width_type, t
  4440. Set method to specify band-width of filter.
  4441. @table @option
  4442. @item h
  4443. Hz
  4444. @item q
  4445. Q-Factor
  4446. @item o
  4447. octave
  4448. @item s
  4449. slope
  4450. @item k
  4451. kHz
  4452. @end table
  4453. @item width, w
  4454. Determine how steep is the filter's shelf transition.
  4455. @item mix, m
  4456. How much to use filtered signal in output. Default is 1.
  4457. Range is between 0 and 1.
  4458. @item channels, c
  4459. Specify which channels to filter, by default all available are filtered.
  4460. @item normalize, n
  4461. Normalize biquad coefficients, by default is disabled.
  4462. Enabling it will normalize magnitude response at DC to 0dB.
  4463. @item transform, a
  4464. Set transform type of IIR filter.
  4465. @table @option
  4466. @item di
  4467. @item dii
  4468. @item tdii
  4469. @item latt
  4470. @end table
  4471. @end table
  4472. @subsection Commands
  4473. This filter supports the following commands:
  4474. @table @option
  4475. @item frequency, f
  4476. Change treble frequency.
  4477. Syntax for the command is : "@var{frequency}"
  4478. @item width_type, t
  4479. Change treble width_type.
  4480. Syntax for the command is : "@var{width_type}"
  4481. @item width, w
  4482. Change treble width.
  4483. Syntax for the command is : "@var{width}"
  4484. @item gain, g
  4485. Change treble gain.
  4486. Syntax for the command is : "@var{gain}"
  4487. @item mix, m
  4488. Change treble mix.
  4489. Syntax for the command is : "@var{mix}"
  4490. @end table
  4491. @section tremolo
  4492. Sinusoidal amplitude modulation.
  4493. The filter accepts the following options:
  4494. @table @option
  4495. @item f
  4496. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4497. (20 Hz or lower) will result in a tremolo effect.
  4498. This filter may also be used as a ring modulator by specifying
  4499. a modulation frequency higher than 20 Hz.
  4500. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4501. @item d
  4502. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4503. Default value is 0.5.
  4504. @end table
  4505. @section vibrato
  4506. Sinusoidal phase modulation.
  4507. The filter accepts the following options:
  4508. @table @option
  4509. @item f
  4510. Modulation frequency in Hertz.
  4511. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4512. @item d
  4513. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4514. Default value is 0.5.
  4515. @end table
  4516. @section volume
  4517. Adjust the input audio volume.
  4518. It accepts the following parameters:
  4519. @table @option
  4520. @item volume
  4521. Set audio volume expression.
  4522. Output values are clipped to the maximum value.
  4523. The output audio volume is given by the relation:
  4524. @example
  4525. @var{output_volume} = @var{volume} * @var{input_volume}
  4526. @end example
  4527. The default value for @var{volume} is "1.0".
  4528. @item precision
  4529. This parameter represents the mathematical precision.
  4530. It determines which input sample formats will be allowed, which affects the
  4531. precision of the volume scaling.
  4532. @table @option
  4533. @item fixed
  4534. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4535. @item float
  4536. 32-bit floating-point; this limits input sample format to FLT. (default)
  4537. @item double
  4538. 64-bit floating-point; this limits input sample format to DBL.
  4539. @end table
  4540. @item replaygain
  4541. Choose the behaviour on encountering ReplayGain side data in input frames.
  4542. @table @option
  4543. @item drop
  4544. Remove ReplayGain side data, ignoring its contents (the default).
  4545. @item ignore
  4546. Ignore ReplayGain side data, but leave it in the frame.
  4547. @item track
  4548. Prefer the track gain, if present.
  4549. @item album
  4550. Prefer the album gain, if present.
  4551. @end table
  4552. @item replaygain_preamp
  4553. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4554. Default value for @var{replaygain_preamp} is 0.0.
  4555. @item replaygain_noclip
  4556. Prevent clipping by limiting the gain applied.
  4557. Default value for @var{replaygain_noclip} is 1.
  4558. @item eval
  4559. Set when the volume expression is evaluated.
  4560. It accepts the following values:
  4561. @table @samp
  4562. @item once
  4563. only evaluate expression once during the filter initialization, or
  4564. when the @samp{volume} command is sent
  4565. @item frame
  4566. evaluate expression for each incoming frame
  4567. @end table
  4568. Default value is @samp{once}.
  4569. @end table
  4570. The volume expression can contain the following parameters.
  4571. @table @option
  4572. @item n
  4573. frame number (starting at zero)
  4574. @item nb_channels
  4575. number of channels
  4576. @item nb_consumed_samples
  4577. number of samples consumed by the filter
  4578. @item nb_samples
  4579. number of samples in the current frame
  4580. @item pos
  4581. original frame position in the file
  4582. @item pts
  4583. frame PTS
  4584. @item sample_rate
  4585. sample rate
  4586. @item startpts
  4587. PTS at start of stream
  4588. @item startt
  4589. time at start of stream
  4590. @item t
  4591. frame time
  4592. @item tb
  4593. timestamp timebase
  4594. @item volume
  4595. last set volume value
  4596. @end table
  4597. Note that when @option{eval} is set to @samp{once} only the
  4598. @var{sample_rate} and @var{tb} variables are available, all other
  4599. variables will evaluate to NAN.
  4600. @subsection Commands
  4601. This filter supports the following commands:
  4602. @table @option
  4603. @item volume
  4604. Modify the volume expression.
  4605. The command accepts the same syntax of the corresponding option.
  4606. If the specified expression is not valid, it is kept at its current
  4607. value.
  4608. @end table
  4609. @subsection Examples
  4610. @itemize
  4611. @item
  4612. Halve the input audio volume:
  4613. @example
  4614. volume=volume=0.5
  4615. volume=volume=1/2
  4616. volume=volume=-6.0206dB
  4617. @end example
  4618. In all the above example the named key for @option{volume} can be
  4619. omitted, for example like in:
  4620. @example
  4621. volume=0.5
  4622. @end example
  4623. @item
  4624. Increase input audio power by 6 decibels using fixed-point precision:
  4625. @example
  4626. volume=volume=6dB:precision=fixed
  4627. @end example
  4628. @item
  4629. Fade volume after time 10 with an annihilation period of 5 seconds:
  4630. @example
  4631. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4632. @end example
  4633. @end itemize
  4634. @section volumedetect
  4635. Detect the volume of the input video.
  4636. The filter has no parameters. The input is not modified. Statistics about
  4637. the volume will be printed in the log when the input stream end is reached.
  4638. In particular it will show the mean volume (root mean square), maximum
  4639. volume (on a per-sample basis), and the beginning of a histogram of the
  4640. registered volume values (from the maximum value to a cumulated 1/1000 of
  4641. the samples).
  4642. All volumes are in decibels relative to the maximum PCM value.
  4643. @subsection Examples
  4644. Here is an excerpt of the output:
  4645. @example
  4646. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4647. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4648. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4649. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4650. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4651. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4652. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4653. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4654. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4655. @end example
  4656. It means that:
  4657. @itemize
  4658. @item
  4659. The mean square energy is approximately -27 dB, or 10^-2.7.
  4660. @item
  4661. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4662. @item
  4663. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4664. @end itemize
  4665. In other words, raising the volume by +4 dB does not cause any clipping,
  4666. raising it by +5 dB causes clipping for 6 samples, etc.
  4667. @c man end AUDIO FILTERS
  4668. @chapter Audio Sources
  4669. @c man begin AUDIO SOURCES
  4670. Below is a description of the currently available audio sources.
  4671. @section abuffer
  4672. Buffer audio frames, and make them available to the filter chain.
  4673. This source is mainly intended for a programmatic use, in particular
  4674. through the interface defined in @file{libavfilter/buffersrc.h}.
  4675. It accepts the following parameters:
  4676. @table @option
  4677. @item time_base
  4678. The timebase which will be used for timestamps of submitted frames. It must be
  4679. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4680. @item sample_rate
  4681. The sample rate of the incoming audio buffers.
  4682. @item sample_fmt
  4683. The sample format of the incoming audio buffers.
  4684. Either a sample format name or its corresponding integer representation from
  4685. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4686. @item channel_layout
  4687. The channel layout of the incoming audio buffers.
  4688. Either a channel layout name from channel_layout_map in
  4689. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4690. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4691. @item channels
  4692. The number of channels of the incoming audio buffers.
  4693. If both @var{channels} and @var{channel_layout} are specified, then they
  4694. must be consistent.
  4695. @end table
  4696. @subsection Examples
  4697. @example
  4698. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4699. @end example
  4700. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4701. Since the sample format with name "s16p" corresponds to the number
  4702. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4703. equivalent to:
  4704. @example
  4705. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4706. @end example
  4707. @section aevalsrc
  4708. Generate an audio signal specified by an expression.
  4709. This source accepts in input one or more expressions (one for each
  4710. channel), which are evaluated and used to generate a corresponding
  4711. audio signal.
  4712. This source accepts the following options:
  4713. @table @option
  4714. @item exprs
  4715. Set the '|'-separated expressions list for each separate channel. In case the
  4716. @option{channel_layout} option is not specified, the selected channel layout
  4717. depends on the number of provided expressions. Otherwise the last
  4718. specified expression is applied to the remaining output channels.
  4719. @item channel_layout, c
  4720. Set the channel layout. The number of channels in the specified layout
  4721. must be equal to the number of specified expressions.
  4722. @item duration, d
  4723. Set the minimum duration of the sourced audio. See
  4724. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4725. for the accepted syntax.
  4726. Note that the resulting duration may be greater than the specified
  4727. duration, as the generated audio is always cut at the end of a
  4728. complete frame.
  4729. If not specified, or the expressed duration is negative, the audio is
  4730. supposed to be generated forever.
  4731. @item nb_samples, n
  4732. Set the number of samples per channel per each output frame,
  4733. default to 1024.
  4734. @item sample_rate, s
  4735. Specify the sample rate, default to 44100.
  4736. @end table
  4737. Each expression in @var{exprs} can contain the following constants:
  4738. @table @option
  4739. @item n
  4740. number of the evaluated sample, starting from 0
  4741. @item t
  4742. time of the evaluated sample expressed in seconds, starting from 0
  4743. @item s
  4744. sample rate
  4745. @end table
  4746. @subsection Examples
  4747. @itemize
  4748. @item
  4749. Generate silence:
  4750. @example
  4751. aevalsrc=0
  4752. @end example
  4753. @item
  4754. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4755. 8000 Hz:
  4756. @example
  4757. aevalsrc="sin(440*2*PI*t):s=8000"
  4758. @end example
  4759. @item
  4760. Generate a two channels signal, specify the channel layout (Front
  4761. Center + Back Center) explicitly:
  4762. @example
  4763. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4764. @end example
  4765. @item
  4766. Generate white noise:
  4767. @example
  4768. aevalsrc="-2+random(0)"
  4769. @end example
  4770. @item
  4771. Generate an amplitude modulated signal:
  4772. @example
  4773. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4774. @end example
  4775. @item
  4776. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4777. @example
  4778. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4779. @end example
  4780. @end itemize
  4781. @section afirsrc
  4782. Generate a FIR coefficients using frequency sampling method.
  4783. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4784. The filter accepts the following options:
  4785. @table @option
  4786. @item taps, t
  4787. Set number of filter coefficents in output audio stream.
  4788. Default value is 1025.
  4789. @item frequency, f
  4790. Set frequency points from where magnitude and phase are set.
  4791. This must be in non decreasing order, and first element must be 0, while last element
  4792. must be 1. Elements are separated by white spaces.
  4793. @item magnitude, m
  4794. Set magnitude value for every frequency point set by @option{frequency}.
  4795. Number of values must be same as number of frequency points.
  4796. Values are separated by white spaces.
  4797. @item phase, p
  4798. Set phase value for every frequency point set by @option{frequency}.
  4799. Number of values must be same as number of frequency points.
  4800. Values are separated by white spaces.
  4801. @item sample_rate, r
  4802. Set sample rate, default is 44100.
  4803. @item nb_samples, n
  4804. Set number of samples per each frame. Default is 1024.
  4805. @item win_func, w
  4806. Set window function. Default is blackman.
  4807. @end table
  4808. @section anullsrc
  4809. The null audio source, return unprocessed audio frames. It is mainly useful
  4810. as a template and to be employed in analysis / debugging tools, or as
  4811. the source for filters which ignore the input data (for example the sox
  4812. synth filter).
  4813. This source accepts the following options:
  4814. @table @option
  4815. @item channel_layout, cl
  4816. Specifies the channel layout, and can be either an integer or a string
  4817. representing a channel layout. The default value of @var{channel_layout}
  4818. is "stereo".
  4819. Check the channel_layout_map definition in
  4820. @file{libavutil/channel_layout.c} for the mapping between strings and
  4821. channel layout values.
  4822. @item sample_rate, r
  4823. Specifies the sample rate, and defaults to 44100.
  4824. @item nb_samples, n
  4825. Set the number of samples per requested frames.
  4826. @item duration, d
  4827. Set the duration of the sourced audio. See
  4828. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4829. for the accepted syntax.
  4830. If not specified, or the expressed duration is negative, the audio is
  4831. supposed to be generated forever.
  4832. @end table
  4833. @subsection Examples
  4834. @itemize
  4835. @item
  4836. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4837. @example
  4838. anullsrc=r=48000:cl=4
  4839. @end example
  4840. @item
  4841. Do the same operation with a more obvious syntax:
  4842. @example
  4843. anullsrc=r=48000:cl=mono
  4844. @end example
  4845. @end itemize
  4846. All the parameters need to be explicitly defined.
  4847. @section flite
  4848. Synthesize a voice utterance using the libflite library.
  4849. To enable compilation of this filter you need to configure FFmpeg with
  4850. @code{--enable-libflite}.
  4851. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4852. The filter accepts the following options:
  4853. @table @option
  4854. @item list_voices
  4855. If set to 1, list the names of the available voices and exit
  4856. immediately. Default value is 0.
  4857. @item nb_samples, n
  4858. Set the maximum number of samples per frame. Default value is 512.
  4859. @item textfile
  4860. Set the filename containing the text to speak.
  4861. @item text
  4862. Set the text to speak.
  4863. @item voice, v
  4864. Set the voice to use for the speech synthesis. Default value is
  4865. @code{kal}. See also the @var{list_voices} option.
  4866. @end table
  4867. @subsection Examples
  4868. @itemize
  4869. @item
  4870. Read from file @file{speech.txt}, and synthesize the text using the
  4871. standard flite voice:
  4872. @example
  4873. flite=textfile=speech.txt
  4874. @end example
  4875. @item
  4876. Read the specified text selecting the @code{slt} voice:
  4877. @example
  4878. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4879. @end example
  4880. @item
  4881. Input text to ffmpeg:
  4882. @example
  4883. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4884. @end example
  4885. @item
  4886. Make @file{ffplay} speak the specified text, using @code{flite} and
  4887. the @code{lavfi} device:
  4888. @example
  4889. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4890. @end example
  4891. @end itemize
  4892. For more information about libflite, check:
  4893. @url{http://www.festvox.org/flite/}
  4894. @section anoisesrc
  4895. Generate a noise audio signal.
  4896. The filter accepts the following options:
  4897. @table @option
  4898. @item sample_rate, r
  4899. Specify the sample rate. Default value is 48000 Hz.
  4900. @item amplitude, a
  4901. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4902. is 1.0.
  4903. @item duration, d
  4904. Specify the duration of the generated audio stream. Not specifying this option
  4905. results in noise with an infinite length.
  4906. @item color, colour, c
  4907. Specify the color of noise. Available noise colors are white, pink, brown,
  4908. blue, violet and velvet. Default color is white.
  4909. @item seed, s
  4910. Specify a value used to seed the PRNG.
  4911. @item nb_samples, n
  4912. Set the number of samples per each output frame, default is 1024.
  4913. @end table
  4914. @subsection Examples
  4915. @itemize
  4916. @item
  4917. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4918. @example
  4919. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4920. @end example
  4921. @end itemize
  4922. @section hilbert
  4923. Generate odd-tap Hilbert transform FIR coefficients.
  4924. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4925. the signal by 90 degrees.
  4926. This is used in many matrix coding schemes and for analytic signal generation.
  4927. The process is often written as a multiplication by i (or j), the imaginary unit.
  4928. The filter accepts the following options:
  4929. @table @option
  4930. @item sample_rate, s
  4931. Set sample rate, default is 44100.
  4932. @item taps, t
  4933. Set length of FIR filter, default is 22051.
  4934. @item nb_samples, n
  4935. Set number of samples per each frame.
  4936. @item win_func, w
  4937. Set window function to be used when generating FIR coefficients.
  4938. @end table
  4939. @section sinc
  4940. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4941. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4942. The filter accepts the following options:
  4943. @table @option
  4944. @item sample_rate, r
  4945. Set sample rate, default is 44100.
  4946. @item nb_samples, n
  4947. Set number of samples per each frame. Default is 1024.
  4948. @item hp
  4949. Set high-pass frequency. Default is 0.
  4950. @item lp
  4951. Set low-pass frequency. Default is 0.
  4952. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4953. is higher than 0 then filter will create band-pass filter coefficients,
  4954. otherwise band-reject filter coefficients.
  4955. @item phase
  4956. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4957. @item beta
  4958. Set Kaiser window beta.
  4959. @item att
  4960. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4961. @item round
  4962. Enable rounding, by default is disabled.
  4963. @item hptaps
  4964. Set number of taps for high-pass filter.
  4965. @item lptaps
  4966. Set number of taps for low-pass filter.
  4967. @end table
  4968. @section sine
  4969. Generate an audio signal made of a sine wave with amplitude 1/8.
  4970. The audio signal is bit-exact.
  4971. The filter accepts the following options:
  4972. @table @option
  4973. @item frequency, f
  4974. Set the carrier frequency. Default is 440 Hz.
  4975. @item beep_factor, b
  4976. Enable a periodic beep every second with frequency @var{beep_factor} times
  4977. the carrier frequency. Default is 0, meaning the beep is disabled.
  4978. @item sample_rate, r
  4979. Specify the sample rate, default is 44100.
  4980. @item duration, d
  4981. Specify the duration of the generated audio stream.
  4982. @item samples_per_frame
  4983. Set the number of samples per output frame.
  4984. The expression can contain the following constants:
  4985. @table @option
  4986. @item n
  4987. The (sequential) number of the output audio frame, starting from 0.
  4988. @item pts
  4989. The PTS (Presentation TimeStamp) of the output audio frame,
  4990. expressed in @var{TB} units.
  4991. @item t
  4992. The PTS of the output audio frame, expressed in seconds.
  4993. @item TB
  4994. The timebase of the output audio frames.
  4995. @end table
  4996. Default is @code{1024}.
  4997. @end table
  4998. @subsection Examples
  4999. @itemize
  5000. @item
  5001. Generate a simple 440 Hz sine wave:
  5002. @example
  5003. sine
  5004. @end example
  5005. @item
  5006. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5007. @example
  5008. sine=220:4:d=5
  5009. sine=f=220:b=4:d=5
  5010. sine=frequency=220:beep_factor=4:duration=5
  5011. @end example
  5012. @item
  5013. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5014. pattern:
  5015. @example
  5016. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5017. @end example
  5018. @end itemize
  5019. @c man end AUDIO SOURCES
  5020. @chapter Audio Sinks
  5021. @c man begin AUDIO SINKS
  5022. Below is a description of the currently available audio sinks.
  5023. @section abuffersink
  5024. Buffer audio frames, and make them available to the end of filter chain.
  5025. This sink is mainly intended for programmatic use, in particular
  5026. through the interface defined in @file{libavfilter/buffersink.h}
  5027. or the options system.
  5028. It accepts a pointer to an AVABufferSinkContext structure, which
  5029. defines the incoming buffers' formats, to be passed as the opaque
  5030. parameter to @code{avfilter_init_filter} for initialization.
  5031. @section anullsink
  5032. Null audio sink; do absolutely nothing with the input audio. It is
  5033. mainly useful as a template and for use in analysis / debugging
  5034. tools.
  5035. @c man end AUDIO SINKS
  5036. @chapter Video Filters
  5037. @c man begin VIDEO FILTERS
  5038. When you configure your FFmpeg build, you can disable any of the
  5039. existing filters using @code{--disable-filters}.
  5040. The configure output will show the video filters included in your
  5041. build.
  5042. Below is a description of the currently available video filters.
  5043. @section addroi
  5044. Mark a region of interest in a video frame.
  5045. The frame data is passed through unchanged, but metadata is attached
  5046. to the frame indicating regions of interest which can affect the
  5047. behaviour of later encoding. Multiple regions can be marked by
  5048. applying the filter multiple times.
  5049. @table @option
  5050. @item x
  5051. Region distance in pixels from the left edge of the frame.
  5052. @item y
  5053. Region distance in pixels from the top edge of the frame.
  5054. @item w
  5055. Region width in pixels.
  5056. @item h
  5057. Region height in pixels.
  5058. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5059. and may contain the following variables:
  5060. @table @option
  5061. @item iw
  5062. Width of the input frame.
  5063. @item ih
  5064. Height of the input frame.
  5065. @end table
  5066. @item qoffset
  5067. Quantisation offset to apply within the region.
  5068. This must be a real value in the range -1 to +1. A value of zero
  5069. indicates no quality change. A negative value asks for better quality
  5070. (less quantisation), while a positive value asks for worse quality
  5071. (greater quantisation).
  5072. The range is calibrated so that the extreme values indicate the
  5073. largest possible offset - if the rest of the frame is encoded with the
  5074. worst possible quality, an offset of -1 indicates that this region
  5075. should be encoded with the best possible quality anyway. Intermediate
  5076. values are then interpolated in some codec-dependent way.
  5077. For example, in 10-bit H.264 the quantisation parameter varies between
  5078. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5079. this region should be encoded with a QP around one-tenth of the full
  5080. range better than the rest of the frame. So, if most of the frame
  5081. were to be encoded with a QP of around 30, this region would get a QP
  5082. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5083. An extreme value of -1 would indicate that this region should be
  5084. encoded with the best possible quality regardless of the treatment of
  5085. the rest of the frame - that is, should be encoded at a QP of -12.
  5086. @item clear
  5087. If set to true, remove any existing regions of interest marked on the
  5088. frame before adding the new one.
  5089. @end table
  5090. @subsection Examples
  5091. @itemize
  5092. @item
  5093. Mark the centre quarter of the frame as interesting.
  5094. @example
  5095. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5096. @end example
  5097. @item
  5098. Mark the 100-pixel-wide region on the left edge of the frame as very
  5099. uninteresting (to be encoded at much lower quality than the rest of
  5100. the frame).
  5101. @example
  5102. addroi=0:0:100:ih:+1/5
  5103. @end example
  5104. @end itemize
  5105. @section alphaextract
  5106. Extract the alpha component from the input as a grayscale video. This
  5107. is especially useful with the @var{alphamerge} filter.
  5108. @section alphamerge
  5109. Add or replace the alpha component of the primary input with the
  5110. grayscale value of a second input. This is intended for use with
  5111. @var{alphaextract} to allow the transmission or storage of frame
  5112. sequences that have alpha in a format that doesn't support an alpha
  5113. channel.
  5114. For example, to reconstruct full frames from a normal YUV-encoded video
  5115. and a separate video created with @var{alphaextract}, you might use:
  5116. @example
  5117. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5118. @end example
  5119. @section amplify
  5120. Amplify differences between current pixel and pixels of adjacent frames in
  5121. same pixel location.
  5122. This filter accepts the following options:
  5123. @table @option
  5124. @item radius
  5125. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5126. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5127. @item factor
  5128. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5129. @item threshold
  5130. Set threshold for difference amplification. Any difference greater or equal to
  5131. this value will not alter source pixel. Default is 10.
  5132. Allowed range is from 0 to 65535.
  5133. @item tolerance
  5134. Set tolerance for difference amplification. Any difference lower to
  5135. this value will not alter source pixel. Default is 0.
  5136. Allowed range is from 0 to 65535.
  5137. @item low
  5138. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5139. This option controls maximum possible value that will decrease source pixel value.
  5140. @item high
  5141. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5142. This option controls maximum possible value that will increase source pixel value.
  5143. @item planes
  5144. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5145. @end table
  5146. @subsection Commands
  5147. This filter supports the following @ref{commands} that corresponds to option of same name:
  5148. @table @option
  5149. @item factor
  5150. @item threshold
  5151. @item tolerance
  5152. @item low
  5153. @item high
  5154. @item planes
  5155. @end table
  5156. @section ass
  5157. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5158. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5159. Substation Alpha) subtitles files.
  5160. This filter accepts the following option in addition to the common options from
  5161. the @ref{subtitles} filter:
  5162. @table @option
  5163. @item shaping
  5164. Set the shaping engine
  5165. Available values are:
  5166. @table @samp
  5167. @item auto
  5168. The default libass shaping engine, which is the best available.
  5169. @item simple
  5170. Fast, font-agnostic shaper that can do only substitutions
  5171. @item complex
  5172. Slower shaper using OpenType for substitutions and positioning
  5173. @end table
  5174. The default is @code{auto}.
  5175. @end table
  5176. @section atadenoise
  5177. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5178. The filter accepts the following options:
  5179. @table @option
  5180. @item 0a
  5181. Set threshold A for 1st plane. Default is 0.02.
  5182. Valid range is 0 to 0.3.
  5183. @item 0b
  5184. Set threshold B for 1st plane. Default is 0.04.
  5185. Valid range is 0 to 5.
  5186. @item 1a
  5187. Set threshold A for 2nd plane. Default is 0.02.
  5188. Valid range is 0 to 0.3.
  5189. @item 1b
  5190. Set threshold B for 2nd plane. Default is 0.04.
  5191. Valid range is 0 to 5.
  5192. @item 2a
  5193. Set threshold A for 3rd plane. Default is 0.02.
  5194. Valid range is 0 to 0.3.
  5195. @item 2b
  5196. Set threshold B for 3rd plane. Default is 0.04.
  5197. Valid range is 0 to 5.
  5198. Threshold A is designed to react on abrupt changes in the input signal and
  5199. threshold B is designed to react on continuous changes in the input signal.
  5200. @item s
  5201. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5202. number in range [5, 129].
  5203. @item p
  5204. Set what planes of frame filter will use for averaging. Default is all.
  5205. @item a
  5206. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5207. Alternatively can be set to @code{s} serial.
  5208. Parallel can be faster then serial, while other way around is never true.
  5209. Parallel will abort early on first change being greater then thresholds, while serial
  5210. will continue processing other side of frames if they are equal or bellow thresholds.
  5211. @end table
  5212. @subsection Commands
  5213. This filter supports same @ref{commands} as options except option @code{s}.
  5214. The command accepts the same syntax of the corresponding option.
  5215. @section avgblur
  5216. Apply average blur filter.
  5217. The filter accepts the following options:
  5218. @table @option
  5219. @item sizeX
  5220. Set horizontal radius size.
  5221. @item planes
  5222. Set which planes to filter. By default all planes are filtered.
  5223. @item sizeY
  5224. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5225. Default is @code{0}.
  5226. @end table
  5227. @subsection Commands
  5228. This filter supports same commands as options.
  5229. The command accepts the same syntax of the corresponding option.
  5230. If the specified expression is not valid, it is kept at its current
  5231. value.
  5232. @section bbox
  5233. Compute the bounding box for the non-black pixels in the input frame
  5234. luminance plane.
  5235. This filter computes the bounding box containing all the pixels with a
  5236. luminance value greater than the minimum allowed value.
  5237. The parameters describing the bounding box are printed on the filter
  5238. log.
  5239. The filter accepts the following option:
  5240. @table @option
  5241. @item min_val
  5242. Set the minimal luminance value. Default is @code{16}.
  5243. @end table
  5244. @section bilateral
  5245. Apply bilateral filter, spatial smoothing while preserving edges.
  5246. The filter accepts the following options:
  5247. @table @option
  5248. @item sigmaS
  5249. Set sigma of gaussian function to calculate spatial weight.
  5250. Allowed range is 0 to 512. Default is 0.1.
  5251. @item sigmaR
  5252. Set sigma of gaussian function to calculate range weight.
  5253. Allowed range is 0 to 1. Default is 0.1.
  5254. @item planes
  5255. Set planes to filter. Default is first only.
  5256. @end table
  5257. @section bitplanenoise
  5258. Show and measure bit plane noise.
  5259. The filter accepts the following options:
  5260. @table @option
  5261. @item bitplane
  5262. Set which plane to analyze. Default is @code{1}.
  5263. @item filter
  5264. Filter out noisy pixels from @code{bitplane} set above.
  5265. Default is disabled.
  5266. @end table
  5267. @section blackdetect
  5268. Detect video intervals that are (almost) completely black. Can be
  5269. useful to detect chapter transitions, commercials, or invalid
  5270. recordings.
  5271. The filter outputs its detection analysis to both the log as well as
  5272. frame metadata. If a black segment of at least the specified minimum
  5273. duration is found, a line with the start and end timestamps as well
  5274. as duration is printed to the log with level @code{info}. In addition,
  5275. a log line with level @code{debug} is printed per frame showing the
  5276. black amount detected for that frame.
  5277. The filter also attaches metadata to the first frame of a black
  5278. segment with key @code{lavfi.black_start} and to the first frame
  5279. after the black segment ends with key @code{lavfi.black_end}. The
  5280. value is the frame's timestamp. This metadata is added regardless
  5281. of the minimum duration specified.
  5282. The filter accepts the following options:
  5283. @table @option
  5284. @item black_min_duration, d
  5285. Set the minimum detected black duration expressed in seconds. It must
  5286. be a non-negative floating point number.
  5287. Default value is 2.0.
  5288. @item picture_black_ratio_th, pic_th
  5289. Set the threshold for considering a picture "black".
  5290. Express the minimum value for the ratio:
  5291. @example
  5292. @var{nb_black_pixels} / @var{nb_pixels}
  5293. @end example
  5294. for which a picture is considered black.
  5295. Default value is 0.98.
  5296. @item pixel_black_th, pix_th
  5297. Set the threshold for considering a pixel "black".
  5298. The threshold expresses the maximum pixel luminance value for which a
  5299. pixel is considered "black". The provided value is scaled according to
  5300. the following equation:
  5301. @example
  5302. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5303. @end example
  5304. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5305. the input video format, the range is [0-255] for YUV full-range
  5306. formats and [16-235] for YUV non full-range formats.
  5307. Default value is 0.10.
  5308. @end table
  5309. The following example sets the maximum pixel threshold to the minimum
  5310. value, and detects only black intervals of 2 or more seconds:
  5311. @example
  5312. blackdetect=d=2:pix_th=0.00
  5313. @end example
  5314. @section blackframe
  5315. Detect frames that are (almost) completely black. Can be useful to
  5316. detect chapter transitions or commercials. Output lines consist of
  5317. the frame number of the detected frame, the percentage of blackness,
  5318. the position in the file if known or -1 and the timestamp in seconds.
  5319. In order to display the output lines, you need to set the loglevel at
  5320. least to the AV_LOG_INFO value.
  5321. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5322. The value represents the percentage of pixels in the picture that
  5323. are below the threshold value.
  5324. It accepts the following parameters:
  5325. @table @option
  5326. @item amount
  5327. The percentage of the pixels that have to be below the threshold; it defaults to
  5328. @code{98}.
  5329. @item threshold, thresh
  5330. The threshold below which a pixel value is considered black; it defaults to
  5331. @code{32}.
  5332. @end table
  5333. @anchor{blend}
  5334. @section blend
  5335. Blend two video frames into each other.
  5336. The @code{blend} filter takes two input streams and outputs one
  5337. stream, the first input is the "top" layer and second input is
  5338. "bottom" layer. By default, the output terminates when the longest input terminates.
  5339. The @code{tblend} (time blend) filter takes two consecutive frames
  5340. from one single stream, and outputs the result obtained by blending
  5341. the new frame on top of the old frame.
  5342. A description of the accepted options follows.
  5343. @table @option
  5344. @item c0_mode
  5345. @item c1_mode
  5346. @item c2_mode
  5347. @item c3_mode
  5348. @item all_mode
  5349. Set blend mode for specific pixel component or all pixel components in case
  5350. of @var{all_mode}. Default value is @code{normal}.
  5351. Available values for component modes are:
  5352. @table @samp
  5353. @item addition
  5354. @item grainmerge
  5355. @item and
  5356. @item average
  5357. @item burn
  5358. @item darken
  5359. @item difference
  5360. @item grainextract
  5361. @item divide
  5362. @item dodge
  5363. @item freeze
  5364. @item exclusion
  5365. @item extremity
  5366. @item glow
  5367. @item hardlight
  5368. @item hardmix
  5369. @item heat
  5370. @item lighten
  5371. @item linearlight
  5372. @item multiply
  5373. @item multiply128
  5374. @item negation
  5375. @item normal
  5376. @item or
  5377. @item overlay
  5378. @item phoenix
  5379. @item pinlight
  5380. @item reflect
  5381. @item screen
  5382. @item softlight
  5383. @item subtract
  5384. @item vividlight
  5385. @item xor
  5386. @end table
  5387. @item c0_opacity
  5388. @item c1_opacity
  5389. @item c2_opacity
  5390. @item c3_opacity
  5391. @item all_opacity
  5392. Set blend opacity for specific pixel component or all pixel components in case
  5393. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5394. @item c0_expr
  5395. @item c1_expr
  5396. @item c2_expr
  5397. @item c3_expr
  5398. @item all_expr
  5399. Set blend expression for specific pixel component or all pixel components in case
  5400. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5401. The expressions can use the following variables:
  5402. @table @option
  5403. @item N
  5404. The sequential number of the filtered frame, starting from @code{0}.
  5405. @item X
  5406. @item Y
  5407. the coordinates of the current sample
  5408. @item W
  5409. @item H
  5410. the width and height of currently filtered plane
  5411. @item SW
  5412. @item SH
  5413. Width and height scale for the plane being filtered. It is the
  5414. ratio between the dimensions of the current plane to the luma plane,
  5415. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5416. the luma plane and @code{0.5,0.5} for the chroma planes.
  5417. @item T
  5418. Time of the current frame, expressed in seconds.
  5419. @item TOP, A
  5420. Value of pixel component at current location for first video frame (top layer).
  5421. @item BOTTOM, B
  5422. Value of pixel component at current location for second video frame (bottom layer).
  5423. @end table
  5424. @end table
  5425. The @code{blend} filter also supports the @ref{framesync} options.
  5426. @subsection Examples
  5427. @itemize
  5428. @item
  5429. Apply transition from bottom layer to top layer in first 10 seconds:
  5430. @example
  5431. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5432. @end example
  5433. @item
  5434. Apply linear horizontal transition from top layer to bottom layer:
  5435. @example
  5436. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5437. @end example
  5438. @item
  5439. Apply 1x1 checkerboard effect:
  5440. @example
  5441. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5442. @end example
  5443. @item
  5444. Apply uncover left effect:
  5445. @example
  5446. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5447. @end example
  5448. @item
  5449. Apply uncover down effect:
  5450. @example
  5451. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5452. @end example
  5453. @item
  5454. Apply uncover up-left effect:
  5455. @example
  5456. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5457. @end example
  5458. @item
  5459. Split diagonally video and shows top and bottom layer on each side:
  5460. @example
  5461. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5462. @end example
  5463. @item
  5464. Display differences between the current and the previous frame:
  5465. @example
  5466. tblend=all_mode=grainextract
  5467. @end example
  5468. @end itemize
  5469. @section bm3d
  5470. Denoise frames using Block-Matching 3D algorithm.
  5471. The filter accepts the following options.
  5472. @table @option
  5473. @item sigma
  5474. Set denoising strength. Default value is 1.
  5475. Allowed range is from 0 to 999.9.
  5476. The denoising algorithm is very sensitive to sigma, so adjust it
  5477. according to the source.
  5478. @item block
  5479. Set local patch size. This sets dimensions in 2D.
  5480. @item bstep
  5481. Set sliding step for processing blocks. Default value is 4.
  5482. Allowed range is from 1 to 64.
  5483. Smaller values allows processing more reference blocks and is slower.
  5484. @item group
  5485. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5486. When set to 1, no block matching is done. Larger values allows more blocks
  5487. in single group.
  5488. Allowed range is from 1 to 256.
  5489. @item range
  5490. Set radius for search block matching. Default is 9.
  5491. Allowed range is from 1 to INT32_MAX.
  5492. @item mstep
  5493. Set step between two search locations for block matching. Default is 1.
  5494. Allowed range is from 1 to 64. Smaller is slower.
  5495. @item thmse
  5496. Set threshold of mean square error for block matching. Valid range is 0 to
  5497. INT32_MAX.
  5498. @item hdthr
  5499. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5500. Larger values results in stronger hard-thresholding filtering in frequency
  5501. domain.
  5502. @item estim
  5503. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5504. Default is @code{basic}.
  5505. @item ref
  5506. If enabled, filter will use 2nd stream for block matching.
  5507. Default is disabled for @code{basic} value of @var{estim} option,
  5508. and always enabled if value of @var{estim} is @code{final}.
  5509. @item planes
  5510. Set planes to filter. Default is all available except alpha.
  5511. @end table
  5512. @subsection Examples
  5513. @itemize
  5514. @item
  5515. Basic filtering with bm3d:
  5516. @example
  5517. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5518. @end example
  5519. @item
  5520. Same as above, but filtering only luma:
  5521. @example
  5522. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5523. @end example
  5524. @item
  5525. Same as above, but with both estimation modes:
  5526. @example
  5527. 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
  5528. @end example
  5529. @item
  5530. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5531. @example
  5532. 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
  5533. @end example
  5534. @end itemize
  5535. @section boxblur
  5536. Apply a boxblur algorithm to the input video.
  5537. It accepts the following parameters:
  5538. @table @option
  5539. @item luma_radius, lr
  5540. @item luma_power, lp
  5541. @item chroma_radius, cr
  5542. @item chroma_power, cp
  5543. @item alpha_radius, ar
  5544. @item alpha_power, ap
  5545. @end table
  5546. A description of the accepted options follows.
  5547. @table @option
  5548. @item luma_radius, lr
  5549. @item chroma_radius, cr
  5550. @item alpha_radius, ar
  5551. Set an expression for the box radius in pixels used for blurring the
  5552. corresponding input plane.
  5553. The radius value must be a non-negative number, and must not be
  5554. greater than the value of the expression @code{min(w,h)/2} for the
  5555. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5556. planes.
  5557. Default value for @option{luma_radius} is "2". If not specified,
  5558. @option{chroma_radius} and @option{alpha_radius} default to the
  5559. corresponding value set for @option{luma_radius}.
  5560. The expressions can contain the following constants:
  5561. @table @option
  5562. @item w
  5563. @item h
  5564. The input width and height in pixels.
  5565. @item cw
  5566. @item ch
  5567. The input chroma image width and height in pixels.
  5568. @item hsub
  5569. @item vsub
  5570. The horizontal and vertical chroma subsample values. For example, for the
  5571. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5572. @end table
  5573. @item luma_power, lp
  5574. @item chroma_power, cp
  5575. @item alpha_power, ap
  5576. Specify how many times the boxblur filter is applied to the
  5577. corresponding plane.
  5578. Default value for @option{luma_power} is 2. If not specified,
  5579. @option{chroma_power} and @option{alpha_power} default to the
  5580. corresponding value set for @option{luma_power}.
  5581. A value of 0 will disable the effect.
  5582. @end table
  5583. @subsection Examples
  5584. @itemize
  5585. @item
  5586. Apply a boxblur filter with the luma, chroma, and alpha radii
  5587. set to 2:
  5588. @example
  5589. boxblur=luma_radius=2:luma_power=1
  5590. boxblur=2:1
  5591. @end example
  5592. @item
  5593. Set the luma radius to 2, and alpha and chroma radius to 0:
  5594. @example
  5595. boxblur=2:1:cr=0:ar=0
  5596. @end example
  5597. @item
  5598. Set the luma and chroma radii to a fraction of the video dimension:
  5599. @example
  5600. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5601. @end example
  5602. @end itemize
  5603. @section bwdif
  5604. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5605. Deinterlacing Filter").
  5606. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5607. interpolation algorithms.
  5608. It accepts the following parameters:
  5609. @table @option
  5610. @item mode
  5611. The interlacing mode to adopt. It accepts one of the following values:
  5612. @table @option
  5613. @item 0, send_frame
  5614. Output one frame for each frame.
  5615. @item 1, send_field
  5616. Output one frame for each field.
  5617. @end table
  5618. The default value is @code{send_field}.
  5619. @item parity
  5620. The picture field parity assumed for the input interlaced video. It accepts one
  5621. of the following values:
  5622. @table @option
  5623. @item 0, tff
  5624. Assume the top field is first.
  5625. @item 1, bff
  5626. Assume the bottom field is first.
  5627. @item -1, auto
  5628. Enable automatic detection of field parity.
  5629. @end table
  5630. The default value is @code{auto}.
  5631. If the interlacing is unknown or the decoder does not export this information,
  5632. top field first will be assumed.
  5633. @item deint
  5634. Specify which frames to deinterlace. Accepts one of the following
  5635. values:
  5636. @table @option
  5637. @item 0, all
  5638. Deinterlace all frames.
  5639. @item 1, interlaced
  5640. Only deinterlace frames marked as interlaced.
  5641. @end table
  5642. The default value is @code{all}.
  5643. @end table
  5644. @section cas
  5645. Apply Contrast Adaptive Sharpen filter to video stream.
  5646. The filter accepts the following options:
  5647. @table @option
  5648. @item strength
  5649. Set the sharpening strength. Default value is 0.
  5650. @item planes
  5651. Set planes to filter. Default value is to filter all
  5652. planes except alpha plane.
  5653. @end table
  5654. @section chromahold
  5655. Remove all color information for all colors except for certain one.
  5656. The filter accepts the following options:
  5657. @table @option
  5658. @item color
  5659. The color which will not be replaced with neutral chroma.
  5660. @item similarity
  5661. Similarity percentage with the above color.
  5662. 0.01 matches only the exact key color, while 1.0 matches everything.
  5663. @item blend
  5664. Blend percentage.
  5665. 0.0 makes pixels either fully gray, or not gray at all.
  5666. Higher values result in more preserved color.
  5667. @item yuv
  5668. Signals that the color passed is already in YUV instead of RGB.
  5669. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5670. This can be used to pass exact YUV values as hexadecimal numbers.
  5671. @end table
  5672. @subsection Commands
  5673. This filter supports same @ref{commands} as options.
  5674. The command accepts the same syntax of the corresponding option.
  5675. If the specified expression is not valid, it is kept at its current
  5676. value.
  5677. @section chromakey
  5678. YUV colorspace color/chroma keying.
  5679. The filter accepts the following options:
  5680. @table @option
  5681. @item color
  5682. The color which will be replaced with transparency.
  5683. @item similarity
  5684. Similarity percentage with the key color.
  5685. 0.01 matches only the exact key color, while 1.0 matches everything.
  5686. @item blend
  5687. Blend percentage.
  5688. 0.0 makes pixels either fully transparent, or not transparent at all.
  5689. Higher values result in semi-transparent pixels, with a higher transparency
  5690. the more similar the pixels color is to the key color.
  5691. @item yuv
  5692. Signals that the color passed is already in YUV instead of RGB.
  5693. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5694. This can be used to pass exact YUV values as hexadecimal numbers.
  5695. @end table
  5696. @subsection Commands
  5697. This filter supports same @ref{commands} as options.
  5698. The command accepts the same syntax of the corresponding option.
  5699. If the specified expression is not valid, it is kept at its current
  5700. value.
  5701. @subsection Examples
  5702. @itemize
  5703. @item
  5704. Make every green pixel in the input image transparent:
  5705. @example
  5706. ffmpeg -i input.png -vf chromakey=green out.png
  5707. @end example
  5708. @item
  5709. Overlay a greenscreen-video on top of a static black background.
  5710. @example
  5711. 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
  5712. @end example
  5713. @end itemize
  5714. @section chromanr
  5715. Reduce chrominance noise.
  5716. The filter accepts the following options:
  5717. @table @option
  5718. @item thres
  5719. Set threshold for averaging chrominance values.
  5720. Sum of absolute difference of U and V pixel components or current
  5721. pixel and neighbour pixels lower than this threshold will be used in
  5722. averaging. Luma component is left unchanged and is copied to output.
  5723. Default value is 30. Allowed range is from 1 to 200.
  5724. @item sizew
  5725. Set horizontal radius of rectangle used for averaging.
  5726. Allowed range is from 1 to 100. Default value is 5.
  5727. @item sizeh
  5728. Set vertical radius of rectangle used for averaging.
  5729. Allowed range is from 1 to 100. Default value is 5.
  5730. @item stepw
  5731. Set horizontal step when averaging. Default value is 1.
  5732. Allowed range is from 1 to 50.
  5733. Mostly useful to speed-up filtering.
  5734. @item steph
  5735. Set vertical step when averaging. Default value is 1.
  5736. Allowed range is from 1 to 50.
  5737. Mostly useful to speed-up filtering.
  5738. @end table
  5739. @subsection Commands
  5740. This filter supports same @ref{commands} as options.
  5741. The command accepts the same syntax of the corresponding option.
  5742. @section chromashift
  5743. Shift chroma pixels horizontally and/or vertically.
  5744. The filter accepts the following options:
  5745. @table @option
  5746. @item cbh
  5747. Set amount to shift chroma-blue horizontally.
  5748. @item cbv
  5749. Set amount to shift chroma-blue vertically.
  5750. @item crh
  5751. Set amount to shift chroma-red horizontally.
  5752. @item crv
  5753. Set amount to shift chroma-red vertically.
  5754. @item edge
  5755. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5756. @end table
  5757. @subsection Commands
  5758. This filter supports the all above options as @ref{commands}.
  5759. @section ciescope
  5760. Display CIE color diagram with pixels overlaid onto it.
  5761. The filter accepts the following options:
  5762. @table @option
  5763. @item system
  5764. Set color system.
  5765. @table @samp
  5766. @item ntsc, 470m
  5767. @item ebu, 470bg
  5768. @item smpte
  5769. @item 240m
  5770. @item apple
  5771. @item widergb
  5772. @item cie1931
  5773. @item rec709, hdtv
  5774. @item uhdtv, rec2020
  5775. @item dcip3
  5776. @end table
  5777. @item cie
  5778. Set CIE system.
  5779. @table @samp
  5780. @item xyy
  5781. @item ucs
  5782. @item luv
  5783. @end table
  5784. @item gamuts
  5785. Set what gamuts to draw.
  5786. See @code{system} option for available values.
  5787. @item size, s
  5788. Set ciescope size, by default set to 512.
  5789. @item intensity, i
  5790. Set intensity used to map input pixel values to CIE diagram.
  5791. @item contrast
  5792. Set contrast used to draw tongue colors that are out of active color system gamut.
  5793. @item corrgamma
  5794. Correct gamma displayed on scope, by default enabled.
  5795. @item showwhite
  5796. Show white point on CIE diagram, by default disabled.
  5797. @item gamma
  5798. Set input gamma. Used only with XYZ input color space.
  5799. @end table
  5800. @section codecview
  5801. Visualize information exported by some codecs.
  5802. Some codecs can export information through frames using side-data or other
  5803. means. For example, some MPEG based codecs export motion vectors through the
  5804. @var{export_mvs} flag in the codec @option{flags2} option.
  5805. The filter accepts the following option:
  5806. @table @option
  5807. @item mv
  5808. Set motion vectors to visualize.
  5809. Available flags for @var{mv} are:
  5810. @table @samp
  5811. @item pf
  5812. forward predicted MVs of P-frames
  5813. @item bf
  5814. forward predicted MVs of B-frames
  5815. @item bb
  5816. backward predicted MVs of B-frames
  5817. @end table
  5818. @item qp
  5819. Display quantization parameters using the chroma planes.
  5820. @item mv_type, mvt
  5821. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5822. Available flags for @var{mv_type} are:
  5823. @table @samp
  5824. @item fp
  5825. forward predicted MVs
  5826. @item bp
  5827. backward predicted MVs
  5828. @end table
  5829. @item frame_type, ft
  5830. Set frame type to visualize motion vectors of.
  5831. Available flags for @var{frame_type} are:
  5832. @table @samp
  5833. @item if
  5834. intra-coded frames (I-frames)
  5835. @item pf
  5836. predicted frames (P-frames)
  5837. @item bf
  5838. bi-directionally predicted frames (B-frames)
  5839. @end table
  5840. @end table
  5841. @subsection Examples
  5842. @itemize
  5843. @item
  5844. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5845. @example
  5846. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5847. @end example
  5848. @item
  5849. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5850. @example
  5851. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5852. @end example
  5853. @end itemize
  5854. @section colorbalance
  5855. Modify intensity of primary colors (red, green and blue) of input frames.
  5856. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5857. regions for the red-cyan, green-magenta or blue-yellow balance.
  5858. A positive adjustment value shifts the balance towards the primary color, a negative
  5859. value towards the complementary color.
  5860. The filter accepts the following options:
  5861. @table @option
  5862. @item rs
  5863. @item gs
  5864. @item bs
  5865. Adjust red, green and blue shadows (darkest pixels).
  5866. @item rm
  5867. @item gm
  5868. @item bm
  5869. Adjust red, green and blue midtones (medium pixels).
  5870. @item rh
  5871. @item gh
  5872. @item bh
  5873. Adjust red, green and blue highlights (brightest pixels).
  5874. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5875. @item pl
  5876. Preserve lightness when changing color balance. Default is disabled.
  5877. @end table
  5878. @subsection Examples
  5879. @itemize
  5880. @item
  5881. Add red color cast to shadows:
  5882. @example
  5883. colorbalance=rs=.3
  5884. @end example
  5885. @end itemize
  5886. @subsection Commands
  5887. This filter supports the all above options as @ref{commands}.
  5888. @section colorchannelmixer
  5889. Adjust video input frames by re-mixing color channels.
  5890. This filter modifies a color channel by adding the values associated to
  5891. the other channels of the same pixels. For example if the value to
  5892. modify is red, the output value will be:
  5893. @example
  5894. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5895. @end example
  5896. The filter accepts the following options:
  5897. @table @option
  5898. @item rr
  5899. @item rg
  5900. @item rb
  5901. @item ra
  5902. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5903. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5904. @item gr
  5905. @item gg
  5906. @item gb
  5907. @item ga
  5908. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5909. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5910. @item br
  5911. @item bg
  5912. @item bb
  5913. @item ba
  5914. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5915. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5916. @item ar
  5917. @item ag
  5918. @item ab
  5919. @item aa
  5920. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5921. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5922. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5923. @end table
  5924. @subsection Examples
  5925. @itemize
  5926. @item
  5927. Convert source to grayscale:
  5928. @example
  5929. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5930. @end example
  5931. @item
  5932. Simulate sepia tones:
  5933. @example
  5934. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5935. @end example
  5936. @end itemize
  5937. @subsection Commands
  5938. This filter supports the all above options as @ref{commands}.
  5939. @section colorkey
  5940. RGB colorspace color keying.
  5941. The filter accepts the following options:
  5942. @table @option
  5943. @item color
  5944. The color which will be replaced with transparency.
  5945. @item similarity
  5946. Similarity percentage with the key color.
  5947. 0.01 matches only the exact key color, while 1.0 matches everything.
  5948. @item blend
  5949. Blend percentage.
  5950. 0.0 makes pixels either fully transparent, or not transparent at all.
  5951. Higher values result in semi-transparent pixels, with a higher transparency
  5952. the more similar the pixels color is to the key color.
  5953. @end table
  5954. @subsection Examples
  5955. @itemize
  5956. @item
  5957. Make every green pixel in the input image transparent:
  5958. @example
  5959. ffmpeg -i input.png -vf colorkey=green out.png
  5960. @end example
  5961. @item
  5962. Overlay a greenscreen-video on top of a static background image.
  5963. @example
  5964. 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
  5965. @end example
  5966. @end itemize
  5967. @subsection Commands
  5968. This filter supports same @ref{commands} as options.
  5969. The command accepts the same syntax of the corresponding option.
  5970. If the specified expression is not valid, it is kept at its current
  5971. value.
  5972. @section colorhold
  5973. Remove all color information for all RGB colors except for certain one.
  5974. The filter accepts the following options:
  5975. @table @option
  5976. @item color
  5977. The color which will not be replaced with neutral gray.
  5978. @item similarity
  5979. Similarity percentage with the above color.
  5980. 0.01 matches only the exact key color, while 1.0 matches everything.
  5981. @item blend
  5982. Blend percentage. 0.0 makes pixels fully gray.
  5983. Higher values result in more preserved color.
  5984. @end table
  5985. @subsection Commands
  5986. This filter supports same @ref{commands} as options.
  5987. The command accepts the same syntax of the corresponding option.
  5988. If the specified expression is not valid, it is kept at its current
  5989. value.
  5990. @section colorlevels
  5991. Adjust video input frames using levels.
  5992. The filter accepts the following options:
  5993. @table @option
  5994. @item rimin
  5995. @item gimin
  5996. @item bimin
  5997. @item aimin
  5998. Adjust red, green, blue and alpha input black point.
  5999. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6000. @item rimax
  6001. @item gimax
  6002. @item bimax
  6003. @item aimax
  6004. Adjust red, green, blue and alpha input white point.
  6005. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6006. Input levels are used to lighten highlights (bright tones), darken shadows
  6007. (dark tones), change the balance of bright and dark tones.
  6008. @item romin
  6009. @item gomin
  6010. @item bomin
  6011. @item aomin
  6012. Adjust red, green, blue and alpha output black point.
  6013. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6014. @item romax
  6015. @item gomax
  6016. @item bomax
  6017. @item aomax
  6018. Adjust red, green, blue and alpha output white point.
  6019. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6020. Output levels allows manual selection of a constrained output level range.
  6021. @end table
  6022. @subsection Examples
  6023. @itemize
  6024. @item
  6025. Make video output darker:
  6026. @example
  6027. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6028. @end example
  6029. @item
  6030. Increase contrast:
  6031. @example
  6032. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6033. @end example
  6034. @item
  6035. Make video output lighter:
  6036. @example
  6037. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6038. @end example
  6039. @item
  6040. Increase brightness:
  6041. @example
  6042. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6043. @end example
  6044. @end itemize
  6045. @subsection Commands
  6046. This filter supports the all above options as @ref{commands}.
  6047. @section colormatrix
  6048. Convert color matrix.
  6049. The filter accepts the following options:
  6050. @table @option
  6051. @item src
  6052. @item dst
  6053. Specify the source and destination color matrix. Both values must be
  6054. specified.
  6055. The accepted values are:
  6056. @table @samp
  6057. @item bt709
  6058. BT.709
  6059. @item fcc
  6060. FCC
  6061. @item bt601
  6062. BT.601
  6063. @item bt470
  6064. BT.470
  6065. @item bt470bg
  6066. BT.470BG
  6067. @item smpte170m
  6068. SMPTE-170M
  6069. @item smpte240m
  6070. SMPTE-240M
  6071. @item bt2020
  6072. BT.2020
  6073. @end table
  6074. @end table
  6075. For example to convert from BT.601 to SMPTE-240M, use the command:
  6076. @example
  6077. colormatrix=bt601:smpte240m
  6078. @end example
  6079. @section colorspace
  6080. Convert colorspace, transfer characteristics or color primaries.
  6081. Input video needs to have an even size.
  6082. The filter accepts the following options:
  6083. @table @option
  6084. @anchor{all}
  6085. @item all
  6086. Specify all color properties at once.
  6087. The accepted values are:
  6088. @table @samp
  6089. @item bt470m
  6090. BT.470M
  6091. @item bt470bg
  6092. BT.470BG
  6093. @item bt601-6-525
  6094. BT.601-6 525
  6095. @item bt601-6-625
  6096. BT.601-6 625
  6097. @item bt709
  6098. BT.709
  6099. @item smpte170m
  6100. SMPTE-170M
  6101. @item smpte240m
  6102. SMPTE-240M
  6103. @item bt2020
  6104. BT.2020
  6105. @end table
  6106. @anchor{space}
  6107. @item space
  6108. Specify output colorspace.
  6109. The accepted values are:
  6110. @table @samp
  6111. @item bt709
  6112. BT.709
  6113. @item fcc
  6114. FCC
  6115. @item bt470bg
  6116. BT.470BG or BT.601-6 625
  6117. @item smpte170m
  6118. SMPTE-170M or BT.601-6 525
  6119. @item smpte240m
  6120. SMPTE-240M
  6121. @item ycgco
  6122. YCgCo
  6123. @item bt2020ncl
  6124. BT.2020 with non-constant luminance
  6125. @end table
  6126. @anchor{trc}
  6127. @item trc
  6128. Specify output transfer characteristics.
  6129. The accepted values are:
  6130. @table @samp
  6131. @item bt709
  6132. BT.709
  6133. @item bt470m
  6134. BT.470M
  6135. @item bt470bg
  6136. BT.470BG
  6137. @item gamma22
  6138. Constant gamma of 2.2
  6139. @item gamma28
  6140. Constant gamma of 2.8
  6141. @item smpte170m
  6142. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6143. @item smpte240m
  6144. SMPTE-240M
  6145. @item srgb
  6146. SRGB
  6147. @item iec61966-2-1
  6148. iec61966-2-1
  6149. @item iec61966-2-4
  6150. iec61966-2-4
  6151. @item xvycc
  6152. xvycc
  6153. @item bt2020-10
  6154. BT.2020 for 10-bits content
  6155. @item bt2020-12
  6156. BT.2020 for 12-bits content
  6157. @end table
  6158. @anchor{primaries}
  6159. @item primaries
  6160. Specify output color primaries.
  6161. The accepted values are:
  6162. @table @samp
  6163. @item bt709
  6164. BT.709
  6165. @item bt470m
  6166. BT.470M
  6167. @item bt470bg
  6168. BT.470BG or BT.601-6 625
  6169. @item smpte170m
  6170. SMPTE-170M or BT.601-6 525
  6171. @item smpte240m
  6172. SMPTE-240M
  6173. @item film
  6174. film
  6175. @item smpte431
  6176. SMPTE-431
  6177. @item smpte432
  6178. SMPTE-432
  6179. @item bt2020
  6180. BT.2020
  6181. @item jedec-p22
  6182. JEDEC P22 phosphors
  6183. @end table
  6184. @anchor{range}
  6185. @item range
  6186. Specify output color range.
  6187. The accepted values are:
  6188. @table @samp
  6189. @item tv
  6190. TV (restricted) range
  6191. @item mpeg
  6192. MPEG (restricted) range
  6193. @item pc
  6194. PC (full) range
  6195. @item jpeg
  6196. JPEG (full) range
  6197. @end table
  6198. @item format
  6199. Specify output color format.
  6200. The accepted values are:
  6201. @table @samp
  6202. @item yuv420p
  6203. YUV 4:2:0 planar 8-bits
  6204. @item yuv420p10
  6205. YUV 4:2:0 planar 10-bits
  6206. @item yuv420p12
  6207. YUV 4:2:0 planar 12-bits
  6208. @item yuv422p
  6209. YUV 4:2:2 planar 8-bits
  6210. @item yuv422p10
  6211. YUV 4:2:2 planar 10-bits
  6212. @item yuv422p12
  6213. YUV 4:2:2 planar 12-bits
  6214. @item yuv444p
  6215. YUV 4:4:4 planar 8-bits
  6216. @item yuv444p10
  6217. YUV 4:4:4 planar 10-bits
  6218. @item yuv444p12
  6219. YUV 4:4:4 planar 12-bits
  6220. @end table
  6221. @item fast
  6222. Do a fast conversion, which skips gamma/primary correction. This will take
  6223. significantly less CPU, but will be mathematically incorrect. To get output
  6224. compatible with that produced by the colormatrix filter, use fast=1.
  6225. @item dither
  6226. Specify dithering mode.
  6227. The accepted values are:
  6228. @table @samp
  6229. @item none
  6230. No dithering
  6231. @item fsb
  6232. Floyd-Steinberg dithering
  6233. @end table
  6234. @item wpadapt
  6235. Whitepoint adaptation mode.
  6236. The accepted values are:
  6237. @table @samp
  6238. @item bradford
  6239. Bradford whitepoint adaptation
  6240. @item vonkries
  6241. von Kries whitepoint adaptation
  6242. @item identity
  6243. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6244. @end table
  6245. @item iall
  6246. Override all input properties at once. Same accepted values as @ref{all}.
  6247. @item ispace
  6248. Override input colorspace. Same accepted values as @ref{space}.
  6249. @item iprimaries
  6250. Override input color primaries. Same accepted values as @ref{primaries}.
  6251. @item itrc
  6252. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6253. @item irange
  6254. Override input color range. Same accepted values as @ref{range}.
  6255. @end table
  6256. The filter converts the transfer characteristics, color space and color
  6257. primaries to the specified user values. The output value, if not specified,
  6258. is set to a default value based on the "all" property. If that property is
  6259. also not specified, the filter will log an error. The output color range and
  6260. format default to the same value as the input color range and format. The
  6261. input transfer characteristics, color space, color primaries and color range
  6262. should be set on the input data. If any of these are missing, the filter will
  6263. log an error and no conversion will take place.
  6264. For example to convert the input to SMPTE-240M, use the command:
  6265. @example
  6266. colorspace=smpte240m
  6267. @end example
  6268. @section convolution
  6269. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6270. The filter accepts the following options:
  6271. @table @option
  6272. @item 0m
  6273. @item 1m
  6274. @item 2m
  6275. @item 3m
  6276. Set matrix for each plane.
  6277. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6278. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6279. @item 0rdiv
  6280. @item 1rdiv
  6281. @item 2rdiv
  6282. @item 3rdiv
  6283. Set multiplier for calculated value for each plane.
  6284. If unset or 0, it will be sum of all matrix elements.
  6285. @item 0bias
  6286. @item 1bias
  6287. @item 2bias
  6288. @item 3bias
  6289. Set bias for each plane. This value is added to the result of the multiplication.
  6290. Useful for making the overall image brighter or darker. Default is 0.0.
  6291. @item 0mode
  6292. @item 1mode
  6293. @item 2mode
  6294. @item 3mode
  6295. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6296. Default is @var{square}.
  6297. @end table
  6298. @subsection Examples
  6299. @itemize
  6300. @item
  6301. Apply sharpen:
  6302. @example
  6303. 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"
  6304. @end example
  6305. @item
  6306. Apply blur:
  6307. @example
  6308. 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"
  6309. @end example
  6310. @item
  6311. Apply edge enhance:
  6312. @example
  6313. 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"
  6314. @end example
  6315. @item
  6316. Apply edge detect:
  6317. @example
  6318. 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"
  6319. @end example
  6320. @item
  6321. Apply laplacian edge detector which includes diagonals:
  6322. @example
  6323. 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"
  6324. @end example
  6325. @item
  6326. Apply emboss:
  6327. @example
  6328. 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"
  6329. @end example
  6330. @end itemize
  6331. @section convolve
  6332. Apply 2D convolution of video stream in frequency domain using second stream
  6333. as impulse.
  6334. The filter accepts the following options:
  6335. @table @option
  6336. @item planes
  6337. Set which planes to process.
  6338. @item impulse
  6339. Set which impulse video frames will be processed, can be @var{first}
  6340. or @var{all}. Default is @var{all}.
  6341. @end table
  6342. The @code{convolve} filter also supports the @ref{framesync} options.
  6343. @section copy
  6344. Copy the input video source unchanged to the output. This is mainly useful for
  6345. testing purposes.
  6346. @anchor{coreimage}
  6347. @section coreimage
  6348. Video filtering on GPU using Apple's CoreImage API on OSX.
  6349. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6350. processed by video hardware. However, software-based OpenGL implementations
  6351. exist which means there is no guarantee for hardware processing. It depends on
  6352. the respective OSX.
  6353. There are many filters and image generators provided by Apple that come with a
  6354. large variety of options. The filter has to be referenced by its name along
  6355. with its options.
  6356. The coreimage filter accepts the following options:
  6357. @table @option
  6358. @item list_filters
  6359. List all available filters and generators along with all their respective
  6360. options as well as possible minimum and maximum values along with the default
  6361. values.
  6362. @example
  6363. list_filters=true
  6364. @end example
  6365. @item filter
  6366. Specify all filters by their respective name and options.
  6367. Use @var{list_filters} to determine all valid filter names and options.
  6368. Numerical options are specified by a float value and are automatically clamped
  6369. to their respective value range. Vector and color options have to be specified
  6370. by a list of space separated float values. Character escaping has to be done.
  6371. A special option name @code{default} is available to use default options for a
  6372. filter.
  6373. It is required to specify either @code{default} or at least one of the filter options.
  6374. All omitted options are used with their default values.
  6375. The syntax of the filter string is as follows:
  6376. @example
  6377. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6378. @end example
  6379. @item output_rect
  6380. Specify a rectangle where the output of the filter chain is copied into the
  6381. input image. It is given by a list of space separated float values:
  6382. @example
  6383. output_rect=x\ y\ width\ height
  6384. @end example
  6385. If not given, the output rectangle equals the dimensions of the input image.
  6386. The output rectangle is automatically cropped at the borders of the input
  6387. image. Negative values are valid for each component.
  6388. @example
  6389. output_rect=25\ 25\ 100\ 100
  6390. @end example
  6391. @end table
  6392. Several filters can be chained for successive processing without GPU-HOST
  6393. transfers allowing for fast processing of complex filter chains.
  6394. Currently, only filters with zero (generators) or exactly one (filters) input
  6395. image and one output image are supported. Also, transition filters are not yet
  6396. usable as intended.
  6397. Some filters generate output images with additional padding depending on the
  6398. respective filter kernel. The padding is automatically removed to ensure the
  6399. filter output has the same size as the input image.
  6400. For image generators, the size of the output image is determined by the
  6401. previous output image of the filter chain or the input image of the whole
  6402. filterchain, respectively. The generators do not use the pixel information of
  6403. this image to generate their output. However, the generated output is
  6404. blended onto this image, resulting in partial or complete coverage of the
  6405. output image.
  6406. The @ref{coreimagesrc} video source can be used for generating input images
  6407. which are directly fed into the filter chain. By using it, providing input
  6408. images by another video source or an input video is not required.
  6409. @subsection Examples
  6410. @itemize
  6411. @item
  6412. List all filters available:
  6413. @example
  6414. coreimage=list_filters=true
  6415. @end example
  6416. @item
  6417. Use the CIBoxBlur filter with default options to blur an image:
  6418. @example
  6419. coreimage=filter=CIBoxBlur@@default
  6420. @end example
  6421. @item
  6422. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6423. its center at 100x100 and a radius of 50 pixels:
  6424. @example
  6425. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6426. @end example
  6427. @item
  6428. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6429. given as complete and escaped command-line for Apple's standard bash shell:
  6430. @example
  6431. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6432. @end example
  6433. @end itemize
  6434. @section cover_rect
  6435. Cover a rectangular object
  6436. It accepts the following options:
  6437. @table @option
  6438. @item cover
  6439. Filepath of the optional cover image, needs to be in yuv420.
  6440. @item mode
  6441. Set covering mode.
  6442. It accepts the following values:
  6443. @table @samp
  6444. @item cover
  6445. cover it by the supplied image
  6446. @item blur
  6447. cover it by interpolating the surrounding pixels
  6448. @end table
  6449. Default value is @var{blur}.
  6450. @end table
  6451. @subsection Examples
  6452. @itemize
  6453. @item
  6454. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6455. @example
  6456. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6457. @end example
  6458. @end itemize
  6459. @section crop
  6460. Crop the input video to given dimensions.
  6461. It accepts the following parameters:
  6462. @table @option
  6463. @item w, out_w
  6464. The width of the output video. It defaults to @code{iw}.
  6465. This expression is evaluated only once during the filter
  6466. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6467. @item h, out_h
  6468. The height of the output video. It defaults to @code{ih}.
  6469. This expression is evaluated only once during the filter
  6470. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6471. @item x
  6472. The horizontal position, in the input video, of the left edge of the output
  6473. video. It defaults to @code{(in_w-out_w)/2}.
  6474. This expression is evaluated per-frame.
  6475. @item y
  6476. The vertical position, in the input video, of the top edge of the output video.
  6477. It defaults to @code{(in_h-out_h)/2}.
  6478. This expression is evaluated per-frame.
  6479. @item keep_aspect
  6480. If set to 1 will force the output display aspect ratio
  6481. to be the same of the input, by changing the output sample aspect
  6482. ratio. It defaults to 0.
  6483. @item exact
  6484. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6485. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6486. It defaults to 0.
  6487. @end table
  6488. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6489. expressions containing the following constants:
  6490. @table @option
  6491. @item x
  6492. @item y
  6493. The computed values for @var{x} and @var{y}. They are evaluated for
  6494. each new frame.
  6495. @item in_w
  6496. @item in_h
  6497. The input width and height.
  6498. @item iw
  6499. @item ih
  6500. These are the same as @var{in_w} and @var{in_h}.
  6501. @item out_w
  6502. @item out_h
  6503. The output (cropped) width and height.
  6504. @item ow
  6505. @item oh
  6506. These are the same as @var{out_w} and @var{out_h}.
  6507. @item a
  6508. same as @var{iw} / @var{ih}
  6509. @item sar
  6510. input sample aspect ratio
  6511. @item dar
  6512. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6513. @item hsub
  6514. @item vsub
  6515. horizontal and vertical chroma subsample values. For example for the
  6516. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6517. @item n
  6518. The number of the input frame, starting from 0.
  6519. @item pos
  6520. the position in the file of the input frame, NAN if unknown
  6521. @item t
  6522. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6523. @end table
  6524. The expression for @var{out_w} may depend on the value of @var{out_h},
  6525. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6526. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6527. evaluated after @var{out_w} and @var{out_h}.
  6528. The @var{x} and @var{y} parameters specify the expressions for the
  6529. position of the top-left corner of the output (non-cropped) area. They
  6530. are evaluated for each frame. If the evaluated value is not valid, it
  6531. is approximated to the nearest valid value.
  6532. The expression for @var{x} may depend on @var{y}, and the expression
  6533. for @var{y} may depend on @var{x}.
  6534. @subsection Examples
  6535. @itemize
  6536. @item
  6537. Crop area with size 100x100 at position (12,34).
  6538. @example
  6539. crop=100:100:12:34
  6540. @end example
  6541. Using named options, the example above becomes:
  6542. @example
  6543. crop=w=100:h=100:x=12:y=34
  6544. @end example
  6545. @item
  6546. Crop the central input area with size 100x100:
  6547. @example
  6548. crop=100:100
  6549. @end example
  6550. @item
  6551. Crop the central input area with size 2/3 of the input video:
  6552. @example
  6553. crop=2/3*in_w:2/3*in_h
  6554. @end example
  6555. @item
  6556. Crop the input video central square:
  6557. @example
  6558. crop=out_w=in_h
  6559. crop=in_h
  6560. @end example
  6561. @item
  6562. Delimit the rectangle with the top-left corner placed at position
  6563. 100:100 and the right-bottom corner corresponding to the right-bottom
  6564. corner of the input image.
  6565. @example
  6566. crop=in_w-100:in_h-100:100:100
  6567. @end example
  6568. @item
  6569. Crop 10 pixels from the left and right borders, and 20 pixels from
  6570. the top and bottom borders
  6571. @example
  6572. crop=in_w-2*10:in_h-2*20
  6573. @end example
  6574. @item
  6575. Keep only the bottom right quarter of the input image:
  6576. @example
  6577. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6578. @end example
  6579. @item
  6580. Crop height for getting Greek harmony:
  6581. @example
  6582. crop=in_w:1/PHI*in_w
  6583. @end example
  6584. @item
  6585. Apply trembling effect:
  6586. @example
  6587. 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)
  6588. @end example
  6589. @item
  6590. Apply erratic camera effect depending on timestamp:
  6591. @example
  6592. 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)"
  6593. @end example
  6594. @item
  6595. Set x depending on the value of y:
  6596. @example
  6597. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6598. @end example
  6599. @end itemize
  6600. @subsection Commands
  6601. This filter supports the following commands:
  6602. @table @option
  6603. @item w, out_w
  6604. @item h, out_h
  6605. @item x
  6606. @item y
  6607. Set width/height of the output video and the horizontal/vertical position
  6608. in the input video.
  6609. The command accepts the same syntax of the corresponding option.
  6610. If the specified expression is not valid, it is kept at its current
  6611. value.
  6612. @end table
  6613. @section cropdetect
  6614. Auto-detect the crop size.
  6615. It calculates the necessary cropping parameters and prints the
  6616. recommended parameters via the logging system. The detected dimensions
  6617. correspond to the non-black area of the input video.
  6618. It accepts the following parameters:
  6619. @table @option
  6620. @item limit
  6621. Set higher black value threshold, which can be optionally specified
  6622. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6623. value greater to the set value is considered non-black. It defaults to 24.
  6624. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6625. on the bitdepth of the pixel format.
  6626. @item round
  6627. The value which the width/height should be divisible by. It defaults to
  6628. 16. The offset is automatically adjusted to center the video. Use 2 to
  6629. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6630. encoding to most video codecs.
  6631. @item reset_count, reset
  6632. Set the counter that determines after how many frames cropdetect will
  6633. reset the previously detected largest video area and start over to
  6634. detect the current optimal crop area. Default value is 0.
  6635. This can be useful when channel logos distort the video area. 0
  6636. indicates 'never reset', and returns the largest area encountered during
  6637. playback.
  6638. @end table
  6639. @anchor{cue}
  6640. @section cue
  6641. Delay video filtering until a given wallclock timestamp. The filter first
  6642. passes on @option{preroll} amount of frames, then it buffers at most
  6643. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6644. it forwards the buffered frames and also any subsequent frames coming in its
  6645. input.
  6646. The filter can be used synchronize the output of multiple ffmpeg processes for
  6647. realtime output devices like decklink. By putting the delay in the filtering
  6648. chain and pre-buffering frames the process can pass on data to output almost
  6649. immediately after the target wallclock timestamp is reached.
  6650. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6651. some use cases.
  6652. @table @option
  6653. @item cue
  6654. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6655. @item preroll
  6656. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6657. @item buffer
  6658. The maximum duration of content to buffer before waiting for the cue expressed
  6659. in seconds. Default is 0.
  6660. @end table
  6661. @anchor{curves}
  6662. @section curves
  6663. Apply color adjustments using curves.
  6664. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6665. component (red, green and blue) has its values defined by @var{N} key points
  6666. tied from each other using a smooth curve. The x-axis represents the pixel
  6667. values from the input frame, and the y-axis the new pixel values to be set for
  6668. the output frame.
  6669. By default, a component curve is defined by the two points @var{(0;0)} and
  6670. @var{(1;1)}. This creates a straight line where each original pixel value is
  6671. "adjusted" to its own value, which means no change to the image.
  6672. The filter allows you to redefine these two points and add some more. A new
  6673. curve (using a natural cubic spline interpolation) will be define to pass
  6674. smoothly through all these new coordinates. The new defined points needs to be
  6675. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6676. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6677. the vector spaces, the values will be clipped accordingly.
  6678. The filter accepts the following options:
  6679. @table @option
  6680. @item preset
  6681. Select one of the available color presets. This option can be used in addition
  6682. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6683. options takes priority on the preset values.
  6684. Available presets are:
  6685. @table @samp
  6686. @item none
  6687. @item color_negative
  6688. @item cross_process
  6689. @item darker
  6690. @item increase_contrast
  6691. @item lighter
  6692. @item linear_contrast
  6693. @item medium_contrast
  6694. @item negative
  6695. @item strong_contrast
  6696. @item vintage
  6697. @end table
  6698. Default is @code{none}.
  6699. @item master, m
  6700. Set the master key points. These points will define a second pass mapping. It
  6701. is sometimes called a "luminance" or "value" mapping. It can be used with
  6702. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6703. post-processing LUT.
  6704. @item red, r
  6705. Set the key points for the red component.
  6706. @item green, g
  6707. Set the key points for the green component.
  6708. @item blue, b
  6709. Set the key points for the blue component.
  6710. @item all
  6711. Set the key points for all components (not including master).
  6712. Can be used in addition to the other key points component
  6713. options. In this case, the unset component(s) will fallback on this
  6714. @option{all} setting.
  6715. @item psfile
  6716. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6717. @item plot
  6718. Save Gnuplot script of the curves in specified file.
  6719. @end table
  6720. To avoid some filtergraph syntax conflicts, each key points list need to be
  6721. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6722. @subsection Examples
  6723. @itemize
  6724. @item
  6725. Increase slightly the middle level of blue:
  6726. @example
  6727. curves=blue='0/0 0.5/0.58 1/1'
  6728. @end example
  6729. @item
  6730. Vintage effect:
  6731. @example
  6732. 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'
  6733. @end example
  6734. Here we obtain the following coordinates for each components:
  6735. @table @var
  6736. @item red
  6737. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6738. @item green
  6739. @code{(0;0) (0.50;0.48) (1;1)}
  6740. @item blue
  6741. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6742. @end table
  6743. @item
  6744. The previous example can also be achieved with the associated built-in preset:
  6745. @example
  6746. curves=preset=vintage
  6747. @end example
  6748. @item
  6749. Or simply:
  6750. @example
  6751. curves=vintage
  6752. @end example
  6753. @item
  6754. Use a Photoshop preset and redefine the points of the green component:
  6755. @example
  6756. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6757. @end example
  6758. @item
  6759. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6760. and @command{gnuplot}:
  6761. @example
  6762. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6763. gnuplot -p /tmp/curves.plt
  6764. @end example
  6765. @end itemize
  6766. @section datascope
  6767. Video data analysis filter.
  6768. This filter shows hexadecimal pixel values of part of video.
  6769. The filter accepts the following options:
  6770. @table @option
  6771. @item size, s
  6772. Set output video size.
  6773. @item x
  6774. Set x offset from where to pick pixels.
  6775. @item y
  6776. Set y offset from where to pick pixels.
  6777. @item mode
  6778. Set scope mode, can be one of the following:
  6779. @table @samp
  6780. @item mono
  6781. Draw hexadecimal pixel values with white color on black background.
  6782. @item color
  6783. Draw hexadecimal pixel values with input video pixel color on black
  6784. background.
  6785. @item color2
  6786. Draw hexadecimal pixel values on color background picked from input video,
  6787. the text color is picked in such way so its always visible.
  6788. @end table
  6789. @item axis
  6790. Draw rows and columns numbers on left and top of video.
  6791. @item opacity
  6792. Set background opacity.
  6793. @item format
  6794. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6795. @end table
  6796. @section dblur
  6797. Apply Directional blur filter.
  6798. The filter accepts the following options:
  6799. @table @option
  6800. @item angle
  6801. Set angle of directional blur. Default is @code{45}.
  6802. @item radius
  6803. Set radius of directional blur. Default is @code{5}.
  6804. @item planes
  6805. Set which planes to filter. By default all planes are filtered.
  6806. @end table
  6807. @subsection Commands
  6808. This filter supports same @ref{commands} as options.
  6809. The command accepts the same syntax of the corresponding option.
  6810. If the specified expression is not valid, it is kept at its current
  6811. value.
  6812. @section dctdnoiz
  6813. Denoise frames using 2D DCT (frequency domain filtering).
  6814. This filter is not designed for real time.
  6815. The filter accepts the following options:
  6816. @table @option
  6817. @item sigma, s
  6818. Set the noise sigma constant.
  6819. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6820. coefficient (absolute value) below this threshold with be dropped.
  6821. If you need a more advanced filtering, see @option{expr}.
  6822. Default is @code{0}.
  6823. @item overlap
  6824. Set number overlapping pixels for each block. Since the filter can be slow, you
  6825. may want to reduce this value, at the cost of a less effective filter and the
  6826. risk of various artefacts.
  6827. If the overlapping value doesn't permit processing the whole input width or
  6828. height, a warning will be displayed and according borders won't be denoised.
  6829. Default value is @var{blocksize}-1, which is the best possible setting.
  6830. @item expr, e
  6831. Set the coefficient factor expression.
  6832. For each coefficient of a DCT block, this expression will be evaluated as a
  6833. multiplier value for the coefficient.
  6834. If this is option is set, the @option{sigma} option will be ignored.
  6835. The absolute value of the coefficient can be accessed through the @var{c}
  6836. variable.
  6837. @item n
  6838. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6839. @var{blocksize}, which is the width and height of the processed blocks.
  6840. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6841. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6842. on the speed processing. Also, a larger block size does not necessarily means a
  6843. better de-noising.
  6844. @end table
  6845. @subsection Examples
  6846. Apply a denoise with a @option{sigma} of @code{4.5}:
  6847. @example
  6848. dctdnoiz=4.5
  6849. @end example
  6850. The same operation can be achieved using the expression system:
  6851. @example
  6852. dctdnoiz=e='gte(c, 4.5*3)'
  6853. @end example
  6854. Violent denoise using a block size of @code{16x16}:
  6855. @example
  6856. dctdnoiz=15:n=4
  6857. @end example
  6858. @section deband
  6859. Remove banding artifacts from input video.
  6860. It works by replacing banded pixels with average value of referenced pixels.
  6861. The filter accepts the following options:
  6862. @table @option
  6863. @item 1thr
  6864. @item 2thr
  6865. @item 3thr
  6866. @item 4thr
  6867. Set banding detection threshold for each plane. Default is 0.02.
  6868. Valid range is 0.00003 to 0.5.
  6869. If difference between current pixel and reference pixel is less than threshold,
  6870. it will be considered as banded.
  6871. @item range, r
  6872. Banding detection range in pixels. Default is 16. If positive, random number
  6873. in range 0 to set value will be used. If negative, exact absolute value
  6874. will be used.
  6875. The range defines square of four pixels around current pixel.
  6876. @item direction, d
  6877. Set direction in radians from which four pixel will be compared. If positive,
  6878. random direction from 0 to set direction will be picked. If negative, exact of
  6879. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6880. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6881. column.
  6882. @item blur, b
  6883. If enabled, current pixel is compared with average value of all four
  6884. surrounding pixels. The default is enabled. If disabled current pixel is
  6885. compared with all four surrounding pixels. The pixel is considered banded
  6886. if only all four differences with surrounding pixels are less than threshold.
  6887. @item coupling, c
  6888. If enabled, current pixel is changed if and only if all pixel components are banded,
  6889. e.g. banding detection threshold is triggered for all color components.
  6890. The default is disabled.
  6891. @end table
  6892. @section deblock
  6893. Remove blocking artifacts from input video.
  6894. The filter accepts the following options:
  6895. @table @option
  6896. @item filter
  6897. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6898. This controls what kind of deblocking is applied.
  6899. @item block
  6900. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6901. @item alpha
  6902. @item beta
  6903. @item gamma
  6904. @item delta
  6905. Set blocking detection thresholds. Allowed range is 0 to 1.
  6906. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6907. Using higher threshold gives more deblocking strength.
  6908. Setting @var{alpha} controls threshold detection at exact edge of block.
  6909. Remaining options controls threshold detection near the edge. Each one for
  6910. below/above or left/right. Setting any of those to @var{0} disables
  6911. deblocking.
  6912. @item planes
  6913. Set planes to filter. Default is to filter all available planes.
  6914. @end table
  6915. @subsection Examples
  6916. @itemize
  6917. @item
  6918. Deblock using weak filter and block size of 4 pixels.
  6919. @example
  6920. deblock=filter=weak:block=4
  6921. @end example
  6922. @item
  6923. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6924. deblocking more edges.
  6925. @example
  6926. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6927. @end example
  6928. @item
  6929. Similar as above, but filter only first plane.
  6930. @example
  6931. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6932. @end example
  6933. @item
  6934. Similar as above, but filter only second and third plane.
  6935. @example
  6936. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6937. @end example
  6938. @end itemize
  6939. @anchor{decimate}
  6940. @section decimate
  6941. Drop duplicated frames at regular intervals.
  6942. The filter accepts the following options:
  6943. @table @option
  6944. @item cycle
  6945. Set the number of frames from which one will be dropped. Setting this to
  6946. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6947. Default is @code{5}.
  6948. @item dupthresh
  6949. Set the threshold for duplicate detection. If the difference metric for a frame
  6950. is less than or equal to this value, then it is declared as duplicate. Default
  6951. is @code{1.1}
  6952. @item scthresh
  6953. Set scene change threshold. Default is @code{15}.
  6954. @item blockx
  6955. @item blocky
  6956. Set the size of the x and y-axis blocks used during metric calculations.
  6957. Larger blocks give better noise suppression, but also give worse detection of
  6958. small movements. Must be a power of two. Default is @code{32}.
  6959. @item ppsrc
  6960. Mark main input as a pre-processed input and activate clean source input
  6961. stream. This allows the input to be pre-processed with various filters to help
  6962. the metrics calculation while keeping the frame selection lossless. When set to
  6963. @code{1}, the first stream is for the pre-processed input, and the second
  6964. stream is the clean source from where the kept frames are chosen. Default is
  6965. @code{0}.
  6966. @item chroma
  6967. Set whether or not chroma is considered in the metric calculations. Default is
  6968. @code{1}.
  6969. @end table
  6970. @section deconvolve
  6971. Apply 2D deconvolution of video stream in frequency domain using second stream
  6972. as impulse.
  6973. The filter accepts the following options:
  6974. @table @option
  6975. @item planes
  6976. Set which planes to process.
  6977. @item impulse
  6978. Set which impulse video frames will be processed, can be @var{first}
  6979. or @var{all}. Default is @var{all}.
  6980. @item noise
  6981. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6982. and height are not same and not power of 2 or if stream prior to convolving
  6983. had noise.
  6984. @end table
  6985. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6986. @section dedot
  6987. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6988. It accepts the following options:
  6989. @table @option
  6990. @item m
  6991. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6992. @var{rainbows} for cross-color reduction.
  6993. @item lt
  6994. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6995. @item tl
  6996. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6997. @item tc
  6998. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6999. @item ct
  7000. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7001. @end table
  7002. @section deflate
  7003. Apply deflate effect to the video.
  7004. This filter replaces the pixel by the local(3x3) average by taking into account
  7005. only values lower than the pixel.
  7006. It accepts the following options:
  7007. @table @option
  7008. @item threshold0
  7009. @item threshold1
  7010. @item threshold2
  7011. @item threshold3
  7012. Limit the maximum change for each plane, default is 65535.
  7013. If 0, plane will remain unchanged.
  7014. @end table
  7015. @subsection Commands
  7016. This filter supports the all above options as @ref{commands}.
  7017. @section deflicker
  7018. Remove temporal frame luminance variations.
  7019. It accepts the following options:
  7020. @table @option
  7021. @item size, s
  7022. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7023. @item mode, m
  7024. Set averaging mode to smooth temporal luminance variations.
  7025. Available values are:
  7026. @table @samp
  7027. @item am
  7028. Arithmetic mean
  7029. @item gm
  7030. Geometric mean
  7031. @item hm
  7032. Harmonic mean
  7033. @item qm
  7034. Quadratic mean
  7035. @item cm
  7036. Cubic mean
  7037. @item pm
  7038. Power mean
  7039. @item median
  7040. Median
  7041. @end table
  7042. @item bypass
  7043. Do not actually modify frame. Useful when one only wants metadata.
  7044. @end table
  7045. @section dejudder
  7046. Remove judder produced by partially interlaced telecined content.
  7047. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7048. source was partially telecined content then the output of @code{pullup,dejudder}
  7049. will have a variable frame rate. May change the recorded frame rate of the
  7050. container. Aside from that change, this filter will not affect constant frame
  7051. rate video.
  7052. The option available in this filter is:
  7053. @table @option
  7054. @item cycle
  7055. Specify the length of the window over which the judder repeats.
  7056. Accepts any integer greater than 1. Useful values are:
  7057. @table @samp
  7058. @item 4
  7059. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7060. @item 5
  7061. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7062. @item 20
  7063. If a mixture of the two.
  7064. @end table
  7065. The default is @samp{4}.
  7066. @end table
  7067. @section delogo
  7068. Suppress a TV station logo by a simple interpolation of the surrounding
  7069. pixels. Just set a rectangle covering the logo and watch it disappear
  7070. (and sometimes something even uglier appear - your mileage may vary).
  7071. It accepts the following parameters:
  7072. @table @option
  7073. @item x
  7074. @item y
  7075. Specify the top left corner coordinates of the logo. They must be
  7076. specified.
  7077. @item w
  7078. @item h
  7079. Specify the width and height of the logo to clear. They must be
  7080. specified.
  7081. @item band, t
  7082. Specify the thickness of the fuzzy edge of the rectangle (added to
  7083. @var{w} and @var{h}). The default value is 1. This option is
  7084. deprecated, setting higher values should no longer be necessary and
  7085. is not recommended.
  7086. @item show
  7087. When set to 1, a green rectangle is drawn on the screen to simplify
  7088. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7089. The default value is 0.
  7090. The rectangle is drawn on the outermost pixels which will be (partly)
  7091. replaced with interpolated values. The values of the next pixels
  7092. immediately outside this rectangle in each direction will be used to
  7093. compute the interpolated pixel values inside the rectangle.
  7094. @end table
  7095. @subsection Examples
  7096. @itemize
  7097. @item
  7098. Set a rectangle covering the area with top left corner coordinates 0,0
  7099. and size 100x77, and a band of size 10:
  7100. @example
  7101. delogo=x=0:y=0:w=100:h=77:band=10
  7102. @end example
  7103. @end itemize
  7104. @anchor{derain}
  7105. @section derain
  7106. Remove the rain in the input image/video by applying the derain methods based on
  7107. convolutional neural networks. Supported models:
  7108. @itemize
  7109. @item
  7110. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7111. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7112. @end itemize
  7113. Training as well as model generation scripts are provided in
  7114. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7115. Native model files (.model) can be generated from TensorFlow model
  7116. files (.pb) by using tools/python/convert.py
  7117. The filter accepts the following options:
  7118. @table @option
  7119. @item filter_type
  7120. Specify which filter to use. This option accepts the following values:
  7121. @table @samp
  7122. @item derain
  7123. Derain filter. To conduct derain filter, you need to use a derain model.
  7124. @item dehaze
  7125. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7126. @end table
  7127. Default value is @samp{derain}.
  7128. @item dnn_backend
  7129. Specify which DNN backend to use for model loading and execution. This option accepts
  7130. the following values:
  7131. @table @samp
  7132. @item native
  7133. Native implementation of DNN loading and execution.
  7134. @item tensorflow
  7135. TensorFlow backend. To enable this backend you
  7136. need to install the TensorFlow for C library (see
  7137. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7138. @code{--enable-libtensorflow}
  7139. @end table
  7140. Default value is @samp{native}.
  7141. @item model
  7142. Set path to model file specifying network architecture and its parameters.
  7143. Note that different backends use different file formats. TensorFlow and native
  7144. backend can load files for only its format.
  7145. @end table
  7146. It can also be finished with @ref{dnn_processing} filter.
  7147. @section deshake
  7148. Attempt to fix small changes in horizontal and/or vertical shift. This
  7149. filter helps remove camera shake from hand-holding a camera, bumping a
  7150. tripod, moving on a vehicle, etc.
  7151. The filter accepts the following options:
  7152. @table @option
  7153. @item x
  7154. @item y
  7155. @item w
  7156. @item h
  7157. Specify a rectangular area where to limit the search for motion
  7158. vectors.
  7159. If desired the search for motion vectors can be limited to a
  7160. rectangular area of the frame defined by its top left corner, width
  7161. and height. These parameters have the same meaning as the drawbox
  7162. filter which can be used to visualise the position of the bounding
  7163. box.
  7164. This is useful when simultaneous movement of subjects within the frame
  7165. might be confused for camera motion by the motion vector search.
  7166. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7167. then the full frame is used. This allows later options to be set
  7168. without specifying the bounding box for the motion vector search.
  7169. Default - search the whole frame.
  7170. @item rx
  7171. @item ry
  7172. Specify the maximum extent of movement in x and y directions in the
  7173. range 0-64 pixels. Default 16.
  7174. @item edge
  7175. Specify how to generate pixels to fill blanks at the edge of the
  7176. frame. Available values are:
  7177. @table @samp
  7178. @item blank, 0
  7179. Fill zeroes at blank locations
  7180. @item original, 1
  7181. Original image at blank locations
  7182. @item clamp, 2
  7183. Extruded edge value at blank locations
  7184. @item mirror, 3
  7185. Mirrored edge at blank locations
  7186. @end table
  7187. Default value is @samp{mirror}.
  7188. @item blocksize
  7189. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7190. default 8.
  7191. @item contrast
  7192. Specify the contrast threshold for blocks. Only blocks with more than
  7193. the specified contrast (difference between darkest and lightest
  7194. pixels) will be considered. Range 1-255, default 125.
  7195. @item search
  7196. Specify the search strategy. Available values are:
  7197. @table @samp
  7198. @item exhaustive, 0
  7199. Set exhaustive search
  7200. @item less, 1
  7201. Set less exhaustive search.
  7202. @end table
  7203. Default value is @samp{exhaustive}.
  7204. @item filename
  7205. If set then a detailed log of the motion search is written to the
  7206. specified file.
  7207. @end table
  7208. @section despill
  7209. Remove unwanted contamination of foreground colors, caused by reflected color of
  7210. greenscreen or bluescreen.
  7211. This filter accepts the following options:
  7212. @table @option
  7213. @item type
  7214. Set what type of despill to use.
  7215. @item mix
  7216. Set how spillmap will be generated.
  7217. @item expand
  7218. Set how much to get rid of still remaining spill.
  7219. @item red
  7220. Controls amount of red in spill area.
  7221. @item green
  7222. Controls amount of green in spill area.
  7223. Should be -1 for greenscreen.
  7224. @item blue
  7225. Controls amount of blue in spill area.
  7226. Should be -1 for bluescreen.
  7227. @item brightness
  7228. Controls brightness of spill area, preserving colors.
  7229. @item alpha
  7230. Modify alpha from generated spillmap.
  7231. @end table
  7232. @section detelecine
  7233. Apply an exact inverse of the telecine operation. It requires a predefined
  7234. pattern specified using the pattern option which must be the same as that passed
  7235. to the telecine filter.
  7236. This filter accepts the following options:
  7237. @table @option
  7238. @item first_field
  7239. @table @samp
  7240. @item top, t
  7241. top field first
  7242. @item bottom, b
  7243. bottom field first
  7244. The default value is @code{top}.
  7245. @end table
  7246. @item pattern
  7247. A string of numbers representing the pulldown pattern you wish to apply.
  7248. The default value is @code{23}.
  7249. @item start_frame
  7250. A number representing position of the first frame with respect to the telecine
  7251. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7252. @end table
  7253. @section dilation
  7254. Apply dilation effect to the video.
  7255. This filter replaces the pixel by the local(3x3) maximum.
  7256. It accepts the following options:
  7257. @table @option
  7258. @item threshold0
  7259. @item threshold1
  7260. @item threshold2
  7261. @item threshold3
  7262. Limit the maximum change for each plane, default is 65535.
  7263. If 0, plane will remain unchanged.
  7264. @item coordinates
  7265. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7266. pixels are used.
  7267. Flags to local 3x3 coordinates maps like this:
  7268. 1 2 3
  7269. 4 5
  7270. 6 7 8
  7271. @end table
  7272. @subsection Commands
  7273. This filter supports the all above options as @ref{commands}.
  7274. @section displace
  7275. Displace pixels as indicated by second and third input stream.
  7276. It takes three input streams and outputs one stream, the first input is the
  7277. source, and second and third input are displacement maps.
  7278. The second input specifies how much to displace pixels along the
  7279. x-axis, while the third input specifies how much to displace pixels
  7280. along the y-axis.
  7281. If one of displacement map streams terminates, last frame from that
  7282. displacement map will be used.
  7283. Note that once generated, displacements maps can be reused over and over again.
  7284. A description of the accepted options follows.
  7285. @table @option
  7286. @item edge
  7287. Set displace behavior for pixels that are out of range.
  7288. Available values are:
  7289. @table @samp
  7290. @item blank
  7291. Missing pixels are replaced by black pixels.
  7292. @item smear
  7293. Adjacent pixels will spread out to replace missing pixels.
  7294. @item wrap
  7295. Out of range pixels are wrapped so they point to pixels of other side.
  7296. @item mirror
  7297. Out of range pixels will be replaced with mirrored pixels.
  7298. @end table
  7299. Default is @samp{smear}.
  7300. @end table
  7301. @subsection Examples
  7302. @itemize
  7303. @item
  7304. Add ripple effect to rgb input of video size hd720:
  7305. @example
  7306. 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
  7307. @end example
  7308. @item
  7309. Add wave effect to rgb input of video size hd720:
  7310. @example
  7311. 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
  7312. @end example
  7313. @end itemize
  7314. @anchor{dnn_processing}
  7315. @section dnn_processing
  7316. Do image processing with deep neural networks. It works together with another filter
  7317. which converts the pixel format of the Frame to what the dnn network requires.
  7318. The filter accepts the following options:
  7319. @table @option
  7320. @item dnn_backend
  7321. Specify which DNN backend to use for model loading and execution. This option accepts
  7322. the following values:
  7323. @table @samp
  7324. @item native
  7325. Native implementation of DNN loading and execution.
  7326. @item tensorflow
  7327. TensorFlow backend. To enable this backend you
  7328. need to install the TensorFlow for C library (see
  7329. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7330. @code{--enable-libtensorflow}
  7331. @item openvino
  7332. OpenVINO backend. To enable this backend you
  7333. need to build and install the OpenVINO for C library (see
  7334. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7335. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7336. be needed if the header files and libraries are not installed into system path)
  7337. @end table
  7338. Default value is @samp{native}.
  7339. @item model
  7340. Set path to model file specifying network architecture and its parameters.
  7341. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7342. backend can load files for only its format.
  7343. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7344. @item input
  7345. Set the input name of the dnn network.
  7346. @item output
  7347. Set the output name of the dnn network.
  7348. @end table
  7349. @subsection Examples
  7350. @itemize
  7351. @item
  7352. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7353. @example
  7354. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7355. @end example
  7356. @item
  7357. Halve the pixel value of the frame with format gray32f:
  7358. @example
  7359. 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
  7360. @end example
  7361. @item
  7362. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7363. @example
  7364. ./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
  7365. @end example
  7366. @item
  7367. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7368. @example
  7369. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7370. @end example
  7371. @end itemize
  7372. @section drawbox
  7373. Draw a colored box on the input image.
  7374. It accepts the following parameters:
  7375. @table @option
  7376. @item x
  7377. @item y
  7378. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7379. @item width, w
  7380. @item height, h
  7381. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7382. the input width and height. It defaults to 0.
  7383. @item color, c
  7384. Specify the color of the box to write. For the general syntax of this option,
  7385. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7386. value @code{invert} is used, the box edge color is the same as the
  7387. video with inverted luma.
  7388. @item thickness, t
  7389. The expression which sets the thickness of the box edge.
  7390. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7391. See below for the list of accepted constants.
  7392. @item replace
  7393. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7394. will overwrite the video's color and alpha pixels.
  7395. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7396. @end table
  7397. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7398. following constants:
  7399. @table @option
  7400. @item dar
  7401. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7402. @item hsub
  7403. @item vsub
  7404. horizontal and vertical chroma subsample values. For example for the
  7405. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7406. @item in_h, ih
  7407. @item in_w, iw
  7408. The input width and height.
  7409. @item sar
  7410. The input sample aspect ratio.
  7411. @item x
  7412. @item y
  7413. The x and y offset coordinates where the box is drawn.
  7414. @item w
  7415. @item h
  7416. The width and height of the drawn box.
  7417. @item t
  7418. The thickness of the drawn box.
  7419. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7420. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7421. @end table
  7422. @subsection Examples
  7423. @itemize
  7424. @item
  7425. Draw a black box around the edge of the input image:
  7426. @example
  7427. drawbox
  7428. @end example
  7429. @item
  7430. Draw a box with color red and an opacity of 50%:
  7431. @example
  7432. drawbox=10:20:200:60:red@@0.5
  7433. @end example
  7434. The previous example can be specified as:
  7435. @example
  7436. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7437. @end example
  7438. @item
  7439. Fill the box with pink color:
  7440. @example
  7441. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7442. @end example
  7443. @item
  7444. Draw a 2-pixel red 2.40:1 mask:
  7445. @example
  7446. 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
  7447. @end example
  7448. @end itemize
  7449. @subsection Commands
  7450. This filter supports same commands as options.
  7451. The command accepts the same syntax of the corresponding option.
  7452. If the specified expression is not valid, it is kept at its current
  7453. value.
  7454. @anchor{drawgraph}
  7455. @section drawgraph
  7456. Draw a graph using input video metadata.
  7457. It accepts the following parameters:
  7458. @table @option
  7459. @item m1
  7460. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7461. @item fg1
  7462. Set 1st foreground color expression.
  7463. @item m2
  7464. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7465. @item fg2
  7466. Set 2nd foreground color expression.
  7467. @item m3
  7468. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7469. @item fg3
  7470. Set 3rd foreground color expression.
  7471. @item m4
  7472. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7473. @item fg4
  7474. Set 4th foreground color expression.
  7475. @item min
  7476. Set minimal value of metadata value.
  7477. @item max
  7478. Set maximal value of metadata value.
  7479. @item bg
  7480. Set graph background color. Default is white.
  7481. @item mode
  7482. Set graph mode.
  7483. Available values for mode is:
  7484. @table @samp
  7485. @item bar
  7486. @item dot
  7487. @item line
  7488. @end table
  7489. Default is @code{line}.
  7490. @item slide
  7491. Set slide mode.
  7492. Available values for slide is:
  7493. @table @samp
  7494. @item frame
  7495. Draw new frame when right border is reached.
  7496. @item replace
  7497. Replace old columns with new ones.
  7498. @item scroll
  7499. Scroll from right to left.
  7500. @item rscroll
  7501. Scroll from left to right.
  7502. @item picture
  7503. Draw single picture.
  7504. @end table
  7505. Default is @code{frame}.
  7506. @item size
  7507. Set size of graph video. For the syntax of this option, check the
  7508. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7509. The default value is @code{900x256}.
  7510. @item rate, r
  7511. Set the output frame rate. Default value is @code{25}.
  7512. The foreground color expressions can use the following variables:
  7513. @table @option
  7514. @item MIN
  7515. Minimal value of metadata value.
  7516. @item MAX
  7517. Maximal value of metadata value.
  7518. @item VAL
  7519. Current metadata key value.
  7520. @end table
  7521. The color is defined as 0xAABBGGRR.
  7522. @end table
  7523. Example using metadata from @ref{signalstats} filter:
  7524. @example
  7525. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7526. @end example
  7527. Example using metadata from @ref{ebur128} filter:
  7528. @example
  7529. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7530. @end example
  7531. @section drawgrid
  7532. Draw a grid on the input image.
  7533. It accepts the following parameters:
  7534. @table @option
  7535. @item x
  7536. @item y
  7537. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7538. @item width, w
  7539. @item height, h
  7540. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7541. input width and height, respectively, minus @code{thickness}, so image gets
  7542. framed. Default to 0.
  7543. @item color, c
  7544. Specify the color of the grid. For the general syntax of this option,
  7545. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7546. value @code{invert} is used, the grid color is the same as the
  7547. video with inverted luma.
  7548. @item thickness, t
  7549. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7550. See below for the list of accepted constants.
  7551. @item replace
  7552. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7553. will overwrite the video's color and alpha pixels.
  7554. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7555. @end table
  7556. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7557. following constants:
  7558. @table @option
  7559. @item dar
  7560. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7561. @item hsub
  7562. @item vsub
  7563. horizontal and vertical chroma subsample values. For example for the
  7564. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7565. @item in_h, ih
  7566. @item in_w, iw
  7567. The input grid cell width and height.
  7568. @item sar
  7569. The input sample aspect ratio.
  7570. @item x
  7571. @item y
  7572. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7573. @item w
  7574. @item h
  7575. The width and height of the drawn cell.
  7576. @item t
  7577. The thickness of the drawn cell.
  7578. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7579. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7580. @end table
  7581. @subsection Examples
  7582. @itemize
  7583. @item
  7584. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7585. @example
  7586. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7587. @end example
  7588. @item
  7589. Draw a white 3x3 grid with an opacity of 50%:
  7590. @example
  7591. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7592. @end example
  7593. @end itemize
  7594. @subsection Commands
  7595. This filter supports same commands as options.
  7596. The command accepts the same syntax of the corresponding option.
  7597. If the specified expression is not valid, it is kept at its current
  7598. value.
  7599. @anchor{drawtext}
  7600. @section drawtext
  7601. Draw a text string or text from a specified file on top of a video, using the
  7602. libfreetype library.
  7603. To enable compilation of this filter, you need to configure FFmpeg with
  7604. @code{--enable-libfreetype}.
  7605. To enable default font fallback and the @var{font} option you need to
  7606. configure FFmpeg with @code{--enable-libfontconfig}.
  7607. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7608. @code{--enable-libfribidi}.
  7609. @subsection Syntax
  7610. It accepts the following parameters:
  7611. @table @option
  7612. @item box
  7613. Used to draw a box around text using the background color.
  7614. The value must be either 1 (enable) or 0 (disable).
  7615. The default value of @var{box} is 0.
  7616. @item boxborderw
  7617. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7618. The default value of @var{boxborderw} is 0.
  7619. @item boxcolor
  7620. The color to be used for drawing box around text. For the syntax of this
  7621. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7622. The default value of @var{boxcolor} is "white".
  7623. @item line_spacing
  7624. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7625. The default value of @var{line_spacing} is 0.
  7626. @item borderw
  7627. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7628. The default value of @var{borderw} is 0.
  7629. @item bordercolor
  7630. Set the color to be used for drawing border around text. For the syntax of this
  7631. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7632. The default value of @var{bordercolor} is "black".
  7633. @item expansion
  7634. Select how the @var{text} is expanded. Can be either @code{none},
  7635. @code{strftime} (deprecated) or
  7636. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7637. below for details.
  7638. @item basetime
  7639. Set a start time for the count. Value is in microseconds. Only applied
  7640. in the deprecated strftime expansion mode. To emulate in normal expansion
  7641. mode use the @code{pts} function, supplying the start time (in seconds)
  7642. as the second argument.
  7643. @item fix_bounds
  7644. If true, check and fix text coords to avoid clipping.
  7645. @item fontcolor
  7646. The color to be used for drawing fonts. For the syntax of this option, check
  7647. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7648. The default value of @var{fontcolor} is "black".
  7649. @item fontcolor_expr
  7650. String which is expanded the same way as @var{text} to obtain dynamic
  7651. @var{fontcolor} value. By default this option has empty value and is not
  7652. processed. When this option is set, it overrides @var{fontcolor} option.
  7653. @item font
  7654. The font family to be used for drawing text. By default Sans.
  7655. @item fontfile
  7656. The font file to be used for drawing text. The path must be included.
  7657. This parameter is mandatory if the fontconfig support is disabled.
  7658. @item alpha
  7659. Draw the text applying alpha blending. The value can
  7660. be a number between 0.0 and 1.0.
  7661. The expression accepts the same variables @var{x, y} as well.
  7662. The default value is 1.
  7663. Please see @var{fontcolor_expr}.
  7664. @item fontsize
  7665. The font size to be used for drawing text.
  7666. The default value of @var{fontsize} is 16.
  7667. @item text_shaping
  7668. If set to 1, attempt to shape the text (for example, reverse the order of
  7669. right-to-left text and join Arabic characters) before drawing it.
  7670. Otherwise, just draw the text exactly as given.
  7671. By default 1 (if supported).
  7672. @item ft_load_flags
  7673. The flags to be used for loading the fonts.
  7674. The flags map the corresponding flags supported by libfreetype, and are
  7675. a combination of the following values:
  7676. @table @var
  7677. @item default
  7678. @item no_scale
  7679. @item no_hinting
  7680. @item render
  7681. @item no_bitmap
  7682. @item vertical_layout
  7683. @item force_autohint
  7684. @item crop_bitmap
  7685. @item pedantic
  7686. @item ignore_global_advance_width
  7687. @item no_recurse
  7688. @item ignore_transform
  7689. @item monochrome
  7690. @item linear_design
  7691. @item no_autohint
  7692. @end table
  7693. Default value is "default".
  7694. For more information consult the documentation for the FT_LOAD_*
  7695. libfreetype flags.
  7696. @item shadowcolor
  7697. The color to be used for drawing a shadow behind the drawn text. For the
  7698. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7699. ffmpeg-utils manual,ffmpeg-utils}.
  7700. The default value of @var{shadowcolor} is "black".
  7701. @item shadowx
  7702. @item shadowy
  7703. The x and y offsets for the text shadow position with respect to the
  7704. position of the text. They can be either positive or negative
  7705. values. The default value for both is "0".
  7706. @item start_number
  7707. The starting frame number for the n/frame_num variable. The default value
  7708. is "0".
  7709. @item tabsize
  7710. The size in number of spaces to use for rendering the tab.
  7711. Default value is 4.
  7712. @item timecode
  7713. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7714. format. It can be used with or without text parameter. @var{timecode_rate}
  7715. option must be specified.
  7716. @item timecode_rate, rate, r
  7717. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7718. integer. Minimum value is "1".
  7719. Drop-frame timecode is supported for frame rates 30 & 60.
  7720. @item tc24hmax
  7721. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7722. Default is 0 (disabled).
  7723. @item text
  7724. The text string to be drawn. The text must be a sequence of UTF-8
  7725. encoded characters.
  7726. This parameter is mandatory if no file is specified with the parameter
  7727. @var{textfile}.
  7728. @item textfile
  7729. A text file containing text to be drawn. The text must be a sequence
  7730. of UTF-8 encoded characters.
  7731. This parameter is mandatory if no text string is specified with the
  7732. parameter @var{text}.
  7733. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7734. @item reload
  7735. If set to 1, the @var{textfile} will be reloaded before each frame.
  7736. Be sure to update it atomically, or it may be read partially, or even fail.
  7737. @item x
  7738. @item y
  7739. The expressions which specify the offsets where text will be drawn
  7740. within the video frame. They are relative to the top/left border of the
  7741. output image.
  7742. The default value of @var{x} and @var{y} is "0".
  7743. See below for the list of accepted constants and functions.
  7744. @end table
  7745. The parameters for @var{x} and @var{y} are expressions containing the
  7746. following constants and functions:
  7747. @table @option
  7748. @item dar
  7749. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7750. @item hsub
  7751. @item vsub
  7752. horizontal and vertical chroma subsample values. For example for the
  7753. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7754. @item line_h, lh
  7755. the height of each text line
  7756. @item main_h, h, H
  7757. the input height
  7758. @item main_w, w, W
  7759. the input width
  7760. @item max_glyph_a, ascent
  7761. the maximum distance from the baseline to the highest/upper grid
  7762. coordinate used to place a glyph outline point, for all the rendered
  7763. glyphs.
  7764. It is a positive value, due to the grid's orientation with the Y axis
  7765. upwards.
  7766. @item max_glyph_d, descent
  7767. the maximum distance from the baseline to the lowest grid coordinate
  7768. used to place a glyph outline point, for all the rendered glyphs.
  7769. This is a negative value, due to the grid's orientation, with the Y axis
  7770. upwards.
  7771. @item max_glyph_h
  7772. maximum glyph height, that is the maximum height for all the glyphs
  7773. contained in the rendered text, it is equivalent to @var{ascent} -
  7774. @var{descent}.
  7775. @item max_glyph_w
  7776. maximum glyph width, that is the maximum width for all the glyphs
  7777. contained in the rendered text
  7778. @item n
  7779. the number of input frame, starting from 0
  7780. @item rand(min, max)
  7781. return a random number included between @var{min} and @var{max}
  7782. @item sar
  7783. The input sample aspect ratio.
  7784. @item t
  7785. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7786. @item text_h, th
  7787. the height of the rendered text
  7788. @item text_w, tw
  7789. the width of the rendered text
  7790. @item x
  7791. @item y
  7792. the x and y offset coordinates where the text is drawn.
  7793. These parameters allow the @var{x} and @var{y} expressions to refer
  7794. to each other, so you can for example specify @code{y=x/dar}.
  7795. @item pict_type
  7796. A one character description of the current frame's picture type.
  7797. @item pkt_pos
  7798. The current packet's position in the input file or stream
  7799. (in bytes, from the start of the input). A value of -1 indicates
  7800. this info is not available.
  7801. @item pkt_duration
  7802. The current packet's duration, in seconds.
  7803. @item pkt_size
  7804. The current packet's size (in bytes).
  7805. @end table
  7806. @anchor{drawtext_expansion}
  7807. @subsection Text expansion
  7808. If @option{expansion} is set to @code{strftime},
  7809. the filter recognizes strftime() sequences in the provided text and
  7810. expands them accordingly. Check the documentation of strftime(). This
  7811. feature is deprecated.
  7812. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7813. If @option{expansion} is set to @code{normal} (which is the default),
  7814. the following expansion mechanism is used.
  7815. The backslash character @samp{\}, followed by any character, always expands to
  7816. the second character.
  7817. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7818. braces is a function name, possibly followed by arguments separated by ':'.
  7819. If the arguments contain special characters or delimiters (':' or '@}'),
  7820. they should be escaped.
  7821. Note that they probably must also be escaped as the value for the
  7822. @option{text} option in the filter argument string and as the filter
  7823. argument in the filtergraph description, and possibly also for the shell,
  7824. that makes up to four levels of escaping; using a text file avoids these
  7825. problems.
  7826. The following functions are available:
  7827. @table @command
  7828. @item expr, e
  7829. The expression evaluation result.
  7830. It must take one argument specifying the expression to be evaluated,
  7831. which accepts the same constants and functions as the @var{x} and
  7832. @var{y} values. Note that not all constants should be used, for
  7833. example the text size is not known when evaluating the expression, so
  7834. the constants @var{text_w} and @var{text_h} will have an undefined
  7835. value.
  7836. @item expr_int_format, eif
  7837. Evaluate the expression's value and output as formatted integer.
  7838. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7839. The second argument specifies the output format. Allowed values are @samp{x},
  7840. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7841. @code{printf} function.
  7842. The third parameter is optional and sets the number of positions taken by the output.
  7843. It can be used to add padding with zeros from the left.
  7844. @item gmtime
  7845. The time at which the filter is running, expressed in UTC.
  7846. It can accept an argument: a strftime() format string.
  7847. @item localtime
  7848. The time at which the filter is running, expressed in the local time zone.
  7849. It can accept an argument: a strftime() format string.
  7850. @item metadata
  7851. Frame metadata. Takes one or two arguments.
  7852. The first argument is mandatory and specifies the metadata key.
  7853. The second argument is optional and specifies a default value, used when the
  7854. metadata key is not found or empty.
  7855. Available metadata can be identified by inspecting entries
  7856. starting with TAG included within each frame section
  7857. printed by running @code{ffprobe -show_frames}.
  7858. String metadata generated in filters leading to
  7859. the drawtext filter are also available.
  7860. @item n, frame_num
  7861. The frame number, starting from 0.
  7862. @item pict_type
  7863. A one character description of the current picture type.
  7864. @item pts
  7865. The timestamp of the current frame.
  7866. It can take up to three arguments.
  7867. The first argument is the format of the timestamp; it defaults to @code{flt}
  7868. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7869. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7870. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7871. @code{localtime} stands for the timestamp of the frame formatted as
  7872. local time zone time.
  7873. The second argument is an offset added to the timestamp.
  7874. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7875. supplied to present the hour part of the formatted timestamp in 24h format
  7876. (00-23).
  7877. If the format is set to @code{localtime} or @code{gmtime},
  7878. a third argument may be supplied: a strftime() format string.
  7879. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7880. @end table
  7881. @subsection Commands
  7882. This filter supports altering parameters via commands:
  7883. @table @option
  7884. @item reinit
  7885. Alter existing filter parameters.
  7886. Syntax for the argument is the same as for filter invocation, e.g.
  7887. @example
  7888. fontsize=56:fontcolor=green:text='Hello World'
  7889. @end example
  7890. Full filter invocation with sendcmd would look like this:
  7891. @example
  7892. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7893. @end example
  7894. @end table
  7895. If the entire argument can't be parsed or applied as valid values then the filter will
  7896. continue with its existing parameters.
  7897. @subsection Examples
  7898. @itemize
  7899. @item
  7900. Draw "Test Text" with font FreeSerif, using the default values for the
  7901. optional parameters.
  7902. @example
  7903. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7904. @end example
  7905. @item
  7906. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7907. and y=50 (counting from the top-left corner of the screen), text is
  7908. yellow with a red box around it. Both the text and the box have an
  7909. opacity of 20%.
  7910. @example
  7911. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7912. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7913. @end example
  7914. Note that the double quotes are not necessary if spaces are not used
  7915. within the parameter list.
  7916. @item
  7917. Show the text at the center of the video frame:
  7918. @example
  7919. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7920. @end example
  7921. @item
  7922. Show the text at a random position, switching to a new position every 30 seconds:
  7923. @example
  7924. 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)"
  7925. @end example
  7926. @item
  7927. Show a text line sliding from right to left in the last row of the video
  7928. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7929. with no newlines.
  7930. @example
  7931. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7932. @end example
  7933. @item
  7934. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7935. @example
  7936. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7937. @end example
  7938. @item
  7939. Draw a single green letter "g", at the center of the input video.
  7940. The glyph baseline is placed at half screen height.
  7941. @example
  7942. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7943. @end example
  7944. @item
  7945. Show text for 1 second every 3 seconds:
  7946. @example
  7947. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7948. @end example
  7949. @item
  7950. Use fontconfig to set the font. Note that the colons need to be escaped.
  7951. @example
  7952. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7953. @end example
  7954. @item
  7955. Draw "Test Text" with font size dependent on height of the video.
  7956. @example
  7957. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  7958. @end example
  7959. @item
  7960. Print the date of a real-time encoding (see strftime(3)):
  7961. @example
  7962. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7963. @end example
  7964. @item
  7965. Show text fading in and out (appearing/disappearing):
  7966. @example
  7967. #!/bin/sh
  7968. DS=1.0 # display start
  7969. DE=10.0 # display end
  7970. FID=1.5 # fade in duration
  7971. FOD=5 # fade out duration
  7972. 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 @}"
  7973. @end example
  7974. @item
  7975. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7976. and the @option{fontsize} value are included in the @option{y} offset.
  7977. @example
  7978. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7979. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7980. @end example
  7981. @item
  7982. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7983. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7984. must have option @option{-export_path_metadata 1} for the special metadata fields
  7985. to be available for filters.
  7986. @example
  7987. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7988. @end example
  7989. @end itemize
  7990. For more information about libfreetype, check:
  7991. @url{http://www.freetype.org/}.
  7992. For more information about fontconfig, check:
  7993. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7994. For more information about libfribidi, check:
  7995. @url{http://fribidi.org/}.
  7996. @section edgedetect
  7997. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7998. The filter accepts the following options:
  7999. @table @option
  8000. @item low
  8001. @item high
  8002. Set low and high threshold values used by the Canny thresholding
  8003. algorithm.
  8004. The high threshold selects the "strong" edge pixels, which are then
  8005. connected through 8-connectivity with the "weak" edge pixels selected
  8006. by the low threshold.
  8007. @var{low} and @var{high} threshold values must be chosen in the range
  8008. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8009. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8010. is @code{50/255}.
  8011. @item mode
  8012. Define the drawing mode.
  8013. @table @samp
  8014. @item wires
  8015. Draw white/gray wires on black background.
  8016. @item colormix
  8017. Mix the colors to create a paint/cartoon effect.
  8018. @item canny
  8019. Apply Canny edge detector on all selected planes.
  8020. @end table
  8021. Default value is @var{wires}.
  8022. @item planes
  8023. Select planes for filtering. By default all available planes are filtered.
  8024. @end table
  8025. @subsection Examples
  8026. @itemize
  8027. @item
  8028. Standard edge detection with custom values for the hysteresis thresholding:
  8029. @example
  8030. edgedetect=low=0.1:high=0.4
  8031. @end example
  8032. @item
  8033. Painting effect without thresholding:
  8034. @example
  8035. edgedetect=mode=colormix:high=0
  8036. @end example
  8037. @end itemize
  8038. @section elbg
  8039. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8040. For each input image, the filter will compute the optimal mapping from
  8041. the input to the output given the codebook length, that is the number
  8042. of distinct output colors.
  8043. This filter accepts the following options.
  8044. @table @option
  8045. @item codebook_length, l
  8046. Set codebook length. The value must be a positive integer, and
  8047. represents the number of distinct output colors. Default value is 256.
  8048. @item nb_steps, n
  8049. Set the maximum number of iterations to apply for computing the optimal
  8050. mapping. The higher the value the better the result and the higher the
  8051. computation time. Default value is 1.
  8052. @item seed, s
  8053. Set a random seed, must be an integer included between 0 and
  8054. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8055. will try to use a good random seed on a best effort basis.
  8056. @item pal8
  8057. Set pal8 output pixel format. This option does not work with codebook
  8058. length greater than 256.
  8059. @end table
  8060. @section entropy
  8061. Measure graylevel entropy in histogram of color channels of video frames.
  8062. It accepts the following parameters:
  8063. @table @option
  8064. @item mode
  8065. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8066. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8067. between neighbour histogram values.
  8068. @end table
  8069. @section eq
  8070. Set brightness, contrast, saturation and approximate gamma adjustment.
  8071. The filter accepts the following options:
  8072. @table @option
  8073. @item contrast
  8074. Set the contrast expression. The value must be a float value in range
  8075. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8076. @item brightness
  8077. Set the brightness expression. The value must be a float value in
  8078. range @code{-1.0} to @code{1.0}. The default value is "0".
  8079. @item saturation
  8080. Set the saturation expression. The value must be a float in
  8081. range @code{0.0} to @code{3.0}. The default value is "1".
  8082. @item gamma
  8083. Set the gamma expression. The value must be a float in range
  8084. @code{0.1} to @code{10.0}. The default value is "1".
  8085. @item gamma_r
  8086. Set the gamma expression for red. The value must be a float in
  8087. range @code{0.1} to @code{10.0}. The default value is "1".
  8088. @item gamma_g
  8089. Set the gamma expression for green. The value must be a float in range
  8090. @code{0.1} to @code{10.0}. The default value is "1".
  8091. @item gamma_b
  8092. Set the gamma expression for blue. The value must be a float in range
  8093. @code{0.1} to @code{10.0}. The default value is "1".
  8094. @item gamma_weight
  8095. Set the gamma weight expression. It can be used to reduce the effect
  8096. of a high gamma value on bright image areas, e.g. keep them from
  8097. getting overamplified and just plain white. The value must be a float
  8098. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8099. gamma correction all the way down while @code{1.0} leaves it at its
  8100. full strength. Default is "1".
  8101. @item eval
  8102. Set when the expressions for brightness, contrast, saturation and
  8103. gamma expressions are evaluated.
  8104. It accepts the following values:
  8105. @table @samp
  8106. @item init
  8107. only evaluate expressions once during the filter initialization or
  8108. when a command is processed
  8109. @item frame
  8110. evaluate expressions for each incoming frame
  8111. @end table
  8112. Default value is @samp{init}.
  8113. @end table
  8114. The expressions accept the following parameters:
  8115. @table @option
  8116. @item n
  8117. frame count of the input frame starting from 0
  8118. @item pos
  8119. byte position of the corresponding packet in the input file, NAN if
  8120. unspecified
  8121. @item r
  8122. frame rate of the input video, NAN if the input frame rate is unknown
  8123. @item t
  8124. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8125. @end table
  8126. @subsection Commands
  8127. The filter supports the following commands:
  8128. @table @option
  8129. @item contrast
  8130. Set the contrast expression.
  8131. @item brightness
  8132. Set the brightness expression.
  8133. @item saturation
  8134. Set the saturation expression.
  8135. @item gamma
  8136. Set the gamma expression.
  8137. @item gamma_r
  8138. Set the gamma_r expression.
  8139. @item gamma_g
  8140. Set gamma_g expression.
  8141. @item gamma_b
  8142. Set gamma_b expression.
  8143. @item gamma_weight
  8144. Set gamma_weight expression.
  8145. The command accepts the same syntax of the corresponding option.
  8146. If the specified expression is not valid, it is kept at its current
  8147. value.
  8148. @end table
  8149. @section erosion
  8150. Apply erosion effect to the video.
  8151. This filter replaces the pixel by the local(3x3) minimum.
  8152. It accepts the following options:
  8153. @table @option
  8154. @item threshold0
  8155. @item threshold1
  8156. @item threshold2
  8157. @item threshold3
  8158. Limit the maximum change for each plane, default is 65535.
  8159. If 0, plane will remain unchanged.
  8160. @item coordinates
  8161. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8162. pixels are used.
  8163. Flags to local 3x3 coordinates maps like this:
  8164. 1 2 3
  8165. 4 5
  8166. 6 7 8
  8167. @end table
  8168. @subsection Commands
  8169. This filter supports the all above options as @ref{commands}.
  8170. @section extractplanes
  8171. Extract color channel components from input video stream into
  8172. separate grayscale video streams.
  8173. The filter accepts the following option:
  8174. @table @option
  8175. @item planes
  8176. Set plane(s) to extract.
  8177. Available values for planes are:
  8178. @table @samp
  8179. @item y
  8180. @item u
  8181. @item v
  8182. @item a
  8183. @item r
  8184. @item g
  8185. @item b
  8186. @end table
  8187. Choosing planes not available in the input will result in an error.
  8188. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8189. with @code{y}, @code{u}, @code{v} planes at same time.
  8190. @end table
  8191. @subsection Examples
  8192. @itemize
  8193. @item
  8194. Extract luma, u and v color channel component from input video frame
  8195. into 3 grayscale outputs:
  8196. @example
  8197. 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
  8198. @end example
  8199. @end itemize
  8200. @section fade
  8201. Apply a fade-in/out effect to the input video.
  8202. It accepts the following parameters:
  8203. @table @option
  8204. @item type, t
  8205. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8206. effect.
  8207. Default is @code{in}.
  8208. @item start_frame, s
  8209. Specify the number of the frame to start applying the fade
  8210. effect at. Default is 0.
  8211. @item nb_frames, n
  8212. The number of frames that the fade effect lasts. At the end of the
  8213. fade-in effect, the output video will have the same intensity as the input video.
  8214. At the end of the fade-out transition, the output video will be filled with the
  8215. selected @option{color}.
  8216. Default is 25.
  8217. @item alpha
  8218. If set to 1, fade only alpha channel, if one exists on the input.
  8219. Default value is 0.
  8220. @item start_time, st
  8221. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8222. effect. If both start_frame and start_time are specified, the fade will start at
  8223. whichever comes last. Default is 0.
  8224. @item duration, d
  8225. The number of seconds for which the fade effect has to last. At the end of the
  8226. fade-in effect the output video will have the same intensity as the input video,
  8227. at the end of the fade-out transition the output video will be filled with the
  8228. selected @option{color}.
  8229. If both duration and nb_frames are specified, duration is used. Default is 0
  8230. (nb_frames is used by default).
  8231. @item color, c
  8232. Specify the color of the fade. Default is "black".
  8233. @end table
  8234. @subsection Examples
  8235. @itemize
  8236. @item
  8237. Fade in the first 30 frames of video:
  8238. @example
  8239. fade=in:0:30
  8240. @end example
  8241. The command above is equivalent to:
  8242. @example
  8243. fade=t=in:s=0:n=30
  8244. @end example
  8245. @item
  8246. Fade out the last 45 frames of a 200-frame video:
  8247. @example
  8248. fade=out:155:45
  8249. fade=type=out:start_frame=155:nb_frames=45
  8250. @end example
  8251. @item
  8252. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8253. @example
  8254. fade=in:0:25, fade=out:975:25
  8255. @end example
  8256. @item
  8257. Make the first 5 frames yellow, then fade in from frame 5-24:
  8258. @example
  8259. fade=in:5:20:color=yellow
  8260. @end example
  8261. @item
  8262. Fade in alpha over first 25 frames of video:
  8263. @example
  8264. fade=in:0:25:alpha=1
  8265. @end example
  8266. @item
  8267. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8268. @example
  8269. fade=t=in:st=5.5:d=0.5
  8270. @end example
  8271. @end itemize
  8272. @section fftdnoiz
  8273. Denoise frames using 3D FFT (frequency domain filtering).
  8274. The filter accepts the following options:
  8275. @table @option
  8276. @item sigma
  8277. Set the noise sigma constant. This sets denoising strength.
  8278. Default value is 1. Allowed range is from 0 to 30.
  8279. Using very high sigma with low overlap may give blocking artifacts.
  8280. @item amount
  8281. Set amount of denoising. By default all detected noise is reduced.
  8282. Default value is 1. Allowed range is from 0 to 1.
  8283. @item block
  8284. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8285. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8286. block size in pixels is 2^4 which is 16.
  8287. @item overlap
  8288. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8289. @item prev
  8290. Set number of previous frames to use for denoising. By default is set to 0.
  8291. @item next
  8292. Set number of next frames to to use for denoising. By default is set to 0.
  8293. @item planes
  8294. Set planes which will be filtered, by default are all available filtered
  8295. except alpha.
  8296. @end table
  8297. @section fftfilt
  8298. Apply arbitrary expressions to samples in frequency domain
  8299. @table @option
  8300. @item dc_Y
  8301. Adjust the dc value (gain) of the luma plane of the image. The filter
  8302. accepts an integer value in range @code{0} to @code{1000}. The default
  8303. value is set to @code{0}.
  8304. @item dc_U
  8305. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8306. filter accepts an integer value in range @code{0} to @code{1000}. The
  8307. default value is set to @code{0}.
  8308. @item dc_V
  8309. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8310. filter accepts an integer value in range @code{0} to @code{1000}. The
  8311. default value is set to @code{0}.
  8312. @item weight_Y
  8313. Set the frequency domain weight expression for the luma plane.
  8314. @item weight_U
  8315. Set the frequency domain weight expression for the 1st chroma plane.
  8316. @item weight_V
  8317. Set the frequency domain weight expression for the 2nd chroma plane.
  8318. @item eval
  8319. Set when the expressions are evaluated.
  8320. It accepts the following values:
  8321. @table @samp
  8322. @item init
  8323. Only evaluate expressions once during the filter initialization.
  8324. @item frame
  8325. Evaluate expressions for each incoming frame.
  8326. @end table
  8327. Default value is @samp{init}.
  8328. The filter accepts the following variables:
  8329. @item X
  8330. @item Y
  8331. The coordinates of the current sample.
  8332. @item W
  8333. @item H
  8334. The width and height of the image.
  8335. @item N
  8336. The number of input frame, starting from 0.
  8337. @end table
  8338. @subsection Examples
  8339. @itemize
  8340. @item
  8341. High-pass:
  8342. @example
  8343. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8344. @end example
  8345. @item
  8346. Low-pass:
  8347. @example
  8348. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8349. @end example
  8350. @item
  8351. Sharpen:
  8352. @example
  8353. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8354. @end example
  8355. @item
  8356. Blur:
  8357. @example
  8358. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8359. @end example
  8360. @end itemize
  8361. @section field
  8362. Extract a single field from an interlaced image using stride
  8363. arithmetic to avoid wasting CPU time. The output frames are marked as
  8364. non-interlaced.
  8365. The filter accepts the following options:
  8366. @table @option
  8367. @item type
  8368. Specify whether to extract the top (if the value is @code{0} or
  8369. @code{top}) or the bottom field (if the value is @code{1} or
  8370. @code{bottom}).
  8371. @end table
  8372. @section fieldhint
  8373. Create new frames by copying the top and bottom fields from surrounding frames
  8374. supplied as numbers by the hint file.
  8375. @table @option
  8376. @item hint
  8377. Set file containing hints: absolute/relative frame numbers.
  8378. There must be one line for each frame in a clip. Each line must contain two
  8379. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8380. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8381. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8382. for @code{relative} mode. First number tells from which frame to pick up top
  8383. field and second number tells from which frame to pick up bottom field.
  8384. If optionally followed by @code{+} output frame will be marked as interlaced,
  8385. else if followed by @code{-} output frame will be marked as progressive, else
  8386. it will be marked same as input frame.
  8387. If optionally followed by @code{t} output frame will use only top field, or in
  8388. case of @code{b} it will use only bottom field.
  8389. If line starts with @code{#} or @code{;} that line is skipped.
  8390. @item mode
  8391. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8392. @end table
  8393. Example of first several lines of @code{hint} file for @code{relative} mode:
  8394. @example
  8395. 0,0 - # first frame
  8396. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8397. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8398. 1,0 -
  8399. 0,0 -
  8400. 0,0 -
  8401. 1,0 -
  8402. 1,0 -
  8403. 1,0 -
  8404. 0,0 -
  8405. 0,0 -
  8406. 1,0 -
  8407. 1,0 -
  8408. 1,0 -
  8409. 0,0 -
  8410. @end example
  8411. @section fieldmatch
  8412. Field matching filter for inverse telecine. It is meant to reconstruct the
  8413. progressive frames from a telecined stream. The filter does not drop duplicated
  8414. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8415. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8416. The separation of the field matching and the decimation is notably motivated by
  8417. the possibility of inserting a de-interlacing filter fallback between the two.
  8418. If the source has mixed telecined and real interlaced content,
  8419. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8420. But these remaining combed frames will be marked as interlaced, and thus can be
  8421. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8422. In addition to the various configuration options, @code{fieldmatch} can take an
  8423. optional second stream, activated through the @option{ppsrc} option. If
  8424. enabled, the frames reconstruction will be based on the fields and frames from
  8425. this second stream. This allows the first input to be pre-processed in order to
  8426. help the various algorithms of the filter, while keeping the output lossless
  8427. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8428. or brightness/contrast adjustments can help.
  8429. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8430. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8431. which @code{fieldmatch} is based on. While the semantic and usage are very
  8432. close, some behaviour and options names can differ.
  8433. The @ref{decimate} filter currently only works for constant frame rate input.
  8434. If your input has mixed telecined (30fps) and progressive content with a lower
  8435. framerate like 24fps use the following filterchain to produce the necessary cfr
  8436. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8437. The filter accepts the following options:
  8438. @table @option
  8439. @item order
  8440. Specify the assumed field order of the input stream. Available values are:
  8441. @table @samp
  8442. @item auto
  8443. Auto detect parity (use FFmpeg's internal parity value).
  8444. @item bff
  8445. Assume bottom field first.
  8446. @item tff
  8447. Assume top field first.
  8448. @end table
  8449. Note that it is sometimes recommended not to trust the parity announced by the
  8450. stream.
  8451. Default value is @var{auto}.
  8452. @item mode
  8453. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8454. sense that it won't risk creating jerkiness due to duplicate frames when
  8455. possible, but if there are bad edits or blended fields it will end up
  8456. outputting combed frames when a good match might actually exist. On the other
  8457. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8458. but will almost always find a good frame if there is one. The other values are
  8459. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8460. jerkiness and creating duplicate frames versus finding good matches in sections
  8461. with bad edits, orphaned fields, blended fields, etc.
  8462. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8463. Available values are:
  8464. @table @samp
  8465. @item pc
  8466. 2-way matching (p/c)
  8467. @item pc_n
  8468. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8469. @item pc_u
  8470. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8471. @item pc_n_ub
  8472. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8473. still combed (p/c + n + u/b)
  8474. @item pcn
  8475. 3-way matching (p/c/n)
  8476. @item pcn_ub
  8477. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8478. detected as combed (p/c/n + u/b)
  8479. @end table
  8480. The parenthesis at the end indicate the matches that would be used for that
  8481. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8482. @var{top}).
  8483. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8484. the slowest.
  8485. Default value is @var{pc_n}.
  8486. @item ppsrc
  8487. Mark the main input stream as a pre-processed input, and enable the secondary
  8488. input stream as the clean source to pick the fields from. See the filter
  8489. introduction for more details. It is similar to the @option{clip2} feature from
  8490. VFM/TFM.
  8491. Default value is @code{0} (disabled).
  8492. @item field
  8493. Set the field to match from. It is recommended to set this to the same value as
  8494. @option{order} unless you experience matching failures with that setting. In
  8495. certain circumstances changing the field that is used to match from can have a
  8496. large impact on matching performance. Available values are:
  8497. @table @samp
  8498. @item auto
  8499. Automatic (same value as @option{order}).
  8500. @item bottom
  8501. Match from the bottom field.
  8502. @item top
  8503. Match from the top field.
  8504. @end table
  8505. Default value is @var{auto}.
  8506. @item mchroma
  8507. Set whether or not chroma is included during the match comparisons. In most
  8508. cases it is recommended to leave this enabled. You should set this to @code{0}
  8509. only if your clip has bad chroma problems such as heavy rainbowing or other
  8510. artifacts. Setting this to @code{0} could also be used to speed things up at
  8511. the cost of some accuracy.
  8512. Default value is @code{1}.
  8513. @item y0
  8514. @item y1
  8515. These define an exclusion band which excludes the lines between @option{y0} and
  8516. @option{y1} from being included in the field matching decision. An exclusion
  8517. band can be used to ignore subtitles, a logo, or other things that may
  8518. interfere with the matching. @option{y0} sets the starting scan line and
  8519. @option{y1} sets the ending line; all lines in between @option{y0} and
  8520. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8521. @option{y0} and @option{y1} to the same value will disable the feature.
  8522. @option{y0} and @option{y1} defaults to @code{0}.
  8523. @item scthresh
  8524. Set the scene change detection threshold as a percentage of maximum change on
  8525. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8526. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8527. @option{scthresh} is @code{[0.0, 100.0]}.
  8528. Default value is @code{12.0}.
  8529. @item combmatch
  8530. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8531. account the combed scores of matches when deciding what match to use as the
  8532. final match. Available values are:
  8533. @table @samp
  8534. @item none
  8535. No final matching based on combed scores.
  8536. @item sc
  8537. Combed scores are only used when a scene change is detected.
  8538. @item full
  8539. Use combed scores all the time.
  8540. @end table
  8541. Default is @var{sc}.
  8542. @item combdbg
  8543. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8544. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8545. Available values are:
  8546. @table @samp
  8547. @item none
  8548. No forced calculation.
  8549. @item pcn
  8550. Force p/c/n calculations.
  8551. @item pcnub
  8552. Force p/c/n/u/b calculations.
  8553. @end table
  8554. Default value is @var{none}.
  8555. @item cthresh
  8556. This is the area combing threshold used for combed frame detection. This
  8557. essentially controls how "strong" or "visible" combing must be to be detected.
  8558. Larger values mean combing must be more visible and smaller values mean combing
  8559. can be less visible or strong and still be detected. Valid settings are from
  8560. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8561. be detected as combed). This is basically a pixel difference value. A good
  8562. range is @code{[8, 12]}.
  8563. Default value is @code{9}.
  8564. @item chroma
  8565. Sets whether or not chroma is considered in the combed frame decision. Only
  8566. disable this if your source has chroma problems (rainbowing, etc.) that are
  8567. causing problems for the combed frame detection with chroma enabled. Actually,
  8568. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8569. where there is chroma only combing in the source.
  8570. Default value is @code{0}.
  8571. @item blockx
  8572. @item blocky
  8573. Respectively set the x-axis and y-axis size of the window used during combed
  8574. frame detection. This has to do with the size of the area in which
  8575. @option{combpel} pixels are required to be detected as combed for a frame to be
  8576. declared combed. See the @option{combpel} parameter description for more info.
  8577. Possible values are any number that is a power of 2 starting at 4 and going up
  8578. to 512.
  8579. Default value is @code{16}.
  8580. @item combpel
  8581. The number of combed pixels inside any of the @option{blocky} by
  8582. @option{blockx} size blocks on the frame for the frame to be detected as
  8583. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8584. setting controls "how much" combing there must be in any localized area (a
  8585. window defined by the @option{blockx} and @option{blocky} settings) on the
  8586. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8587. which point no frames will ever be detected as combed). This setting is known
  8588. as @option{MI} in TFM/VFM vocabulary.
  8589. Default value is @code{80}.
  8590. @end table
  8591. @anchor{p/c/n/u/b meaning}
  8592. @subsection p/c/n/u/b meaning
  8593. @subsubsection p/c/n
  8594. We assume the following telecined stream:
  8595. @example
  8596. Top fields: 1 2 2 3 4
  8597. Bottom fields: 1 2 3 4 4
  8598. @end example
  8599. The numbers correspond to the progressive frame the fields relate to. Here, the
  8600. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8601. When @code{fieldmatch} is configured to run a matching from bottom
  8602. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8603. @example
  8604. Input stream:
  8605. T 1 2 2 3 4
  8606. B 1 2 3 4 4 <-- matching reference
  8607. Matches: c c n n c
  8608. Output stream:
  8609. T 1 2 3 4 4
  8610. B 1 2 3 4 4
  8611. @end example
  8612. As a result of the field matching, we can see that some frames get duplicated.
  8613. To perform a complete inverse telecine, you need to rely on a decimation filter
  8614. after this operation. See for instance the @ref{decimate} filter.
  8615. The same operation now matching from top fields (@option{field}=@var{top})
  8616. looks like this:
  8617. @example
  8618. Input stream:
  8619. T 1 2 2 3 4 <-- matching reference
  8620. B 1 2 3 4 4
  8621. Matches: c c p p c
  8622. Output stream:
  8623. T 1 2 2 3 4
  8624. B 1 2 2 3 4
  8625. @end example
  8626. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8627. basically, they refer to the frame and field of the opposite parity:
  8628. @itemize
  8629. @item @var{p} matches the field of the opposite parity in the previous frame
  8630. @item @var{c} matches the field of the opposite parity in the current frame
  8631. @item @var{n} matches the field of the opposite parity in the next frame
  8632. @end itemize
  8633. @subsubsection u/b
  8634. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8635. from the opposite parity flag. In the following examples, we assume that we are
  8636. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8637. 'x' is placed above and below each matched fields.
  8638. With bottom matching (@option{field}=@var{bottom}):
  8639. @example
  8640. Match: c p n b u
  8641. x x x x x
  8642. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8643. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8644. x x x x x
  8645. Output frames:
  8646. 2 1 2 2 2
  8647. 2 2 2 1 3
  8648. @end example
  8649. With top matching (@option{field}=@var{top}):
  8650. @example
  8651. Match: c p n b u
  8652. x x x x x
  8653. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8654. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8655. x x x x x
  8656. Output frames:
  8657. 2 2 2 1 2
  8658. 2 1 3 2 2
  8659. @end example
  8660. @subsection Examples
  8661. Simple IVTC of a top field first telecined stream:
  8662. @example
  8663. fieldmatch=order=tff:combmatch=none, decimate
  8664. @end example
  8665. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8666. @example
  8667. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8668. @end example
  8669. @section fieldorder
  8670. Transform the field order of the input video.
  8671. It accepts the following parameters:
  8672. @table @option
  8673. @item order
  8674. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8675. for bottom field first.
  8676. @end table
  8677. The default value is @samp{tff}.
  8678. The transformation is done by shifting the picture content up or down
  8679. by one line, and filling the remaining line with appropriate picture content.
  8680. This method is consistent with most broadcast field order converters.
  8681. If the input video is not flagged as being interlaced, or it is already
  8682. flagged as being of the required output field order, then this filter does
  8683. not alter the incoming video.
  8684. It is very useful when converting to or from PAL DV material,
  8685. which is bottom field first.
  8686. For example:
  8687. @example
  8688. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8689. @end example
  8690. @section fifo, afifo
  8691. Buffer input images and send them when they are requested.
  8692. It is mainly useful when auto-inserted by the libavfilter
  8693. framework.
  8694. It does not take parameters.
  8695. @section fillborders
  8696. Fill borders of the input video, without changing video stream dimensions.
  8697. Sometimes video can have garbage at the four edges and you may not want to
  8698. crop video input to keep size multiple of some number.
  8699. This filter accepts the following options:
  8700. @table @option
  8701. @item left
  8702. Number of pixels to fill from left border.
  8703. @item right
  8704. Number of pixels to fill from right border.
  8705. @item top
  8706. Number of pixels to fill from top border.
  8707. @item bottom
  8708. Number of pixels to fill from bottom border.
  8709. @item mode
  8710. Set fill mode.
  8711. It accepts the following values:
  8712. @table @samp
  8713. @item smear
  8714. fill pixels using outermost pixels
  8715. @item mirror
  8716. fill pixels using mirroring
  8717. @item fixed
  8718. fill pixels with constant value
  8719. @end table
  8720. Default is @var{smear}.
  8721. @item color
  8722. Set color for pixels in fixed mode. Default is @var{black}.
  8723. @end table
  8724. @subsection Commands
  8725. This filter supports same @ref{commands} as options.
  8726. The command accepts the same syntax of the corresponding option.
  8727. If the specified expression is not valid, it is kept at its current
  8728. value.
  8729. @section find_rect
  8730. Find a rectangular object
  8731. It accepts the following options:
  8732. @table @option
  8733. @item object
  8734. Filepath of the object image, needs to be in gray8.
  8735. @item threshold
  8736. Detection threshold, default is 0.5.
  8737. @item mipmaps
  8738. Number of mipmaps, default is 3.
  8739. @item xmin, ymin, xmax, ymax
  8740. Specifies the rectangle in which to search.
  8741. @end table
  8742. @subsection Examples
  8743. @itemize
  8744. @item
  8745. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8746. @example
  8747. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8748. @end example
  8749. @end itemize
  8750. @section floodfill
  8751. Flood area with values of same pixel components with another values.
  8752. It accepts the following options:
  8753. @table @option
  8754. @item x
  8755. Set pixel x coordinate.
  8756. @item y
  8757. Set pixel y coordinate.
  8758. @item s0
  8759. Set source #0 component value.
  8760. @item s1
  8761. Set source #1 component value.
  8762. @item s2
  8763. Set source #2 component value.
  8764. @item s3
  8765. Set source #3 component value.
  8766. @item d0
  8767. Set destination #0 component value.
  8768. @item d1
  8769. Set destination #1 component value.
  8770. @item d2
  8771. Set destination #2 component value.
  8772. @item d3
  8773. Set destination #3 component value.
  8774. @end table
  8775. @anchor{format}
  8776. @section format
  8777. Convert the input video to one of the specified pixel formats.
  8778. Libavfilter will try to pick one that is suitable as input to
  8779. the next filter.
  8780. It accepts the following parameters:
  8781. @table @option
  8782. @item pix_fmts
  8783. A '|'-separated list of pixel format names, such as
  8784. "pix_fmts=yuv420p|monow|rgb24".
  8785. @end table
  8786. @subsection Examples
  8787. @itemize
  8788. @item
  8789. Convert the input video to the @var{yuv420p} format
  8790. @example
  8791. format=pix_fmts=yuv420p
  8792. @end example
  8793. Convert the input video to any of the formats in the list
  8794. @example
  8795. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8796. @end example
  8797. @end itemize
  8798. @anchor{fps}
  8799. @section fps
  8800. Convert the video to specified constant frame rate by duplicating or dropping
  8801. frames as necessary.
  8802. It accepts the following parameters:
  8803. @table @option
  8804. @item fps
  8805. The desired output frame rate. The default is @code{25}.
  8806. @item start_time
  8807. Assume the first PTS should be the given value, in seconds. This allows for
  8808. padding/trimming at the start of stream. By default, no assumption is made
  8809. about the first frame's expected PTS, so no padding or trimming is done.
  8810. For example, this could be set to 0 to pad the beginning with duplicates of
  8811. the first frame if a video stream starts after the audio stream or to trim any
  8812. frames with a negative PTS.
  8813. @item round
  8814. Timestamp (PTS) rounding method.
  8815. Possible values are:
  8816. @table @option
  8817. @item zero
  8818. round towards 0
  8819. @item inf
  8820. round away from 0
  8821. @item down
  8822. round towards -infinity
  8823. @item up
  8824. round towards +infinity
  8825. @item near
  8826. round to nearest
  8827. @end table
  8828. The default is @code{near}.
  8829. @item eof_action
  8830. Action performed when reading the last frame.
  8831. Possible values are:
  8832. @table @option
  8833. @item round
  8834. Use same timestamp rounding method as used for other frames.
  8835. @item pass
  8836. Pass through last frame if input duration has not been reached yet.
  8837. @end table
  8838. The default is @code{round}.
  8839. @end table
  8840. Alternatively, the options can be specified as a flat string:
  8841. @var{fps}[:@var{start_time}[:@var{round}]].
  8842. See also the @ref{setpts} filter.
  8843. @subsection Examples
  8844. @itemize
  8845. @item
  8846. A typical usage in order to set the fps to 25:
  8847. @example
  8848. fps=fps=25
  8849. @end example
  8850. @item
  8851. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8852. @example
  8853. fps=fps=film:round=near
  8854. @end example
  8855. @end itemize
  8856. @section framepack
  8857. Pack two different video streams into a stereoscopic video, setting proper
  8858. metadata on supported codecs. The two views should have the same size and
  8859. framerate and processing will stop when the shorter video ends. Please note
  8860. that you may conveniently adjust view properties with the @ref{scale} and
  8861. @ref{fps} filters.
  8862. It accepts the following parameters:
  8863. @table @option
  8864. @item format
  8865. The desired packing format. Supported values are:
  8866. @table @option
  8867. @item sbs
  8868. The views are next to each other (default).
  8869. @item tab
  8870. The views are on top of each other.
  8871. @item lines
  8872. The views are packed by line.
  8873. @item columns
  8874. The views are packed by column.
  8875. @item frameseq
  8876. The views are temporally interleaved.
  8877. @end table
  8878. @end table
  8879. Some examples:
  8880. @example
  8881. # Convert left and right views into a frame-sequential video
  8882. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8883. # Convert views into a side-by-side video with the same output resolution as the input
  8884. 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
  8885. @end example
  8886. @section framerate
  8887. Change the frame rate by interpolating new video output frames from the source
  8888. frames.
  8889. This filter is not designed to function correctly with interlaced media. If
  8890. you wish to change the frame rate of interlaced media then you are required
  8891. to deinterlace before this filter and re-interlace after this filter.
  8892. A description of the accepted options follows.
  8893. @table @option
  8894. @item fps
  8895. Specify the output frames per second. This option can also be specified
  8896. as a value alone. The default is @code{50}.
  8897. @item interp_start
  8898. Specify the start of a range where the output frame will be created as a
  8899. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8900. the default is @code{15}.
  8901. @item interp_end
  8902. Specify the end of a range where the output frame will be created as a
  8903. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8904. the default is @code{240}.
  8905. @item scene
  8906. Specify the level at which a scene change is detected as a value between
  8907. 0 and 100 to indicate a new scene; a low value reflects a low
  8908. probability for the current frame to introduce a new scene, while a higher
  8909. value means the current frame is more likely to be one.
  8910. The default is @code{8.2}.
  8911. @item flags
  8912. Specify flags influencing the filter process.
  8913. Available value for @var{flags} is:
  8914. @table @option
  8915. @item scene_change_detect, scd
  8916. Enable scene change detection using the value of the option @var{scene}.
  8917. This flag is enabled by default.
  8918. @end table
  8919. @end table
  8920. @section framestep
  8921. Select one frame every N-th frame.
  8922. This filter accepts the following option:
  8923. @table @option
  8924. @item step
  8925. Select frame after every @code{step} frames.
  8926. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8927. @end table
  8928. @section freezedetect
  8929. Detect frozen video.
  8930. This filter logs a message and sets frame metadata when it detects that the
  8931. input video has no significant change in content during a specified duration.
  8932. Video freeze detection calculates the mean average absolute difference of all
  8933. the components of video frames and compares it to a noise floor.
  8934. The printed times and duration are expressed in seconds. The
  8935. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8936. whose timestamp equals or exceeds the detection duration and it contains the
  8937. timestamp of the first frame of the freeze. The
  8938. @code{lavfi.freezedetect.freeze_duration} and
  8939. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8940. after the freeze.
  8941. The filter accepts the following options:
  8942. @table @option
  8943. @item noise, n
  8944. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8945. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8946. 0.001.
  8947. @item duration, d
  8948. Set freeze duration until notification (default is 2 seconds).
  8949. @end table
  8950. @section freezeframes
  8951. Freeze video frames.
  8952. This filter freezes video frames using frame from 2nd input.
  8953. The filter accepts the following options:
  8954. @table @option
  8955. @item first
  8956. Set number of first frame from which to start freeze.
  8957. @item last
  8958. Set number of last frame from which to end freeze.
  8959. @item replace
  8960. Set number of frame from 2nd input which will be used instead of replaced frames.
  8961. @end table
  8962. @anchor{frei0r}
  8963. @section frei0r
  8964. Apply a frei0r effect to the input video.
  8965. To enable the compilation of this filter, you need to install the frei0r
  8966. header and configure FFmpeg with @code{--enable-frei0r}.
  8967. It accepts the following parameters:
  8968. @table @option
  8969. @item filter_name
  8970. The name of the frei0r effect to load. If the environment variable
  8971. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8972. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8973. Otherwise, the standard frei0r paths are searched, in this order:
  8974. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8975. @file{/usr/lib/frei0r-1/}.
  8976. @item filter_params
  8977. A '|'-separated list of parameters to pass to the frei0r effect.
  8978. @end table
  8979. A frei0r effect parameter can be a boolean (its value is either
  8980. "y" or "n"), a double, a color (specified as
  8981. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8982. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8983. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8984. a position (specified as @var{X}/@var{Y}, where
  8985. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8986. The number and types of parameters depend on the loaded effect. If an
  8987. effect parameter is not specified, the default value is set.
  8988. @subsection Examples
  8989. @itemize
  8990. @item
  8991. Apply the distort0r effect, setting the first two double parameters:
  8992. @example
  8993. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8994. @end example
  8995. @item
  8996. Apply the colordistance effect, taking a color as the first parameter:
  8997. @example
  8998. frei0r=colordistance:0.2/0.3/0.4
  8999. frei0r=colordistance:violet
  9000. frei0r=colordistance:0x112233
  9001. @end example
  9002. @item
  9003. Apply the perspective effect, specifying the top left and top right image
  9004. positions:
  9005. @example
  9006. frei0r=perspective:0.2/0.2|0.8/0.2
  9007. @end example
  9008. @end itemize
  9009. For more information, see
  9010. @url{http://frei0r.dyne.org}
  9011. @section fspp
  9012. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  9013. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  9014. processing filter, one of them is performed once per block, not per pixel.
  9015. This allows for much higher speed.
  9016. The filter accepts the following options:
  9017. @table @option
  9018. @item quality
  9019. Set quality. This option defines the number of levels for averaging. It accepts
  9020. an integer in the range 4-5. Default value is @code{4}.
  9021. @item qp
  9022. Force a constant quantization parameter. It accepts an integer in range 0-63.
  9023. If not set, the filter will use the QP from the video stream (if available).
  9024. @item strength
  9025. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  9026. more details but also more artifacts, while higher values make the image smoother
  9027. but also blurrier. Default value is @code{0} − PSNR optimal.
  9028. @item use_bframe_qp
  9029. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9030. option may cause flicker since the B-Frames have often larger QP. Default is
  9031. @code{0} (not enabled).
  9032. @end table
  9033. @section gblur
  9034. Apply Gaussian blur filter.
  9035. The filter accepts the following options:
  9036. @table @option
  9037. @item sigma
  9038. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  9039. @item steps
  9040. Set number of steps for Gaussian approximation. Default is @code{1}.
  9041. @item planes
  9042. Set which planes to filter. By default all planes are filtered.
  9043. @item sigmaV
  9044. Set vertical sigma, if negative it will be same as @code{sigma}.
  9045. Default is @code{-1}.
  9046. @end table
  9047. @subsection Commands
  9048. This filter supports same commands as options.
  9049. The command accepts the same syntax of the corresponding option.
  9050. If the specified expression is not valid, it is kept at its current
  9051. value.
  9052. @section geq
  9053. Apply generic equation to each pixel.
  9054. The filter accepts the following options:
  9055. @table @option
  9056. @item lum_expr, lum
  9057. Set the luminance expression.
  9058. @item cb_expr, cb
  9059. Set the chrominance blue expression.
  9060. @item cr_expr, cr
  9061. Set the chrominance red expression.
  9062. @item alpha_expr, a
  9063. Set the alpha expression.
  9064. @item red_expr, r
  9065. Set the red expression.
  9066. @item green_expr, g
  9067. Set the green expression.
  9068. @item blue_expr, b
  9069. Set the blue expression.
  9070. @end table
  9071. The colorspace is selected according to the specified options. If one
  9072. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9073. options is specified, the filter will automatically select a YCbCr
  9074. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9075. @option{blue_expr} options is specified, it will select an RGB
  9076. colorspace.
  9077. If one of the chrominance expression is not defined, it falls back on the other
  9078. one. If no alpha expression is specified it will evaluate to opaque value.
  9079. If none of chrominance expressions are specified, they will evaluate
  9080. to the luminance expression.
  9081. The expressions can use the following variables and functions:
  9082. @table @option
  9083. @item N
  9084. The sequential number of the filtered frame, starting from @code{0}.
  9085. @item X
  9086. @item Y
  9087. The coordinates of the current sample.
  9088. @item W
  9089. @item H
  9090. The width and height of the image.
  9091. @item SW
  9092. @item SH
  9093. Width and height scale depending on the currently filtered plane. It is the
  9094. ratio between the corresponding luma plane number of pixels and the current
  9095. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9096. @code{0.5,0.5} for chroma planes.
  9097. @item T
  9098. Time of the current frame, expressed in seconds.
  9099. @item p(x, y)
  9100. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9101. plane.
  9102. @item lum(x, y)
  9103. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9104. plane.
  9105. @item cb(x, y)
  9106. Return the value of the pixel at location (@var{x},@var{y}) of the
  9107. blue-difference chroma plane. Return 0 if there is no such plane.
  9108. @item cr(x, y)
  9109. Return the value of the pixel at location (@var{x},@var{y}) of the
  9110. red-difference chroma plane. Return 0 if there is no such plane.
  9111. @item r(x, y)
  9112. @item g(x, y)
  9113. @item b(x, y)
  9114. Return the value of the pixel at location (@var{x},@var{y}) of the
  9115. red/green/blue component. Return 0 if there is no such component.
  9116. @item alpha(x, y)
  9117. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9118. plane. Return 0 if there is no such plane.
  9119. @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)
  9120. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9121. sums of samples within a rectangle. See the functions without the sum postfix.
  9122. @item interpolation
  9123. Set one of interpolation methods:
  9124. @table @option
  9125. @item nearest, n
  9126. @item bilinear, b
  9127. @end table
  9128. Default is bilinear.
  9129. @end table
  9130. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9131. automatically clipped to the closer edge.
  9132. Please note that this filter can use multiple threads in which case each slice
  9133. will have its own expression state. If you want to use only a single expression
  9134. state because your expressions depend on previous state then you should limit
  9135. the number of filter threads to 1.
  9136. @subsection Examples
  9137. @itemize
  9138. @item
  9139. Flip the image horizontally:
  9140. @example
  9141. geq=p(W-X\,Y)
  9142. @end example
  9143. @item
  9144. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9145. wavelength of 100 pixels:
  9146. @example
  9147. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9148. @end example
  9149. @item
  9150. Generate a fancy enigmatic moving light:
  9151. @example
  9152. 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
  9153. @end example
  9154. @item
  9155. Generate a quick emboss effect:
  9156. @example
  9157. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9158. @end example
  9159. @item
  9160. Modify RGB components depending on pixel position:
  9161. @example
  9162. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9163. @end example
  9164. @item
  9165. Create a radial gradient that is the same size as the input (also see
  9166. the @ref{vignette} filter):
  9167. @example
  9168. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9169. @end example
  9170. @end itemize
  9171. @section gradfun
  9172. Fix the banding artifacts that are sometimes introduced into nearly flat
  9173. regions by truncation to 8-bit color depth.
  9174. Interpolate the gradients that should go where the bands are, and
  9175. dither them.
  9176. It is designed for playback only. Do not use it prior to
  9177. lossy compression, because compression tends to lose the dither and
  9178. bring back the bands.
  9179. It accepts the following parameters:
  9180. @table @option
  9181. @item strength
  9182. The maximum amount by which the filter will change any one pixel. This is also
  9183. the threshold for detecting nearly flat regions. Acceptable values range from
  9184. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9185. valid range.
  9186. @item radius
  9187. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9188. gradients, but also prevents the filter from modifying the pixels near detailed
  9189. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9190. values will be clipped to the valid range.
  9191. @end table
  9192. Alternatively, the options can be specified as a flat string:
  9193. @var{strength}[:@var{radius}]
  9194. @subsection Examples
  9195. @itemize
  9196. @item
  9197. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9198. @example
  9199. gradfun=3.5:8
  9200. @end example
  9201. @item
  9202. Specify radius, omitting the strength (which will fall-back to the default
  9203. value):
  9204. @example
  9205. gradfun=radius=8
  9206. @end example
  9207. @end itemize
  9208. @anchor{graphmonitor}
  9209. @section graphmonitor
  9210. Show various filtergraph stats.
  9211. With this filter one can debug complete filtergraph.
  9212. Especially issues with links filling with queued frames.
  9213. The filter accepts the following options:
  9214. @table @option
  9215. @item size, s
  9216. Set video output size. Default is @var{hd720}.
  9217. @item opacity, o
  9218. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9219. @item mode, m
  9220. Set output mode, can be @var{fulll} or @var{compact}.
  9221. In @var{compact} mode only filters with some queued frames have displayed stats.
  9222. @item flags, f
  9223. Set flags which enable which stats are shown in video.
  9224. Available values for flags are:
  9225. @table @samp
  9226. @item queue
  9227. Display number of queued frames in each link.
  9228. @item frame_count_in
  9229. Display number of frames taken from filter.
  9230. @item frame_count_out
  9231. Display number of frames given out from filter.
  9232. @item pts
  9233. Display current filtered frame pts.
  9234. @item time
  9235. Display current filtered frame time.
  9236. @item timebase
  9237. Display time base for filter link.
  9238. @item format
  9239. Display used format for filter link.
  9240. @item size
  9241. Display video size or number of audio channels in case of audio used by filter link.
  9242. @item rate
  9243. Display video frame rate or sample rate in case of audio used by filter link.
  9244. @item eof
  9245. Display link output status.
  9246. @end table
  9247. @item rate, r
  9248. Set upper limit for video rate of output stream, Default value is @var{25}.
  9249. This guarantee that output video frame rate will not be higher than this value.
  9250. @end table
  9251. @section greyedge
  9252. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9253. and corrects the scene colors accordingly.
  9254. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9255. The filter accepts the following options:
  9256. @table @option
  9257. @item difford
  9258. The order of differentiation to be applied on the scene. Must be chosen in the range
  9259. [0,2] and default value is 1.
  9260. @item minknorm
  9261. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9262. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9263. max value instead of calculating Minkowski distance.
  9264. @item sigma
  9265. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9266. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9267. can't be equal to 0 if @var{difford} is greater than 0.
  9268. @end table
  9269. @subsection Examples
  9270. @itemize
  9271. @item
  9272. Grey Edge:
  9273. @example
  9274. greyedge=difford=1:minknorm=5:sigma=2
  9275. @end example
  9276. @item
  9277. Max Edge:
  9278. @example
  9279. greyedge=difford=1:minknorm=0:sigma=2
  9280. @end example
  9281. @end itemize
  9282. @anchor{haldclut}
  9283. @section haldclut
  9284. Apply a Hald CLUT to a video stream.
  9285. First input is the video stream to process, and second one is the Hald CLUT.
  9286. The Hald CLUT input can be a simple picture or a complete video stream.
  9287. The filter accepts the following options:
  9288. @table @option
  9289. @item shortest
  9290. Force termination when the shortest input terminates. Default is @code{0}.
  9291. @item repeatlast
  9292. Continue applying the last CLUT after the end of the stream. A value of
  9293. @code{0} disable the filter after the last frame of the CLUT is reached.
  9294. Default is @code{1}.
  9295. @end table
  9296. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9297. filters share the same internals).
  9298. This filter also supports the @ref{framesync} options.
  9299. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9300. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9301. @subsection Workflow examples
  9302. @subsubsection Hald CLUT video stream
  9303. Generate an identity Hald CLUT stream altered with various effects:
  9304. @example
  9305. 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
  9306. @end example
  9307. Note: make sure you use a lossless codec.
  9308. Then use it with @code{haldclut} to apply it on some random stream:
  9309. @example
  9310. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9311. @end example
  9312. The Hald CLUT will be applied to the 10 first seconds (duration of
  9313. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9314. to the remaining frames of the @code{mandelbrot} stream.
  9315. @subsubsection Hald CLUT with preview
  9316. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9317. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9318. biggest possible square starting at the top left of the picture. The remaining
  9319. padding pixels (bottom or right) will be ignored. This area can be used to add
  9320. a preview of the Hald CLUT.
  9321. Typically, the following generated Hald CLUT will be supported by the
  9322. @code{haldclut} filter:
  9323. @example
  9324. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9325. pad=iw+320 [padded_clut];
  9326. smptebars=s=320x256, split [a][b];
  9327. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9328. [main][b] overlay=W-320" -frames:v 1 clut.png
  9329. @end example
  9330. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9331. bars are displayed on the right-top, and below the same color bars processed by
  9332. the color changes.
  9333. Then, the effect of this Hald CLUT can be visualized with:
  9334. @example
  9335. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9336. @end example
  9337. @section hflip
  9338. Flip the input video horizontally.
  9339. For example, to horizontally flip the input video with @command{ffmpeg}:
  9340. @example
  9341. ffmpeg -i in.avi -vf "hflip" out.avi
  9342. @end example
  9343. @section histeq
  9344. This filter applies a global color histogram equalization on a
  9345. per-frame basis.
  9346. It can be used to correct video that has a compressed range of pixel
  9347. intensities. The filter redistributes the pixel intensities to
  9348. equalize their distribution across the intensity range. It may be
  9349. viewed as an "automatically adjusting contrast filter". This filter is
  9350. useful only for correcting degraded or poorly captured source
  9351. video.
  9352. The filter accepts the following options:
  9353. @table @option
  9354. @item strength
  9355. Determine the amount of equalization to be applied. As the strength
  9356. is reduced, the distribution of pixel intensities more-and-more
  9357. approaches that of the input frame. The value must be a float number
  9358. in the range [0,1] and defaults to 0.200.
  9359. @item intensity
  9360. Set the maximum intensity that can generated and scale the output
  9361. values appropriately. The strength should be set as desired and then
  9362. the intensity can be limited if needed to avoid washing-out. The value
  9363. must be a float number in the range [0,1] and defaults to 0.210.
  9364. @item antibanding
  9365. Set the antibanding level. If enabled the filter will randomly vary
  9366. the luminance of output pixels by a small amount to avoid banding of
  9367. the histogram. Possible values are @code{none}, @code{weak} or
  9368. @code{strong}. It defaults to @code{none}.
  9369. @end table
  9370. @anchor{histogram}
  9371. @section histogram
  9372. Compute and draw a color distribution histogram for the input video.
  9373. The computed histogram is a representation of the color component
  9374. distribution in an image.
  9375. Standard histogram displays the color components distribution in an image.
  9376. Displays color graph for each color component. Shows distribution of
  9377. the Y, U, V, A or R, G, B components, depending on input format, in the
  9378. current frame. Below each graph a color component scale meter is shown.
  9379. The filter accepts the following options:
  9380. @table @option
  9381. @item level_height
  9382. Set height of level. Default value is @code{200}.
  9383. Allowed range is [50, 2048].
  9384. @item scale_height
  9385. Set height of color scale. Default value is @code{12}.
  9386. Allowed range is [0, 40].
  9387. @item display_mode
  9388. Set display mode.
  9389. It accepts the following values:
  9390. @table @samp
  9391. @item stack
  9392. Per color component graphs are placed below each other.
  9393. @item parade
  9394. Per color component graphs are placed side by side.
  9395. @item overlay
  9396. Presents information identical to that in the @code{parade}, except
  9397. that the graphs representing color components are superimposed directly
  9398. over one another.
  9399. @end table
  9400. Default is @code{stack}.
  9401. @item levels_mode
  9402. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9403. Default is @code{linear}.
  9404. @item components
  9405. Set what color components to display.
  9406. Default is @code{7}.
  9407. @item fgopacity
  9408. Set foreground opacity. Default is @code{0.7}.
  9409. @item bgopacity
  9410. Set background opacity. Default is @code{0.5}.
  9411. @end table
  9412. @subsection Examples
  9413. @itemize
  9414. @item
  9415. Calculate and draw histogram:
  9416. @example
  9417. ffplay -i input -vf histogram
  9418. @end example
  9419. @end itemize
  9420. @anchor{hqdn3d}
  9421. @section hqdn3d
  9422. This is a high precision/quality 3d denoise filter. It aims to reduce
  9423. image noise, producing smooth images and making still images really
  9424. still. It should enhance compressibility.
  9425. It accepts the following optional parameters:
  9426. @table @option
  9427. @item luma_spatial
  9428. A non-negative floating point number which specifies spatial luma strength.
  9429. It defaults to 4.0.
  9430. @item chroma_spatial
  9431. A non-negative floating point number which specifies spatial chroma strength.
  9432. It defaults to 3.0*@var{luma_spatial}/4.0.
  9433. @item luma_tmp
  9434. A floating point number which specifies luma temporal strength. It defaults to
  9435. 6.0*@var{luma_spatial}/4.0.
  9436. @item chroma_tmp
  9437. A floating point number which specifies chroma temporal strength. It defaults to
  9438. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9439. @end table
  9440. @subsection Commands
  9441. This filter supports same @ref{commands} as options.
  9442. The command accepts the same syntax of the corresponding option.
  9443. If the specified expression is not valid, it is kept at its current
  9444. value.
  9445. @anchor{hwdownload}
  9446. @section hwdownload
  9447. Download hardware frames to system memory.
  9448. The input must be in hardware frames, and the output a non-hardware format.
  9449. Not all formats will be supported on the output - it may be necessary to insert
  9450. an additional @option{format} filter immediately following in the graph to get
  9451. the output in a supported format.
  9452. @section hwmap
  9453. Map hardware frames to system memory or to another device.
  9454. This filter has several different modes of operation; which one is used depends
  9455. on the input and output formats:
  9456. @itemize
  9457. @item
  9458. Hardware frame input, normal frame output
  9459. Map the input frames to system memory and pass them to the output. If the
  9460. original hardware frame is later required (for example, after overlaying
  9461. something else on part of it), the @option{hwmap} filter can be used again
  9462. in the next mode to retrieve it.
  9463. @item
  9464. Normal frame input, hardware frame output
  9465. If the input is actually a software-mapped hardware frame, then unmap it -
  9466. that is, return the original hardware frame.
  9467. Otherwise, a device must be provided. Create new hardware surfaces on that
  9468. device for the output, then map them back to the software format at the input
  9469. and give those frames to the preceding filter. This will then act like the
  9470. @option{hwupload} filter, but may be able to avoid an additional copy when
  9471. the input is already in a compatible format.
  9472. @item
  9473. Hardware frame input and output
  9474. A device must be supplied for the output, either directly or with the
  9475. @option{derive_device} option. The input and output devices must be of
  9476. different types and compatible - the exact meaning of this is
  9477. system-dependent, but typically it means that they must refer to the same
  9478. underlying hardware context (for example, refer to the same graphics card).
  9479. If the input frames were originally created on the output device, then unmap
  9480. to retrieve the original frames.
  9481. Otherwise, map the frames to the output device - create new hardware frames
  9482. on the output corresponding to the frames on the input.
  9483. @end itemize
  9484. The following additional parameters are accepted:
  9485. @table @option
  9486. @item mode
  9487. Set the frame mapping mode. Some combination of:
  9488. @table @var
  9489. @item read
  9490. The mapped frame should be readable.
  9491. @item write
  9492. The mapped frame should be writeable.
  9493. @item overwrite
  9494. The mapping will always overwrite the entire frame.
  9495. This may improve performance in some cases, as the original contents of the
  9496. frame need not be loaded.
  9497. @item direct
  9498. The mapping must not involve any copying.
  9499. Indirect mappings to copies of frames are created in some cases where either
  9500. direct mapping is not possible or it would have unexpected properties.
  9501. Setting this flag ensures that the mapping is direct and will fail if that is
  9502. not possible.
  9503. @end table
  9504. Defaults to @var{read+write} if not specified.
  9505. @item derive_device @var{type}
  9506. Rather than using the device supplied at initialisation, instead derive a new
  9507. device of type @var{type} from the device the input frames exist on.
  9508. @item reverse
  9509. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9510. and map them back to the source. This may be necessary in some cases where
  9511. a mapping in one direction is required but only the opposite direction is
  9512. supported by the devices being used.
  9513. This option is dangerous - it may break the preceding filter in undefined
  9514. ways if there are any additional constraints on that filter's output.
  9515. Do not use it without fully understanding the implications of its use.
  9516. @end table
  9517. @anchor{hwupload}
  9518. @section hwupload
  9519. Upload system memory frames to hardware surfaces.
  9520. The device to upload to must be supplied when the filter is initialised. If
  9521. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9522. option or with the @option{derive_device} option. The input and output devices
  9523. must be of different types and compatible - the exact meaning of this is
  9524. system-dependent, but typically it means that they must refer to the same
  9525. underlying hardware context (for example, refer to the same graphics card).
  9526. The following additional parameters are accepted:
  9527. @table @option
  9528. @item derive_device @var{type}
  9529. Rather than using the device supplied at initialisation, instead derive a new
  9530. device of type @var{type} from the device the input frames exist on.
  9531. @end table
  9532. @anchor{hwupload_cuda}
  9533. @section hwupload_cuda
  9534. Upload system memory frames to a CUDA device.
  9535. It accepts the following optional parameters:
  9536. @table @option
  9537. @item device
  9538. The number of the CUDA device to use
  9539. @end table
  9540. @section hqx
  9541. Apply a high-quality magnification filter designed for pixel art. This filter
  9542. was originally created by Maxim Stepin.
  9543. It accepts the following option:
  9544. @table @option
  9545. @item n
  9546. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9547. @code{hq3x} and @code{4} for @code{hq4x}.
  9548. Default is @code{3}.
  9549. @end table
  9550. @section hstack
  9551. Stack input videos horizontally.
  9552. All streams must be of same pixel format and of same height.
  9553. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9554. to create same output.
  9555. The filter accepts the following option:
  9556. @table @option
  9557. @item inputs
  9558. Set number of input streams. Default is 2.
  9559. @item shortest
  9560. If set to 1, force the output to terminate when the shortest input
  9561. terminates. Default value is 0.
  9562. @end table
  9563. @section hue
  9564. Modify the hue and/or the saturation of the input.
  9565. It accepts the following parameters:
  9566. @table @option
  9567. @item h
  9568. Specify the hue angle as a number of degrees. It accepts an expression,
  9569. and defaults to "0".
  9570. @item s
  9571. Specify the saturation in the [-10,10] range. It accepts an expression and
  9572. defaults to "1".
  9573. @item H
  9574. Specify the hue angle as a number of radians. It accepts an
  9575. expression, and defaults to "0".
  9576. @item b
  9577. Specify the brightness in the [-10,10] range. It accepts an expression and
  9578. defaults to "0".
  9579. @end table
  9580. @option{h} and @option{H} are mutually exclusive, and can't be
  9581. specified at the same time.
  9582. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9583. expressions containing the following constants:
  9584. @table @option
  9585. @item n
  9586. frame count of the input frame starting from 0
  9587. @item pts
  9588. presentation timestamp of the input frame expressed in time base units
  9589. @item r
  9590. frame rate of the input video, NAN if the input frame rate is unknown
  9591. @item t
  9592. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9593. @item tb
  9594. time base of the input video
  9595. @end table
  9596. @subsection Examples
  9597. @itemize
  9598. @item
  9599. Set the hue to 90 degrees and the saturation to 1.0:
  9600. @example
  9601. hue=h=90:s=1
  9602. @end example
  9603. @item
  9604. Same command but expressing the hue in radians:
  9605. @example
  9606. hue=H=PI/2:s=1
  9607. @end example
  9608. @item
  9609. Rotate hue and make the saturation swing between 0
  9610. and 2 over a period of 1 second:
  9611. @example
  9612. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9613. @end example
  9614. @item
  9615. Apply a 3 seconds saturation fade-in effect starting at 0:
  9616. @example
  9617. hue="s=min(t/3\,1)"
  9618. @end example
  9619. The general fade-in expression can be written as:
  9620. @example
  9621. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9622. @end example
  9623. @item
  9624. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9625. @example
  9626. hue="s=max(0\, min(1\, (8-t)/3))"
  9627. @end example
  9628. The general fade-out expression can be written as:
  9629. @example
  9630. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9631. @end example
  9632. @end itemize
  9633. @subsection Commands
  9634. This filter supports the following commands:
  9635. @table @option
  9636. @item b
  9637. @item s
  9638. @item h
  9639. @item H
  9640. Modify the hue and/or the saturation and/or brightness of the input video.
  9641. The command accepts the same syntax of the corresponding option.
  9642. If the specified expression is not valid, it is kept at its current
  9643. value.
  9644. @end table
  9645. @section hysteresis
  9646. Grow first stream into second stream by connecting components.
  9647. This makes it possible to build more robust edge masks.
  9648. This filter accepts the following options:
  9649. @table @option
  9650. @item planes
  9651. Set which planes will be processed as bitmap, unprocessed planes will be
  9652. copied from first stream.
  9653. By default value 0xf, all planes will be processed.
  9654. @item threshold
  9655. Set threshold which is used in filtering. If pixel component value is higher than
  9656. this value filter algorithm for connecting components is activated.
  9657. By default value is 0.
  9658. @end table
  9659. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9660. @section idet
  9661. Detect video interlacing type.
  9662. This filter tries to detect if the input frames are interlaced, progressive,
  9663. top or bottom field first. It will also try to detect fields that are
  9664. repeated between adjacent frames (a sign of telecine).
  9665. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9666. Multiple frame detection incorporates the classification history of previous frames.
  9667. The filter will log these metadata values:
  9668. @table @option
  9669. @item single.current_frame
  9670. Detected type of current frame using single-frame detection. One of:
  9671. ``tff'' (top field first), ``bff'' (bottom field first),
  9672. ``progressive'', or ``undetermined''
  9673. @item single.tff
  9674. Cumulative number of frames detected as top field first using single-frame detection.
  9675. @item multiple.tff
  9676. Cumulative number of frames detected as top field first using multiple-frame detection.
  9677. @item single.bff
  9678. Cumulative number of frames detected as bottom field first using single-frame detection.
  9679. @item multiple.current_frame
  9680. Detected type of current frame using multiple-frame detection. One of:
  9681. ``tff'' (top field first), ``bff'' (bottom field first),
  9682. ``progressive'', or ``undetermined''
  9683. @item multiple.bff
  9684. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9685. @item single.progressive
  9686. Cumulative number of frames detected as progressive using single-frame detection.
  9687. @item multiple.progressive
  9688. Cumulative number of frames detected as progressive using multiple-frame detection.
  9689. @item single.undetermined
  9690. Cumulative number of frames that could not be classified using single-frame detection.
  9691. @item multiple.undetermined
  9692. Cumulative number of frames that could not be classified using multiple-frame detection.
  9693. @item repeated.current_frame
  9694. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9695. @item repeated.neither
  9696. Cumulative number of frames with no repeated field.
  9697. @item repeated.top
  9698. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9699. @item repeated.bottom
  9700. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9701. @end table
  9702. The filter accepts the following options:
  9703. @table @option
  9704. @item intl_thres
  9705. Set interlacing threshold.
  9706. @item prog_thres
  9707. Set progressive threshold.
  9708. @item rep_thres
  9709. Threshold for repeated field detection.
  9710. @item half_life
  9711. Number of frames after which a given frame's contribution to the
  9712. statistics is halved (i.e., it contributes only 0.5 to its
  9713. classification). The default of 0 means that all frames seen are given
  9714. full weight of 1.0 forever.
  9715. @item analyze_interlaced_flag
  9716. When this is not 0 then idet will use the specified number of frames to determine
  9717. if the interlaced flag is accurate, it will not count undetermined frames.
  9718. If the flag is found to be accurate it will be used without any further
  9719. computations, if it is found to be inaccurate it will be cleared without any
  9720. further computations. This allows inserting the idet filter as a low computational
  9721. method to clean up the interlaced flag
  9722. @end table
  9723. @section il
  9724. Deinterleave or interleave fields.
  9725. This filter allows one to process interlaced images fields without
  9726. deinterlacing them. Deinterleaving splits the input frame into 2
  9727. fields (so called half pictures). Odd lines are moved to the top
  9728. half of the output image, even lines to the bottom half.
  9729. You can process (filter) them independently and then re-interleave them.
  9730. The filter accepts the following options:
  9731. @table @option
  9732. @item luma_mode, l
  9733. @item chroma_mode, c
  9734. @item alpha_mode, a
  9735. Available values for @var{luma_mode}, @var{chroma_mode} and
  9736. @var{alpha_mode} are:
  9737. @table @samp
  9738. @item none
  9739. Do nothing.
  9740. @item deinterleave, d
  9741. Deinterleave fields, placing one above the other.
  9742. @item interleave, i
  9743. Interleave fields. Reverse the effect of deinterleaving.
  9744. @end table
  9745. Default value is @code{none}.
  9746. @item luma_swap, ls
  9747. @item chroma_swap, cs
  9748. @item alpha_swap, as
  9749. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9750. @end table
  9751. @subsection Commands
  9752. This filter supports the all above options as @ref{commands}.
  9753. @section inflate
  9754. Apply inflate effect to the video.
  9755. This filter replaces the pixel by the local(3x3) average by taking into account
  9756. only values higher than the pixel.
  9757. It accepts the following options:
  9758. @table @option
  9759. @item threshold0
  9760. @item threshold1
  9761. @item threshold2
  9762. @item threshold3
  9763. Limit the maximum change for each plane, default is 65535.
  9764. If 0, plane will remain unchanged.
  9765. @end table
  9766. @subsection Commands
  9767. This filter supports the all above options as @ref{commands}.
  9768. @section interlace
  9769. Simple interlacing filter from progressive contents. This interleaves upper (or
  9770. lower) lines from odd frames with lower (or upper) lines from even frames,
  9771. halving the frame rate and preserving image height.
  9772. @example
  9773. Original Original New Frame
  9774. Frame 'j' Frame 'j+1' (tff)
  9775. ========== =========== ==================
  9776. Line 0 --------------------> Frame 'j' Line 0
  9777. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9778. Line 2 ---------------------> Frame 'j' Line 2
  9779. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9780. ... ... ...
  9781. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9782. @end example
  9783. It accepts the following optional parameters:
  9784. @table @option
  9785. @item scan
  9786. This determines whether the interlaced frame is taken from the even
  9787. (tff - default) or odd (bff) lines of the progressive frame.
  9788. @item lowpass
  9789. Vertical lowpass filter to avoid twitter interlacing and
  9790. reduce moire patterns.
  9791. @table @samp
  9792. @item 0, off
  9793. Disable vertical lowpass filter
  9794. @item 1, linear
  9795. Enable linear filter (default)
  9796. @item 2, complex
  9797. Enable complex filter. This will slightly less reduce twitter and moire
  9798. but better retain detail and subjective sharpness impression.
  9799. @end table
  9800. @end table
  9801. @section kerndeint
  9802. Deinterlace input video by applying Donald Graft's adaptive kernel
  9803. deinterling. Work on interlaced parts of a video to produce
  9804. progressive frames.
  9805. The description of the accepted parameters follows.
  9806. @table @option
  9807. @item thresh
  9808. Set the threshold which affects the filter's tolerance when
  9809. determining if a pixel line must be processed. It must be an integer
  9810. in the range [0,255] and defaults to 10. A value of 0 will result in
  9811. applying the process on every pixels.
  9812. @item map
  9813. Paint pixels exceeding the threshold value to white if set to 1.
  9814. Default is 0.
  9815. @item order
  9816. Set the fields order. Swap fields if set to 1, leave fields alone if
  9817. 0. Default is 0.
  9818. @item sharp
  9819. Enable additional sharpening if set to 1. Default is 0.
  9820. @item twoway
  9821. Enable twoway sharpening if set to 1. Default is 0.
  9822. @end table
  9823. @subsection Examples
  9824. @itemize
  9825. @item
  9826. Apply default values:
  9827. @example
  9828. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9829. @end example
  9830. @item
  9831. Enable additional sharpening:
  9832. @example
  9833. kerndeint=sharp=1
  9834. @end example
  9835. @item
  9836. Paint processed pixels in white:
  9837. @example
  9838. kerndeint=map=1
  9839. @end example
  9840. @end itemize
  9841. @section lagfun
  9842. Slowly update darker pixels.
  9843. This filter makes short flashes of light appear longer.
  9844. This filter accepts the following options:
  9845. @table @option
  9846. @item decay
  9847. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9848. @item planes
  9849. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9850. @end table
  9851. @section lenscorrection
  9852. Correct radial lens distortion
  9853. This filter can be used to correct for radial distortion as can result from the use
  9854. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9855. one can use tools available for example as part of opencv or simply trial-and-error.
  9856. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9857. and extract the k1 and k2 coefficients from the resulting matrix.
  9858. Note that effectively the same filter is available in the open-source tools Krita and
  9859. Digikam from the KDE project.
  9860. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9861. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9862. brightness distribution, so you may want to use both filters together in certain
  9863. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9864. be applied before or after lens correction.
  9865. @subsection Options
  9866. The filter accepts the following options:
  9867. @table @option
  9868. @item cx
  9869. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9870. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9871. width. Default is 0.5.
  9872. @item cy
  9873. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9874. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9875. height. Default is 0.5.
  9876. @item k1
  9877. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9878. no correction. Default is 0.
  9879. @item k2
  9880. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9881. 0 means no correction. Default is 0.
  9882. @end table
  9883. The formula that generates the correction is:
  9884. @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)
  9885. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9886. distances from the focal point in the source and target images, respectively.
  9887. @section lensfun
  9888. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9889. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9890. to apply the lens correction. The filter will load the lensfun database and
  9891. query it to find the corresponding camera and lens entries in the database. As
  9892. long as these entries can be found with the given options, the filter can
  9893. perform corrections on frames. Note that incomplete strings will result in the
  9894. filter choosing the best match with the given options, and the filter will
  9895. output the chosen camera and lens models (logged with level "info"). You must
  9896. provide the make, camera model, and lens model as they are required.
  9897. The filter accepts the following options:
  9898. @table @option
  9899. @item make
  9900. The make of the camera (for example, "Canon"). This option is required.
  9901. @item model
  9902. The model of the camera (for example, "Canon EOS 100D"). This option is
  9903. required.
  9904. @item lens_model
  9905. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9906. option is required.
  9907. @item mode
  9908. The type of correction to apply. The following values are valid options:
  9909. @table @samp
  9910. @item vignetting
  9911. Enables fixing lens vignetting.
  9912. @item geometry
  9913. Enables fixing lens geometry. This is the default.
  9914. @item subpixel
  9915. Enables fixing chromatic aberrations.
  9916. @item vig_geo
  9917. Enables fixing lens vignetting and lens geometry.
  9918. @item vig_subpixel
  9919. Enables fixing lens vignetting and chromatic aberrations.
  9920. @item distortion
  9921. Enables fixing both lens geometry and chromatic aberrations.
  9922. @item all
  9923. Enables all possible corrections.
  9924. @end table
  9925. @item focal_length
  9926. The focal length of the image/video (zoom; expected constant for video). For
  9927. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9928. range should be chosen when using that lens. Default 18.
  9929. @item aperture
  9930. The aperture of the image/video (expected constant for video). Note that
  9931. aperture is only used for vignetting correction. Default 3.5.
  9932. @item focus_distance
  9933. The focus distance of the image/video (expected constant for video). Note that
  9934. focus distance is only used for vignetting and only slightly affects the
  9935. vignetting correction process. If unknown, leave it at the default value (which
  9936. is 1000).
  9937. @item scale
  9938. The scale factor which is applied after transformation. After correction the
  9939. video is no longer necessarily rectangular. This parameter controls how much of
  9940. the resulting image is visible. The value 0 means that a value will be chosen
  9941. automatically such that there is little or no unmapped area in the output
  9942. image. 1.0 means that no additional scaling is done. Lower values may result
  9943. in more of the corrected image being visible, while higher values may avoid
  9944. unmapped areas in the output.
  9945. @item target_geometry
  9946. The target geometry of the output image/video. The following values are valid
  9947. options:
  9948. @table @samp
  9949. @item rectilinear (default)
  9950. @item fisheye
  9951. @item panoramic
  9952. @item equirectangular
  9953. @item fisheye_orthographic
  9954. @item fisheye_stereographic
  9955. @item fisheye_equisolid
  9956. @item fisheye_thoby
  9957. @end table
  9958. @item reverse
  9959. Apply the reverse of image correction (instead of correcting distortion, apply
  9960. it).
  9961. @item interpolation
  9962. The type of interpolation used when correcting distortion. The following values
  9963. are valid options:
  9964. @table @samp
  9965. @item nearest
  9966. @item linear (default)
  9967. @item lanczos
  9968. @end table
  9969. @end table
  9970. @subsection Examples
  9971. @itemize
  9972. @item
  9973. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9974. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9975. aperture of "8.0".
  9976. @example
  9977. 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
  9978. @end example
  9979. @item
  9980. Apply the same as before, but only for the first 5 seconds of video.
  9981. @example
  9982. 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
  9983. @end example
  9984. @end itemize
  9985. @section libvmaf
  9986. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9987. score between two input videos.
  9988. The obtained VMAF score is printed through the logging system.
  9989. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9990. After installing the library it can be enabled using:
  9991. @code{./configure --enable-libvmaf}.
  9992. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9993. The filter has following options:
  9994. @table @option
  9995. @item model_path
  9996. Set the model path which is to be used for SVM.
  9997. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9998. @item log_path
  9999. Set the file path to be used to store logs.
  10000. @item log_fmt
  10001. Set the format of the log file (csv, json or xml).
  10002. @item enable_transform
  10003. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  10004. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  10005. Default value: @code{false}
  10006. @item phone_model
  10007. Invokes the phone model which will generate VMAF scores higher than in the
  10008. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  10009. Default value: @code{false}
  10010. @item psnr
  10011. Enables computing psnr along with vmaf.
  10012. Default value: @code{false}
  10013. @item ssim
  10014. Enables computing ssim along with vmaf.
  10015. Default value: @code{false}
  10016. @item ms_ssim
  10017. Enables computing ms_ssim along with vmaf.
  10018. Default value: @code{false}
  10019. @item pool
  10020. Set the pool method to be used for computing vmaf.
  10021. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  10022. @item n_threads
  10023. Set number of threads to be used when computing vmaf.
  10024. Default value: @code{0}, which makes use of all available logical processors.
  10025. @item n_subsample
  10026. Set interval for frame subsampling used when computing vmaf.
  10027. Default value: @code{1}
  10028. @item enable_conf_interval
  10029. Enables confidence interval.
  10030. Default value: @code{false}
  10031. @end table
  10032. This filter also supports the @ref{framesync} options.
  10033. @subsection Examples
  10034. @itemize
  10035. @item
  10036. On the below examples the input file @file{main.mpg} being processed is
  10037. compared with the reference file @file{ref.mpg}.
  10038. @example
  10039. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  10040. @end example
  10041. @item
  10042. Example with options:
  10043. @example
  10044. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  10045. @end example
  10046. @item
  10047. Example with options and different containers:
  10048. @example
  10049. 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 -
  10050. @end example
  10051. @end itemize
  10052. @section limiter
  10053. Limits the pixel components values to the specified range [min, max].
  10054. The filter accepts the following options:
  10055. @table @option
  10056. @item min
  10057. Lower bound. Defaults to the lowest allowed value for the input.
  10058. @item max
  10059. Upper bound. Defaults to the highest allowed value for the input.
  10060. @item planes
  10061. Specify which planes will be processed. Defaults to all available.
  10062. @end table
  10063. @section loop
  10064. Loop video frames.
  10065. The filter accepts the following options:
  10066. @table @option
  10067. @item loop
  10068. Set the number of loops. Setting this value to -1 will result in infinite loops.
  10069. Default is 0.
  10070. @item size
  10071. Set maximal size in number of frames. Default is 0.
  10072. @item start
  10073. Set first frame of loop. Default is 0.
  10074. @end table
  10075. @subsection Examples
  10076. @itemize
  10077. @item
  10078. Loop single first frame infinitely:
  10079. @example
  10080. loop=loop=-1:size=1:start=0
  10081. @end example
  10082. @item
  10083. Loop single first frame 10 times:
  10084. @example
  10085. loop=loop=10:size=1:start=0
  10086. @end example
  10087. @item
  10088. Loop 10 first frames 5 times:
  10089. @example
  10090. loop=loop=5:size=10:start=0
  10091. @end example
  10092. @end itemize
  10093. @section lut1d
  10094. Apply a 1D LUT to an input video.
  10095. The filter accepts the following options:
  10096. @table @option
  10097. @item file
  10098. Set the 1D LUT file name.
  10099. Currently supported formats:
  10100. @table @samp
  10101. @item cube
  10102. Iridas
  10103. @item csp
  10104. cineSpace
  10105. @end table
  10106. @item interp
  10107. Select interpolation mode.
  10108. Available values are:
  10109. @table @samp
  10110. @item nearest
  10111. Use values from the nearest defined point.
  10112. @item linear
  10113. Interpolate values using the linear interpolation.
  10114. @item cosine
  10115. Interpolate values using the cosine interpolation.
  10116. @item cubic
  10117. Interpolate values using the cubic interpolation.
  10118. @item spline
  10119. Interpolate values using the spline interpolation.
  10120. @end table
  10121. @end table
  10122. @anchor{lut3d}
  10123. @section lut3d
  10124. Apply a 3D LUT to an input video.
  10125. The filter accepts the following options:
  10126. @table @option
  10127. @item file
  10128. Set the 3D LUT file name.
  10129. Currently supported formats:
  10130. @table @samp
  10131. @item 3dl
  10132. AfterEffects
  10133. @item cube
  10134. Iridas
  10135. @item dat
  10136. DaVinci
  10137. @item m3d
  10138. Pandora
  10139. @item csp
  10140. cineSpace
  10141. @end table
  10142. @item interp
  10143. Select interpolation mode.
  10144. Available values are:
  10145. @table @samp
  10146. @item nearest
  10147. Use values from the nearest defined point.
  10148. @item trilinear
  10149. Interpolate values using the 8 points defining a cube.
  10150. @item tetrahedral
  10151. Interpolate values using a tetrahedron.
  10152. @end table
  10153. @end table
  10154. @section lumakey
  10155. Turn certain luma values into transparency.
  10156. The filter accepts the following options:
  10157. @table @option
  10158. @item threshold
  10159. Set the luma which will be used as base for transparency.
  10160. Default value is @code{0}.
  10161. @item tolerance
  10162. Set the range of luma values to be keyed out.
  10163. Default value is @code{0.01}.
  10164. @item softness
  10165. Set the range of softness. Default value is @code{0}.
  10166. Use this to control gradual transition from zero to full transparency.
  10167. @end table
  10168. @subsection Commands
  10169. This filter supports same @ref{commands} as options.
  10170. The command accepts the same syntax of the corresponding option.
  10171. If the specified expression is not valid, it is kept at its current
  10172. value.
  10173. @section lut, lutrgb, lutyuv
  10174. Compute a look-up table for binding each pixel component input value
  10175. to an output value, and apply it to the input video.
  10176. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10177. to an RGB input video.
  10178. These filters accept the following parameters:
  10179. @table @option
  10180. @item c0
  10181. set first pixel component expression
  10182. @item c1
  10183. set second pixel component expression
  10184. @item c2
  10185. set third pixel component expression
  10186. @item c3
  10187. set fourth pixel component expression, corresponds to the alpha component
  10188. @item r
  10189. set red component expression
  10190. @item g
  10191. set green component expression
  10192. @item b
  10193. set blue component expression
  10194. @item a
  10195. alpha component expression
  10196. @item y
  10197. set Y/luminance component expression
  10198. @item u
  10199. set U/Cb component expression
  10200. @item v
  10201. set V/Cr component expression
  10202. @end table
  10203. Each of them specifies the expression to use for computing the lookup table for
  10204. the corresponding pixel component values.
  10205. The exact component associated to each of the @var{c*} options depends on the
  10206. format in input.
  10207. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10208. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10209. The expressions can contain the following constants and functions:
  10210. @table @option
  10211. @item w
  10212. @item h
  10213. The input width and height.
  10214. @item val
  10215. The input value for the pixel component.
  10216. @item clipval
  10217. The input value, clipped to the @var{minval}-@var{maxval} range.
  10218. @item maxval
  10219. The maximum value for the pixel component.
  10220. @item minval
  10221. The minimum value for the pixel component.
  10222. @item negval
  10223. The negated value for the pixel component value, clipped to the
  10224. @var{minval}-@var{maxval} range; it corresponds to the expression
  10225. "maxval-clipval+minval".
  10226. @item clip(val)
  10227. The computed value in @var{val}, clipped to the
  10228. @var{minval}-@var{maxval} range.
  10229. @item gammaval(gamma)
  10230. The computed gamma correction value of the pixel component value,
  10231. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10232. expression
  10233. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10234. @end table
  10235. All expressions default to "val".
  10236. @subsection Examples
  10237. @itemize
  10238. @item
  10239. Negate input video:
  10240. @example
  10241. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10242. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10243. @end example
  10244. The above is the same as:
  10245. @example
  10246. lutrgb="r=negval:g=negval:b=negval"
  10247. lutyuv="y=negval:u=negval:v=negval"
  10248. @end example
  10249. @item
  10250. Negate luminance:
  10251. @example
  10252. lutyuv=y=negval
  10253. @end example
  10254. @item
  10255. Remove chroma components, turning the video into a graytone image:
  10256. @example
  10257. lutyuv="u=128:v=128"
  10258. @end example
  10259. @item
  10260. Apply a luma burning effect:
  10261. @example
  10262. lutyuv="y=2*val"
  10263. @end example
  10264. @item
  10265. Remove green and blue components:
  10266. @example
  10267. lutrgb="g=0:b=0"
  10268. @end example
  10269. @item
  10270. Set a constant alpha channel value on input:
  10271. @example
  10272. format=rgba,lutrgb=a="maxval-minval/2"
  10273. @end example
  10274. @item
  10275. Correct luminance gamma by a factor of 0.5:
  10276. @example
  10277. lutyuv=y=gammaval(0.5)
  10278. @end example
  10279. @item
  10280. Discard least significant bits of luma:
  10281. @example
  10282. lutyuv=y='bitand(val, 128+64+32)'
  10283. @end example
  10284. @item
  10285. Technicolor like effect:
  10286. @example
  10287. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10288. @end example
  10289. @end itemize
  10290. @section lut2, tlut2
  10291. The @code{lut2} filter takes two input streams and outputs one
  10292. stream.
  10293. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10294. from one single stream.
  10295. This filter accepts the following parameters:
  10296. @table @option
  10297. @item c0
  10298. set first pixel component expression
  10299. @item c1
  10300. set second pixel component expression
  10301. @item c2
  10302. set third pixel component expression
  10303. @item c3
  10304. set fourth pixel component expression, corresponds to the alpha component
  10305. @item d
  10306. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10307. which means bit depth is automatically picked from first input format.
  10308. @end table
  10309. The @code{lut2} filter also supports the @ref{framesync} options.
  10310. Each of them specifies the expression to use for computing the lookup table for
  10311. the corresponding pixel component values.
  10312. The exact component associated to each of the @var{c*} options depends on the
  10313. format in inputs.
  10314. The expressions can contain the following constants:
  10315. @table @option
  10316. @item w
  10317. @item h
  10318. The input width and height.
  10319. @item x
  10320. The first input value for the pixel component.
  10321. @item y
  10322. The second input value for the pixel component.
  10323. @item bdx
  10324. The first input video bit depth.
  10325. @item bdy
  10326. The second input video bit depth.
  10327. @end table
  10328. All expressions default to "x".
  10329. @subsection Examples
  10330. @itemize
  10331. @item
  10332. Highlight differences between two RGB video streams:
  10333. @example
  10334. 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)'
  10335. @end example
  10336. @item
  10337. Highlight differences between two YUV video streams:
  10338. @example
  10339. 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)'
  10340. @end example
  10341. @item
  10342. Show max difference between two video streams:
  10343. @example
  10344. 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)))'
  10345. @end example
  10346. @end itemize
  10347. @section maskedclamp
  10348. Clamp the first input stream with the second input and third input stream.
  10349. Returns the value of first stream to be between second input
  10350. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10351. This filter accepts the following options:
  10352. @table @option
  10353. @item undershoot
  10354. Default value is @code{0}.
  10355. @item overshoot
  10356. Default value is @code{0}.
  10357. @item planes
  10358. Set which planes will be processed as bitmap, unprocessed planes will be
  10359. copied from first stream.
  10360. By default value 0xf, all planes will be processed.
  10361. @end table
  10362. @section maskedmax
  10363. Merge the second and third input stream into output stream using absolute differences
  10364. between second input stream and first input stream and absolute difference between
  10365. third input stream and first input stream. The picked value will be from second input
  10366. stream if second absolute difference is greater than first one or from third input stream
  10367. otherwise.
  10368. This filter accepts the following options:
  10369. @table @option
  10370. @item planes
  10371. Set which planes will be processed as bitmap, unprocessed planes will be
  10372. copied from first stream.
  10373. By default value 0xf, all planes will be processed.
  10374. @end table
  10375. @section maskedmerge
  10376. Merge the first input stream with the second input stream using per pixel
  10377. weights in the third input stream.
  10378. A value of 0 in the third stream pixel component means that pixel component
  10379. from first stream is returned unchanged, while maximum value (eg. 255 for
  10380. 8-bit videos) means that pixel component from second stream is returned
  10381. unchanged. Intermediate values define the amount of merging between both
  10382. input stream's pixel components.
  10383. This filter accepts the following options:
  10384. @table @option
  10385. @item planes
  10386. Set which planes will be processed as bitmap, unprocessed planes will be
  10387. copied from first stream.
  10388. By default value 0xf, all planes will be processed.
  10389. @end table
  10390. @section maskedmin
  10391. Merge the second and third input stream into output stream using absolute differences
  10392. between second input stream and first input stream and absolute difference between
  10393. third input stream and first input stream. The picked value will be from second input
  10394. stream if second absolute difference is less than first one or from third input stream
  10395. otherwise.
  10396. This filter accepts the following options:
  10397. @table @option
  10398. @item planes
  10399. Set which planes will be processed as bitmap, unprocessed planes will be
  10400. copied from first stream.
  10401. By default value 0xf, all planes will be processed.
  10402. @end table
  10403. @section maskedthreshold
  10404. Pick pixels comparing absolute difference of two video streams with fixed
  10405. threshold.
  10406. If absolute difference between pixel component of first and second video
  10407. stream is equal or lower than user supplied threshold than pixel component
  10408. from first video stream is picked, otherwise pixel component from second
  10409. video stream is picked.
  10410. This filter accepts the following options:
  10411. @table @option
  10412. @item threshold
  10413. Set threshold used when picking pixels from absolute difference from two input
  10414. video streams.
  10415. @item planes
  10416. Set which planes will be processed as bitmap, unprocessed planes will be
  10417. copied from second stream.
  10418. By default value 0xf, all planes will be processed.
  10419. @end table
  10420. @section maskfun
  10421. Create mask from input video.
  10422. For example it is useful to create motion masks after @code{tblend} filter.
  10423. This filter accepts the following options:
  10424. @table @option
  10425. @item low
  10426. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10427. @item high
  10428. Set high threshold. Any pixel component higher than this value will be set to max value
  10429. allowed for current pixel format.
  10430. @item planes
  10431. Set planes to filter, by default all available planes are filtered.
  10432. @item fill
  10433. Fill all frame pixels with this value.
  10434. @item sum
  10435. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10436. average, output frame will be completely filled with value set by @var{fill} option.
  10437. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10438. @end table
  10439. @section mcdeint
  10440. Apply motion-compensation deinterlacing.
  10441. It needs one field per frame as input and must thus be used together
  10442. with yadif=1/3 or equivalent.
  10443. This filter accepts the following options:
  10444. @table @option
  10445. @item mode
  10446. Set the deinterlacing mode.
  10447. It accepts one of the following values:
  10448. @table @samp
  10449. @item fast
  10450. @item medium
  10451. @item slow
  10452. use iterative motion estimation
  10453. @item extra_slow
  10454. like @samp{slow}, but use multiple reference frames.
  10455. @end table
  10456. Default value is @samp{fast}.
  10457. @item parity
  10458. Set the picture field parity assumed for the input video. It must be
  10459. one of the following values:
  10460. @table @samp
  10461. @item 0, tff
  10462. assume top field first
  10463. @item 1, bff
  10464. assume bottom field first
  10465. @end table
  10466. Default value is @samp{bff}.
  10467. @item qp
  10468. Set per-block quantization parameter (QP) used by the internal
  10469. encoder.
  10470. Higher values should result in a smoother motion vector field but less
  10471. optimal individual vectors. Default value is 1.
  10472. @end table
  10473. @section median
  10474. Pick median pixel from certain rectangle defined by radius.
  10475. This filter accepts the following options:
  10476. @table @option
  10477. @item radius
  10478. Set horizontal radius size. Default value is @code{1}.
  10479. Allowed range is integer from 1 to 127.
  10480. @item planes
  10481. Set which planes to process. Default is @code{15}, which is all available planes.
  10482. @item radiusV
  10483. Set vertical radius size. Default value is @code{0}.
  10484. Allowed range is integer from 0 to 127.
  10485. If it is 0, value will be picked from horizontal @code{radius} option.
  10486. @item percentile
  10487. Set median percentile. Default value is @code{0.5}.
  10488. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10489. minimum values, and @code{1} maximum values.
  10490. @end table
  10491. @subsection Commands
  10492. This filter supports same @ref{commands} as options.
  10493. The command accepts the same syntax of the corresponding option.
  10494. If the specified expression is not valid, it is kept at its current
  10495. value.
  10496. @section mergeplanes
  10497. Merge color channel components from several video streams.
  10498. The filter accepts up to 4 input streams, and merge selected input
  10499. planes to the output video.
  10500. This filter accepts the following options:
  10501. @table @option
  10502. @item mapping
  10503. Set input to output plane mapping. Default is @code{0}.
  10504. The mappings is specified as a bitmap. It should be specified as a
  10505. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10506. mapping for the first plane of the output stream. 'A' sets the number of
  10507. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10508. corresponding input to use (from 0 to 3). The rest of the mappings is
  10509. similar, 'Bb' describes the mapping for the output stream second
  10510. plane, 'Cc' describes the mapping for the output stream third plane and
  10511. 'Dd' describes the mapping for the output stream fourth plane.
  10512. @item format
  10513. Set output pixel format. Default is @code{yuva444p}.
  10514. @end table
  10515. @subsection Examples
  10516. @itemize
  10517. @item
  10518. Merge three gray video streams of same width and height into single video stream:
  10519. @example
  10520. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10521. @end example
  10522. @item
  10523. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10524. @example
  10525. [a0][a1]mergeplanes=0x00010210:yuva444p
  10526. @end example
  10527. @item
  10528. Swap Y and A plane in yuva444p stream:
  10529. @example
  10530. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10531. @end example
  10532. @item
  10533. Swap U and V plane in yuv420p stream:
  10534. @example
  10535. format=yuv420p,mergeplanes=0x000201:yuv420p
  10536. @end example
  10537. @item
  10538. Cast a rgb24 clip to yuv444p:
  10539. @example
  10540. format=rgb24,mergeplanes=0x000102:yuv444p
  10541. @end example
  10542. @end itemize
  10543. @section mestimate
  10544. Estimate and export motion vectors using block matching algorithms.
  10545. Motion vectors are stored in frame side data to be used by other filters.
  10546. This filter accepts the following options:
  10547. @table @option
  10548. @item method
  10549. Specify the motion estimation method. Accepts one of the following values:
  10550. @table @samp
  10551. @item esa
  10552. Exhaustive search algorithm.
  10553. @item tss
  10554. Three step search algorithm.
  10555. @item tdls
  10556. Two dimensional logarithmic search algorithm.
  10557. @item ntss
  10558. New three step search algorithm.
  10559. @item fss
  10560. Four step search algorithm.
  10561. @item ds
  10562. Diamond search algorithm.
  10563. @item hexbs
  10564. Hexagon-based search algorithm.
  10565. @item epzs
  10566. Enhanced predictive zonal search algorithm.
  10567. @item umh
  10568. Uneven multi-hexagon search algorithm.
  10569. @end table
  10570. Default value is @samp{esa}.
  10571. @item mb_size
  10572. Macroblock size. Default @code{16}.
  10573. @item search_param
  10574. Search parameter. Default @code{7}.
  10575. @end table
  10576. @section midequalizer
  10577. Apply Midway Image Equalization effect using two video streams.
  10578. Midway Image Equalization adjusts a pair of images to have the same
  10579. histogram, while maintaining their dynamics as much as possible. It's
  10580. useful for e.g. matching exposures from a pair of stereo cameras.
  10581. This filter has two inputs and one output, which must be of same pixel format, but
  10582. may be of different sizes. The output of filter is first input adjusted with
  10583. midway histogram of both inputs.
  10584. This filter accepts the following option:
  10585. @table @option
  10586. @item planes
  10587. Set which planes to process. Default is @code{15}, which is all available planes.
  10588. @end table
  10589. @section minterpolate
  10590. Convert the video to specified frame rate using motion interpolation.
  10591. This filter accepts the following options:
  10592. @table @option
  10593. @item fps
  10594. 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}.
  10595. @item mi_mode
  10596. Motion interpolation mode. Following values are accepted:
  10597. @table @samp
  10598. @item dup
  10599. Duplicate previous or next frame for interpolating new ones.
  10600. @item blend
  10601. Blend source frames. Interpolated frame is mean of previous and next frames.
  10602. @item mci
  10603. Motion compensated interpolation. Following options are effective when this mode is selected:
  10604. @table @samp
  10605. @item mc_mode
  10606. Motion compensation mode. Following values are accepted:
  10607. @table @samp
  10608. @item obmc
  10609. Overlapped block motion compensation.
  10610. @item aobmc
  10611. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10612. @end table
  10613. Default mode is @samp{obmc}.
  10614. @item me_mode
  10615. Motion estimation mode. Following values are accepted:
  10616. @table @samp
  10617. @item bidir
  10618. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10619. @item bilat
  10620. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10621. @end table
  10622. Default mode is @samp{bilat}.
  10623. @item me
  10624. The algorithm to be used for motion estimation. Following values are accepted:
  10625. @table @samp
  10626. @item esa
  10627. Exhaustive search algorithm.
  10628. @item tss
  10629. Three step search algorithm.
  10630. @item tdls
  10631. Two dimensional logarithmic search algorithm.
  10632. @item ntss
  10633. New three step search algorithm.
  10634. @item fss
  10635. Four step search algorithm.
  10636. @item ds
  10637. Diamond search algorithm.
  10638. @item hexbs
  10639. Hexagon-based search algorithm.
  10640. @item epzs
  10641. Enhanced predictive zonal search algorithm.
  10642. @item umh
  10643. Uneven multi-hexagon search algorithm.
  10644. @end table
  10645. Default algorithm is @samp{epzs}.
  10646. @item mb_size
  10647. Macroblock size. Default @code{16}.
  10648. @item search_param
  10649. Motion estimation search parameter. Default @code{32}.
  10650. @item vsbmc
  10651. 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).
  10652. @end table
  10653. @end table
  10654. @item scd
  10655. 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:
  10656. @table @samp
  10657. @item none
  10658. Disable scene change detection.
  10659. @item fdiff
  10660. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10661. @end table
  10662. Default method is @samp{fdiff}.
  10663. @item scd_threshold
  10664. Scene change detection threshold. Default is @code{10.}.
  10665. @end table
  10666. @section mix
  10667. Mix several video input streams into one video stream.
  10668. A description of the accepted options follows.
  10669. @table @option
  10670. @item nb_inputs
  10671. The number of inputs. If unspecified, it defaults to 2.
  10672. @item weights
  10673. Specify weight of each input video stream as sequence.
  10674. Each weight is separated by space. If number of weights
  10675. is smaller than number of @var{frames} last specified
  10676. weight will be used for all remaining unset weights.
  10677. @item scale
  10678. Specify scale, if it is set it will be multiplied with sum
  10679. of each weight multiplied with pixel values to give final destination
  10680. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10681. @item duration
  10682. Specify how end of stream is determined.
  10683. @table @samp
  10684. @item longest
  10685. The duration of the longest input. (default)
  10686. @item shortest
  10687. The duration of the shortest input.
  10688. @item first
  10689. The duration of the first input.
  10690. @end table
  10691. @end table
  10692. @section mpdecimate
  10693. Drop frames that do not differ greatly from the previous frame in
  10694. order to reduce frame rate.
  10695. The main use of this filter is for very-low-bitrate encoding
  10696. (e.g. streaming over dialup modem), but it could in theory be used for
  10697. fixing movies that were inverse-telecined incorrectly.
  10698. A description of the accepted options follows.
  10699. @table @option
  10700. @item max
  10701. Set the maximum number of consecutive frames which can be dropped (if
  10702. positive), or the minimum interval between dropped frames (if
  10703. negative). If the value is 0, the frame is dropped disregarding the
  10704. number of previous sequentially dropped frames.
  10705. Default value is 0.
  10706. @item hi
  10707. @item lo
  10708. @item frac
  10709. Set the dropping threshold values.
  10710. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10711. represent actual pixel value differences, so a threshold of 64
  10712. corresponds to 1 unit of difference for each pixel, or the same spread
  10713. out differently over the block.
  10714. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10715. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10716. meaning the whole image) differ by more than a threshold of @option{lo}.
  10717. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10718. 64*5, and default value for @option{frac} is 0.33.
  10719. @end table
  10720. @section negate
  10721. Negate (invert) the input video.
  10722. It accepts the following option:
  10723. @table @option
  10724. @item negate_alpha
  10725. With value 1, it negates the alpha component, if present. Default value is 0.
  10726. @end table
  10727. @anchor{nlmeans}
  10728. @section nlmeans
  10729. Denoise frames using Non-Local Means algorithm.
  10730. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10731. context similarity is defined by comparing their surrounding patches of size
  10732. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10733. around the pixel.
  10734. Note that the research area defines centers for patches, which means some
  10735. patches will be made of pixels outside that research area.
  10736. The filter accepts the following options.
  10737. @table @option
  10738. @item s
  10739. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10740. @item p
  10741. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10742. @item pc
  10743. Same as @option{p} but for chroma planes.
  10744. The default value is @var{0} and means automatic.
  10745. @item r
  10746. Set research size. Default is 15. Must be odd number in range [0, 99].
  10747. @item rc
  10748. Same as @option{r} but for chroma planes.
  10749. The default value is @var{0} and means automatic.
  10750. @end table
  10751. @section nnedi
  10752. Deinterlace video using neural network edge directed interpolation.
  10753. This filter accepts the following options:
  10754. @table @option
  10755. @item weights
  10756. Mandatory option, without binary file filter can not work.
  10757. Currently file can be found here:
  10758. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10759. @item deint
  10760. Set which frames to deinterlace, by default it is @code{all}.
  10761. Can be @code{all} or @code{interlaced}.
  10762. @item field
  10763. Set mode of operation.
  10764. Can be one of the following:
  10765. @table @samp
  10766. @item af
  10767. Use frame flags, both fields.
  10768. @item a
  10769. Use frame flags, single field.
  10770. @item t
  10771. Use top field only.
  10772. @item b
  10773. Use bottom field only.
  10774. @item tf
  10775. Use both fields, top first.
  10776. @item bf
  10777. Use both fields, bottom first.
  10778. @end table
  10779. @item planes
  10780. Set which planes to process, by default filter process all frames.
  10781. @item nsize
  10782. Set size of local neighborhood around each pixel, used by the predictor neural
  10783. network.
  10784. Can be one of the following:
  10785. @table @samp
  10786. @item s8x6
  10787. @item s16x6
  10788. @item s32x6
  10789. @item s48x6
  10790. @item s8x4
  10791. @item s16x4
  10792. @item s32x4
  10793. @end table
  10794. @item nns
  10795. Set the number of neurons in predictor neural network.
  10796. Can be one of the following:
  10797. @table @samp
  10798. @item n16
  10799. @item n32
  10800. @item n64
  10801. @item n128
  10802. @item n256
  10803. @end table
  10804. @item qual
  10805. Controls the number of different neural network predictions that are blended
  10806. together to compute the final output value. Can be @code{fast}, default or
  10807. @code{slow}.
  10808. @item etype
  10809. Set which set of weights to use in the predictor.
  10810. Can be one of the following:
  10811. @table @samp
  10812. @item a
  10813. weights trained to minimize absolute error
  10814. @item s
  10815. weights trained to minimize squared error
  10816. @end table
  10817. @item pscrn
  10818. Controls whether or not the prescreener neural network is used to decide
  10819. which pixels should be processed by the predictor neural network and which
  10820. can be handled by simple cubic interpolation.
  10821. The prescreener is trained to know whether cubic interpolation will be
  10822. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10823. The computational complexity of the prescreener nn is much less than that of
  10824. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10825. using the prescreener generally results in much faster processing.
  10826. The prescreener is pretty accurate, so the difference between using it and not
  10827. using it is almost always unnoticeable.
  10828. Can be one of the following:
  10829. @table @samp
  10830. @item none
  10831. @item original
  10832. @item new
  10833. @end table
  10834. Default is @code{new}.
  10835. @item fapprox
  10836. Set various debugging flags.
  10837. @end table
  10838. @section noformat
  10839. Force libavfilter not to use any of the specified pixel formats for the
  10840. input to the next filter.
  10841. It accepts the following parameters:
  10842. @table @option
  10843. @item pix_fmts
  10844. A '|'-separated list of pixel format names, such as
  10845. pix_fmts=yuv420p|monow|rgb24".
  10846. @end table
  10847. @subsection Examples
  10848. @itemize
  10849. @item
  10850. Force libavfilter to use a format different from @var{yuv420p} for the
  10851. input to the vflip filter:
  10852. @example
  10853. noformat=pix_fmts=yuv420p,vflip
  10854. @end example
  10855. @item
  10856. Convert the input video to any of the formats not contained in the list:
  10857. @example
  10858. noformat=yuv420p|yuv444p|yuv410p
  10859. @end example
  10860. @end itemize
  10861. @section noise
  10862. Add noise on video input frame.
  10863. The filter accepts the following options:
  10864. @table @option
  10865. @item all_seed
  10866. @item c0_seed
  10867. @item c1_seed
  10868. @item c2_seed
  10869. @item c3_seed
  10870. Set noise seed for specific pixel component or all pixel components in case
  10871. of @var{all_seed}. Default value is @code{123457}.
  10872. @item all_strength, alls
  10873. @item c0_strength, c0s
  10874. @item c1_strength, c1s
  10875. @item c2_strength, c2s
  10876. @item c3_strength, c3s
  10877. Set noise strength for specific pixel component or all pixel components in case
  10878. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10879. @item all_flags, allf
  10880. @item c0_flags, c0f
  10881. @item c1_flags, c1f
  10882. @item c2_flags, c2f
  10883. @item c3_flags, c3f
  10884. Set pixel component flags or set flags for all components if @var{all_flags}.
  10885. Available values for component flags are:
  10886. @table @samp
  10887. @item a
  10888. averaged temporal noise (smoother)
  10889. @item p
  10890. mix random noise with a (semi)regular pattern
  10891. @item t
  10892. temporal noise (noise pattern changes between frames)
  10893. @item u
  10894. uniform noise (gaussian otherwise)
  10895. @end table
  10896. @end table
  10897. @subsection Examples
  10898. Add temporal and uniform noise to input video:
  10899. @example
  10900. noise=alls=20:allf=t+u
  10901. @end example
  10902. @section normalize
  10903. Normalize RGB video (aka histogram stretching, contrast stretching).
  10904. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10905. For each channel of each frame, the filter computes the input range and maps
  10906. it linearly to the user-specified output range. The output range defaults
  10907. to the full dynamic range from pure black to pure white.
  10908. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10909. changes in brightness) caused when small dark or bright objects enter or leave
  10910. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10911. video camera, and, like a video camera, it may cause a period of over- or
  10912. under-exposure of the video.
  10913. The R,G,B channels can be normalized independently, which may cause some
  10914. color shifting, or linked together as a single channel, which prevents
  10915. color shifting. Linked normalization preserves hue. Independent normalization
  10916. does not, so it can be used to remove some color casts. Independent and linked
  10917. normalization can be combined in any ratio.
  10918. The normalize filter accepts the following options:
  10919. @table @option
  10920. @item blackpt
  10921. @item whitept
  10922. Colors which define the output range. The minimum input value is mapped to
  10923. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10924. The defaults are black and white respectively. Specifying white for
  10925. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10926. normalized video. Shades of grey can be used to reduce the dynamic range
  10927. (contrast). Specifying saturated colors here can create some interesting
  10928. effects.
  10929. @item smoothing
  10930. The number of previous frames to use for temporal smoothing. The input range
  10931. of each channel is smoothed using a rolling average over the current frame
  10932. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10933. smoothing).
  10934. @item independence
  10935. Controls the ratio of independent (color shifting) channel normalization to
  10936. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10937. independent. Defaults to 1.0 (fully independent).
  10938. @item strength
  10939. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10940. expensive no-op. Defaults to 1.0 (full strength).
  10941. @end table
  10942. @subsection Commands
  10943. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10944. The command accepts the same syntax of the corresponding option.
  10945. If the specified expression is not valid, it is kept at its current
  10946. value.
  10947. @subsection Examples
  10948. Stretch video contrast to use the full dynamic range, with no temporal
  10949. smoothing; may flicker depending on the source content:
  10950. @example
  10951. normalize=blackpt=black:whitept=white:smoothing=0
  10952. @end example
  10953. As above, but with 50 frames of temporal smoothing; flicker should be
  10954. reduced, depending on the source content:
  10955. @example
  10956. normalize=blackpt=black:whitept=white:smoothing=50
  10957. @end example
  10958. As above, but with hue-preserving linked channel normalization:
  10959. @example
  10960. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10961. @end example
  10962. As above, but with half strength:
  10963. @example
  10964. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10965. @end example
  10966. Map the darkest input color to red, the brightest input color to cyan:
  10967. @example
  10968. normalize=blackpt=red:whitept=cyan
  10969. @end example
  10970. @section null
  10971. Pass the video source unchanged to the output.
  10972. @section ocr
  10973. Optical Character Recognition
  10974. This filter uses Tesseract for optical character recognition. To enable
  10975. compilation of this filter, you need to configure FFmpeg with
  10976. @code{--enable-libtesseract}.
  10977. It accepts the following options:
  10978. @table @option
  10979. @item datapath
  10980. Set datapath to tesseract data. Default is to use whatever was
  10981. set at installation.
  10982. @item language
  10983. Set language, default is "eng".
  10984. @item whitelist
  10985. Set character whitelist.
  10986. @item blacklist
  10987. Set character blacklist.
  10988. @end table
  10989. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10990. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10991. @section ocv
  10992. Apply a video transform using libopencv.
  10993. To enable this filter, install the libopencv library and headers and
  10994. configure FFmpeg with @code{--enable-libopencv}.
  10995. It accepts the following parameters:
  10996. @table @option
  10997. @item filter_name
  10998. The name of the libopencv filter to apply.
  10999. @item filter_params
  11000. The parameters to pass to the libopencv filter. If not specified, the default
  11001. values are assumed.
  11002. @end table
  11003. Refer to the official libopencv documentation for more precise
  11004. information:
  11005. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  11006. Several libopencv filters are supported; see the following subsections.
  11007. @anchor{dilate}
  11008. @subsection dilate
  11009. Dilate an image by using a specific structuring element.
  11010. It corresponds to the libopencv function @code{cvDilate}.
  11011. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  11012. @var{struct_el} represents a structuring element, and has the syntax:
  11013. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  11014. @var{cols} and @var{rows} represent the number of columns and rows of
  11015. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  11016. point, and @var{shape} the shape for the structuring element. @var{shape}
  11017. must be "rect", "cross", "ellipse", or "custom".
  11018. If the value for @var{shape} is "custom", it must be followed by a
  11019. string of the form "=@var{filename}". The file with name
  11020. @var{filename} is assumed to represent a binary image, with each
  11021. printable character corresponding to a bright pixel. When a custom
  11022. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  11023. or columns and rows of the read file are assumed instead.
  11024. The default value for @var{struct_el} is "3x3+0x0/rect".
  11025. @var{nb_iterations} specifies the number of times the transform is
  11026. applied to the image, and defaults to 1.
  11027. Some examples:
  11028. @example
  11029. # Use the default values
  11030. ocv=dilate
  11031. # Dilate using a structuring element with a 5x5 cross, iterating two times
  11032. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  11033. # Read the shape from the file diamond.shape, iterating two times.
  11034. # The file diamond.shape may contain a pattern of characters like this
  11035. # *
  11036. # ***
  11037. # *****
  11038. # ***
  11039. # *
  11040. # The specified columns and rows are ignored
  11041. # but the anchor point coordinates are not
  11042. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  11043. @end example
  11044. @subsection erode
  11045. Erode an image by using a specific structuring element.
  11046. It corresponds to the libopencv function @code{cvErode}.
  11047. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  11048. with the same syntax and semantics as the @ref{dilate} filter.
  11049. @subsection smooth
  11050. Smooth the input video.
  11051. The filter takes the following parameters:
  11052. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  11053. @var{type} is the type of smooth filter to apply, and must be one of
  11054. the following values: "blur", "blur_no_scale", "median", "gaussian",
  11055. or "bilateral". The default value is "gaussian".
  11056. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  11057. depends on the smooth type. @var{param1} and
  11058. @var{param2} accept integer positive values or 0. @var{param3} and
  11059. @var{param4} accept floating point values.
  11060. The default value for @var{param1} is 3. The default value for the
  11061. other parameters is 0.
  11062. These parameters correspond to the parameters assigned to the
  11063. libopencv function @code{cvSmooth}.
  11064. @section oscilloscope
  11065. 2D Video Oscilloscope.
  11066. Useful to measure spatial impulse, step responses, chroma delays, etc.
  11067. It accepts the following parameters:
  11068. @table @option
  11069. @item x
  11070. Set scope center x position.
  11071. @item y
  11072. Set scope center y position.
  11073. @item s
  11074. Set scope size, relative to frame diagonal.
  11075. @item t
  11076. Set scope tilt/rotation.
  11077. @item o
  11078. Set trace opacity.
  11079. @item tx
  11080. Set trace center x position.
  11081. @item ty
  11082. Set trace center y position.
  11083. @item tw
  11084. Set trace width, relative to width of frame.
  11085. @item th
  11086. Set trace height, relative to height of frame.
  11087. @item c
  11088. Set which components to trace. By default it traces first three components.
  11089. @item g
  11090. Draw trace grid. By default is enabled.
  11091. @item st
  11092. Draw some statistics. By default is enabled.
  11093. @item sc
  11094. Draw scope. By default is enabled.
  11095. @end table
  11096. @subsection Commands
  11097. This filter supports same @ref{commands} as options.
  11098. The command accepts the same syntax of the corresponding option.
  11099. If the specified expression is not valid, it is kept at its current
  11100. value.
  11101. @subsection Examples
  11102. @itemize
  11103. @item
  11104. Inspect full first row of video frame.
  11105. @example
  11106. oscilloscope=x=0.5:y=0:s=1
  11107. @end example
  11108. @item
  11109. Inspect full last row of video frame.
  11110. @example
  11111. oscilloscope=x=0.5:y=1:s=1
  11112. @end example
  11113. @item
  11114. Inspect full 5th line of video frame of height 1080.
  11115. @example
  11116. oscilloscope=x=0.5:y=5/1080:s=1
  11117. @end example
  11118. @item
  11119. Inspect full last column of video frame.
  11120. @example
  11121. oscilloscope=x=1:y=0.5:s=1:t=1
  11122. @end example
  11123. @end itemize
  11124. @anchor{overlay}
  11125. @section overlay
  11126. Overlay one video on top of another.
  11127. It takes two inputs and has one output. The first input is the "main"
  11128. video on which the second input is overlaid.
  11129. It accepts the following parameters:
  11130. A description of the accepted options follows.
  11131. @table @option
  11132. @item x
  11133. @item y
  11134. Set the expression for the x and y coordinates of the overlaid video
  11135. on the main video. Default value is "0" for both expressions. In case
  11136. the expression is invalid, it is set to a huge value (meaning that the
  11137. overlay will not be displayed within the output visible area).
  11138. @item eof_action
  11139. See @ref{framesync}.
  11140. @item eval
  11141. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11142. It accepts the following values:
  11143. @table @samp
  11144. @item init
  11145. only evaluate expressions once during the filter initialization or
  11146. when a command is processed
  11147. @item frame
  11148. evaluate expressions for each incoming frame
  11149. @end table
  11150. Default value is @samp{frame}.
  11151. @item shortest
  11152. See @ref{framesync}.
  11153. @item format
  11154. Set the format for the output video.
  11155. It accepts the following values:
  11156. @table @samp
  11157. @item yuv420
  11158. force YUV420 output
  11159. @item yuv420p10
  11160. force YUV420p10 output
  11161. @item yuv422
  11162. force YUV422 output
  11163. @item yuv422p10
  11164. force YUV422p10 output
  11165. @item yuv444
  11166. force YUV444 output
  11167. @item rgb
  11168. force packed RGB output
  11169. @item gbrp
  11170. force planar RGB output
  11171. @item auto
  11172. automatically pick format
  11173. @end table
  11174. Default value is @samp{yuv420}.
  11175. @item repeatlast
  11176. See @ref{framesync}.
  11177. @item alpha
  11178. Set format of alpha of the overlaid video, it can be @var{straight} or
  11179. @var{premultiplied}. Default is @var{straight}.
  11180. @end table
  11181. The @option{x}, and @option{y} expressions can contain the following
  11182. parameters.
  11183. @table @option
  11184. @item main_w, W
  11185. @item main_h, H
  11186. The main input width and height.
  11187. @item overlay_w, w
  11188. @item overlay_h, h
  11189. The overlay input width and height.
  11190. @item x
  11191. @item y
  11192. The computed values for @var{x} and @var{y}. They are evaluated for
  11193. each new frame.
  11194. @item hsub
  11195. @item vsub
  11196. horizontal and vertical chroma subsample values of the output
  11197. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11198. @var{vsub} is 1.
  11199. @item n
  11200. the number of input frame, starting from 0
  11201. @item pos
  11202. the position in the file of the input frame, NAN if unknown
  11203. @item t
  11204. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11205. @end table
  11206. This filter also supports the @ref{framesync} options.
  11207. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11208. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11209. when @option{eval} is set to @samp{init}.
  11210. Be aware that frames are taken from each input video in timestamp
  11211. order, hence, if their initial timestamps differ, it is a good idea
  11212. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11213. have them begin in the same zero timestamp, as the example for
  11214. the @var{movie} filter does.
  11215. You can chain together more overlays but you should test the
  11216. efficiency of such approach.
  11217. @subsection Commands
  11218. This filter supports the following commands:
  11219. @table @option
  11220. @item x
  11221. @item y
  11222. Modify the x and y of the overlay input.
  11223. The command accepts the same syntax of the corresponding option.
  11224. If the specified expression is not valid, it is kept at its current
  11225. value.
  11226. @end table
  11227. @subsection Examples
  11228. @itemize
  11229. @item
  11230. Draw the overlay at 10 pixels from the bottom right corner of the main
  11231. video:
  11232. @example
  11233. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11234. @end example
  11235. Using named options the example above becomes:
  11236. @example
  11237. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11238. @end example
  11239. @item
  11240. Insert a transparent PNG logo in the bottom left corner of the input,
  11241. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11242. @example
  11243. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11244. @end example
  11245. @item
  11246. Insert 2 different transparent PNG logos (second logo on bottom
  11247. right corner) using the @command{ffmpeg} tool:
  11248. @example
  11249. 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
  11250. @end example
  11251. @item
  11252. Add a transparent color layer on top of the main video; @code{WxH}
  11253. must specify the size of the main input to the overlay filter:
  11254. @example
  11255. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11256. @end example
  11257. @item
  11258. Play an original video and a filtered version (here with the deshake
  11259. filter) side by side using the @command{ffplay} tool:
  11260. @example
  11261. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11262. @end example
  11263. The above command is the same as:
  11264. @example
  11265. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11266. @end example
  11267. @item
  11268. Make a sliding overlay appearing from the left to the right top part of the
  11269. screen starting since time 2:
  11270. @example
  11271. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11272. @end example
  11273. @item
  11274. Compose output by putting two input videos side to side:
  11275. @example
  11276. ffmpeg -i left.avi -i right.avi -filter_complex "
  11277. nullsrc=size=200x100 [background];
  11278. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11279. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11280. [background][left] overlay=shortest=1 [background+left];
  11281. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11282. "
  11283. @end example
  11284. @item
  11285. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11286. @example
  11287. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11288. -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]'
  11289. masked.avi
  11290. @end example
  11291. @item
  11292. Chain several overlays in cascade:
  11293. @example
  11294. nullsrc=s=200x200 [bg];
  11295. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11296. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11297. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11298. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11299. [in3] null, [mid2] overlay=100:100 [out0]
  11300. @end example
  11301. @end itemize
  11302. @anchor{overlay_cuda}
  11303. @section overlay_cuda
  11304. Overlay one video on top of another.
  11305. This is the CUDA cariant of the @ref{overlay} filter.
  11306. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11307. It takes two inputs and has one output. The first input is the "main"
  11308. video on which the second input is overlaid.
  11309. It accepts the following parameters:
  11310. @table @option
  11311. @item x
  11312. @item y
  11313. Set the x and y coordinates of the overlaid video on the main video.
  11314. Default value is "0" for both expressions.
  11315. @item eof_action
  11316. See @ref{framesync}.
  11317. @item shortest
  11318. See @ref{framesync}.
  11319. @item repeatlast
  11320. See @ref{framesync}.
  11321. @end table
  11322. This filter also supports the @ref{framesync} options.
  11323. @section owdenoise
  11324. Apply Overcomplete Wavelet denoiser.
  11325. The filter accepts the following options:
  11326. @table @option
  11327. @item depth
  11328. Set depth.
  11329. Larger depth values will denoise lower frequency components more, but
  11330. slow down filtering.
  11331. Must be an int in the range 8-16, default is @code{8}.
  11332. @item luma_strength, ls
  11333. Set luma strength.
  11334. Must be a double value in the range 0-1000, default is @code{1.0}.
  11335. @item chroma_strength, cs
  11336. Set chroma strength.
  11337. Must be a double value in the range 0-1000, default is @code{1.0}.
  11338. @end table
  11339. @anchor{pad}
  11340. @section pad
  11341. Add paddings to the input image, and place the original input at the
  11342. provided @var{x}, @var{y} coordinates.
  11343. It accepts the following parameters:
  11344. @table @option
  11345. @item width, w
  11346. @item height, h
  11347. Specify an expression for the size of the output image with the
  11348. paddings added. If the value for @var{width} or @var{height} is 0, the
  11349. corresponding input size is used for the output.
  11350. The @var{width} expression can reference the value set by the
  11351. @var{height} expression, and vice versa.
  11352. The default value of @var{width} and @var{height} is 0.
  11353. @item x
  11354. @item y
  11355. Specify the offsets to place the input image at within the padded area,
  11356. with respect to the top/left border of the output image.
  11357. The @var{x} expression can reference the value set by the @var{y}
  11358. expression, and vice versa.
  11359. The default value of @var{x} and @var{y} is 0.
  11360. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11361. so the input image is centered on the padded area.
  11362. @item color
  11363. Specify the color of the padded area. For the syntax of this option,
  11364. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11365. manual,ffmpeg-utils}.
  11366. The default value of @var{color} is "black".
  11367. @item eval
  11368. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11369. It accepts the following values:
  11370. @table @samp
  11371. @item init
  11372. Only evaluate expressions once during the filter initialization or when
  11373. a command is processed.
  11374. @item frame
  11375. Evaluate expressions for each incoming frame.
  11376. @end table
  11377. Default value is @samp{init}.
  11378. @item aspect
  11379. Pad to aspect instead to a resolution.
  11380. @end table
  11381. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11382. options are expressions containing the following constants:
  11383. @table @option
  11384. @item in_w
  11385. @item in_h
  11386. The input video width and height.
  11387. @item iw
  11388. @item ih
  11389. These are the same as @var{in_w} and @var{in_h}.
  11390. @item out_w
  11391. @item out_h
  11392. The output width and height (the size of the padded area), as
  11393. specified by the @var{width} and @var{height} expressions.
  11394. @item ow
  11395. @item oh
  11396. These are the same as @var{out_w} and @var{out_h}.
  11397. @item x
  11398. @item y
  11399. The x and y offsets as specified by the @var{x} and @var{y}
  11400. expressions, or NAN if not yet specified.
  11401. @item a
  11402. same as @var{iw} / @var{ih}
  11403. @item sar
  11404. input sample aspect ratio
  11405. @item dar
  11406. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11407. @item hsub
  11408. @item vsub
  11409. The horizontal and vertical chroma subsample values. For example for the
  11410. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11411. @end table
  11412. @subsection Examples
  11413. @itemize
  11414. @item
  11415. Add paddings with the color "violet" to the input video. The output video
  11416. size is 640x480, and the top-left corner of the input video is placed at
  11417. column 0, row 40
  11418. @example
  11419. pad=640:480:0:40:violet
  11420. @end example
  11421. The example above is equivalent to the following command:
  11422. @example
  11423. pad=width=640:height=480:x=0:y=40:color=violet
  11424. @end example
  11425. @item
  11426. Pad the input to get an output with dimensions increased by 3/2,
  11427. and put the input video at the center of the padded area:
  11428. @example
  11429. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11430. @end example
  11431. @item
  11432. Pad the input to get a squared output with size equal to the maximum
  11433. value between the input width and height, and put the input video at
  11434. the center of the padded area:
  11435. @example
  11436. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11437. @end example
  11438. @item
  11439. Pad the input to get a final w/h ratio of 16:9:
  11440. @example
  11441. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11442. @end example
  11443. @item
  11444. In case of anamorphic video, in order to set the output display aspect
  11445. correctly, it is necessary to use @var{sar} in the expression,
  11446. according to the relation:
  11447. @example
  11448. (ih * X / ih) * sar = output_dar
  11449. X = output_dar / sar
  11450. @end example
  11451. Thus the previous example needs to be modified to:
  11452. @example
  11453. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11454. @end example
  11455. @item
  11456. Double the output size and put the input video in the bottom-right
  11457. corner of the output padded area:
  11458. @example
  11459. pad="2*iw:2*ih:ow-iw:oh-ih"
  11460. @end example
  11461. @end itemize
  11462. @anchor{palettegen}
  11463. @section palettegen
  11464. Generate one palette for a whole video stream.
  11465. It accepts the following options:
  11466. @table @option
  11467. @item max_colors
  11468. Set the maximum number of colors to quantize in the palette.
  11469. Note: the palette will still contain 256 colors; the unused palette entries
  11470. will be black.
  11471. @item reserve_transparent
  11472. Create a palette of 255 colors maximum and reserve the last one for
  11473. transparency. Reserving the transparency color is useful for GIF optimization.
  11474. If not set, the maximum of colors in the palette will be 256. You probably want
  11475. to disable this option for a standalone image.
  11476. Set by default.
  11477. @item transparency_color
  11478. Set the color that will be used as background for transparency.
  11479. @item stats_mode
  11480. Set statistics mode.
  11481. It accepts the following values:
  11482. @table @samp
  11483. @item full
  11484. Compute full frame histograms.
  11485. @item diff
  11486. Compute histograms only for the part that differs from previous frame. This
  11487. might be relevant to give more importance to the moving part of your input if
  11488. the background is static.
  11489. @item single
  11490. Compute new histogram for each frame.
  11491. @end table
  11492. Default value is @var{full}.
  11493. @end table
  11494. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11495. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11496. color quantization of the palette. This information is also visible at
  11497. @var{info} logging level.
  11498. @subsection Examples
  11499. @itemize
  11500. @item
  11501. Generate a representative palette of a given video using @command{ffmpeg}:
  11502. @example
  11503. ffmpeg -i input.mkv -vf palettegen palette.png
  11504. @end example
  11505. @end itemize
  11506. @section paletteuse
  11507. Use a palette to downsample an input video stream.
  11508. The filter takes two inputs: one video stream and a palette. The palette must
  11509. be a 256 pixels image.
  11510. It accepts the following options:
  11511. @table @option
  11512. @item dither
  11513. Select dithering mode. Available algorithms are:
  11514. @table @samp
  11515. @item bayer
  11516. Ordered 8x8 bayer dithering (deterministic)
  11517. @item heckbert
  11518. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11519. Note: this dithering is sometimes considered "wrong" and is included as a
  11520. reference.
  11521. @item floyd_steinberg
  11522. Floyd and Steingberg dithering (error diffusion)
  11523. @item sierra2
  11524. Frankie Sierra dithering v2 (error diffusion)
  11525. @item sierra2_4a
  11526. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11527. @end table
  11528. Default is @var{sierra2_4a}.
  11529. @item bayer_scale
  11530. When @var{bayer} dithering is selected, this option defines the scale of the
  11531. pattern (how much the crosshatch pattern is visible). A low value means more
  11532. visible pattern for less banding, and higher value means less visible pattern
  11533. at the cost of more banding.
  11534. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11535. @item diff_mode
  11536. If set, define the zone to process
  11537. @table @samp
  11538. @item rectangle
  11539. Only the changing rectangle will be reprocessed. This is similar to GIF
  11540. cropping/offsetting compression mechanism. This option can be useful for speed
  11541. if only a part of the image is changing, and has use cases such as limiting the
  11542. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11543. moving scene (it leads to more deterministic output if the scene doesn't change
  11544. much, and as a result less moving noise and better GIF compression).
  11545. @end table
  11546. Default is @var{none}.
  11547. @item new
  11548. Take new palette for each output frame.
  11549. @item alpha_threshold
  11550. Sets the alpha threshold for transparency. Alpha values above this threshold
  11551. will be treated as completely opaque, and values below this threshold will be
  11552. treated as completely transparent.
  11553. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11554. @end table
  11555. @subsection Examples
  11556. @itemize
  11557. @item
  11558. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11559. using @command{ffmpeg}:
  11560. @example
  11561. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11562. @end example
  11563. @end itemize
  11564. @section perspective
  11565. Correct perspective of video not recorded perpendicular to the screen.
  11566. A description of the accepted parameters follows.
  11567. @table @option
  11568. @item x0
  11569. @item y0
  11570. @item x1
  11571. @item y1
  11572. @item x2
  11573. @item y2
  11574. @item x3
  11575. @item y3
  11576. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11577. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11578. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11579. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11580. then the corners of the source will be sent to the specified coordinates.
  11581. The expressions can use the following variables:
  11582. @table @option
  11583. @item W
  11584. @item H
  11585. the width and height of video frame.
  11586. @item in
  11587. Input frame count.
  11588. @item on
  11589. Output frame count.
  11590. @end table
  11591. @item interpolation
  11592. Set interpolation for perspective correction.
  11593. It accepts the following values:
  11594. @table @samp
  11595. @item linear
  11596. @item cubic
  11597. @end table
  11598. Default value is @samp{linear}.
  11599. @item sense
  11600. Set interpretation of coordinate options.
  11601. It accepts the following values:
  11602. @table @samp
  11603. @item 0, source
  11604. Send point in the source specified by the given coordinates to
  11605. the corners of the destination.
  11606. @item 1, destination
  11607. Send the corners of the source to the point in the destination specified
  11608. by the given coordinates.
  11609. Default value is @samp{source}.
  11610. @end table
  11611. @item eval
  11612. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11613. It accepts the following values:
  11614. @table @samp
  11615. @item init
  11616. only evaluate expressions once during the filter initialization or
  11617. when a command is processed
  11618. @item frame
  11619. evaluate expressions for each incoming frame
  11620. @end table
  11621. Default value is @samp{init}.
  11622. @end table
  11623. @section phase
  11624. Delay interlaced video by one field time so that the field order changes.
  11625. The intended use is to fix PAL movies that have been captured with the
  11626. opposite field order to the film-to-video transfer.
  11627. A description of the accepted parameters follows.
  11628. @table @option
  11629. @item mode
  11630. Set phase mode.
  11631. It accepts the following values:
  11632. @table @samp
  11633. @item t
  11634. Capture field order top-first, transfer bottom-first.
  11635. Filter will delay the bottom field.
  11636. @item b
  11637. Capture field order bottom-first, transfer top-first.
  11638. Filter will delay the top field.
  11639. @item p
  11640. Capture and transfer with the same field order. This mode only exists
  11641. for the documentation of the other options to refer to, but if you
  11642. actually select it, the filter will faithfully do nothing.
  11643. @item a
  11644. Capture field order determined automatically by field flags, transfer
  11645. opposite.
  11646. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11647. basis using field flags. If no field information is available,
  11648. then this works just like @samp{u}.
  11649. @item u
  11650. Capture unknown or varying, transfer opposite.
  11651. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11652. analyzing the images and selecting the alternative that produces best
  11653. match between the fields.
  11654. @item T
  11655. Capture top-first, transfer unknown or varying.
  11656. Filter selects among @samp{t} and @samp{p} using image analysis.
  11657. @item B
  11658. Capture bottom-first, transfer unknown or varying.
  11659. Filter selects among @samp{b} and @samp{p} using image analysis.
  11660. @item A
  11661. Capture determined by field flags, transfer unknown or varying.
  11662. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11663. image analysis. If no field information is available, then this works just
  11664. like @samp{U}. This is the default mode.
  11665. @item U
  11666. Both capture and transfer unknown or varying.
  11667. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11668. @end table
  11669. @end table
  11670. @section photosensitivity
  11671. Reduce various flashes in video, so to help users with epilepsy.
  11672. It accepts the following options:
  11673. @table @option
  11674. @item frames, f
  11675. Set how many frames to use when filtering. Default is 30.
  11676. @item threshold, t
  11677. Set detection threshold factor. Default is 1.
  11678. Lower is stricter.
  11679. @item skip
  11680. Set how many pixels to skip when sampling frames. Default is 1.
  11681. Allowed range is from 1 to 1024.
  11682. @item bypass
  11683. Leave frames unchanged. Default is disabled.
  11684. @end table
  11685. @section pixdesctest
  11686. Pixel format descriptor test filter, mainly useful for internal
  11687. testing. The output video should be equal to the input video.
  11688. For example:
  11689. @example
  11690. format=monow, pixdesctest
  11691. @end example
  11692. can be used to test the monowhite pixel format descriptor definition.
  11693. @section pixscope
  11694. Display sample values of color channels. Mainly useful for checking color
  11695. and levels. Minimum supported resolution is 640x480.
  11696. The filters accept the following options:
  11697. @table @option
  11698. @item x
  11699. Set scope X position, relative offset on X axis.
  11700. @item y
  11701. Set scope Y position, relative offset on Y axis.
  11702. @item w
  11703. Set scope width.
  11704. @item h
  11705. Set scope height.
  11706. @item o
  11707. Set window opacity. This window also holds statistics about pixel area.
  11708. @item wx
  11709. Set window X position, relative offset on X axis.
  11710. @item wy
  11711. Set window Y position, relative offset on Y axis.
  11712. @end table
  11713. @section pp
  11714. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11715. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11716. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11717. Each subfilter and some options have a short and a long name that can be used
  11718. interchangeably, i.e. dr/dering are the same.
  11719. The filters accept the following options:
  11720. @table @option
  11721. @item subfilters
  11722. Set postprocessing subfilters string.
  11723. @end table
  11724. All subfilters share common options to determine their scope:
  11725. @table @option
  11726. @item a/autoq
  11727. Honor the quality commands for this subfilter.
  11728. @item c/chrom
  11729. Do chrominance filtering, too (default).
  11730. @item y/nochrom
  11731. Do luminance filtering only (no chrominance).
  11732. @item n/noluma
  11733. Do chrominance filtering only (no luminance).
  11734. @end table
  11735. These options can be appended after the subfilter name, separated by a '|'.
  11736. Available subfilters are:
  11737. @table @option
  11738. @item hb/hdeblock[|difference[|flatness]]
  11739. Horizontal deblocking filter
  11740. @table @option
  11741. @item difference
  11742. Difference factor where higher values mean more deblocking (default: @code{32}).
  11743. @item flatness
  11744. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11745. @end table
  11746. @item vb/vdeblock[|difference[|flatness]]
  11747. Vertical deblocking filter
  11748. @table @option
  11749. @item difference
  11750. Difference factor where higher values mean more deblocking (default: @code{32}).
  11751. @item flatness
  11752. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11753. @end table
  11754. @item ha/hadeblock[|difference[|flatness]]
  11755. Accurate horizontal deblocking filter
  11756. @table @option
  11757. @item difference
  11758. Difference factor where higher values mean more deblocking (default: @code{32}).
  11759. @item flatness
  11760. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11761. @end table
  11762. @item va/vadeblock[|difference[|flatness]]
  11763. Accurate vertical deblocking filter
  11764. @table @option
  11765. @item difference
  11766. Difference factor where higher values mean more deblocking (default: @code{32}).
  11767. @item flatness
  11768. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11769. @end table
  11770. @end table
  11771. The horizontal and vertical deblocking filters share the difference and
  11772. flatness values so you cannot set different horizontal and vertical
  11773. thresholds.
  11774. @table @option
  11775. @item h1/x1hdeblock
  11776. Experimental horizontal deblocking filter
  11777. @item v1/x1vdeblock
  11778. Experimental vertical deblocking filter
  11779. @item dr/dering
  11780. Deringing filter
  11781. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11782. @table @option
  11783. @item threshold1
  11784. larger -> stronger filtering
  11785. @item threshold2
  11786. larger -> stronger filtering
  11787. @item threshold3
  11788. larger -> stronger filtering
  11789. @end table
  11790. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11791. @table @option
  11792. @item f/fullyrange
  11793. Stretch luminance to @code{0-255}.
  11794. @end table
  11795. @item lb/linblenddeint
  11796. Linear blend deinterlacing filter that deinterlaces the given block by
  11797. filtering all lines with a @code{(1 2 1)} filter.
  11798. @item li/linipoldeint
  11799. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11800. linearly interpolating every second line.
  11801. @item ci/cubicipoldeint
  11802. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11803. cubically interpolating every second line.
  11804. @item md/mediandeint
  11805. Median deinterlacing filter that deinterlaces the given block by applying a
  11806. median filter to every second line.
  11807. @item fd/ffmpegdeint
  11808. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11809. second line with a @code{(-1 4 2 4 -1)} filter.
  11810. @item l5/lowpass5
  11811. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11812. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11813. @item fq/forceQuant[|quantizer]
  11814. Overrides the quantizer table from the input with the constant quantizer you
  11815. specify.
  11816. @table @option
  11817. @item quantizer
  11818. Quantizer to use
  11819. @end table
  11820. @item de/default
  11821. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11822. @item fa/fast
  11823. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11824. @item ac
  11825. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11826. @end table
  11827. @subsection Examples
  11828. @itemize
  11829. @item
  11830. Apply horizontal and vertical deblocking, deringing and automatic
  11831. brightness/contrast:
  11832. @example
  11833. pp=hb/vb/dr/al
  11834. @end example
  11835. @item
  11836. Apply default filters without brightness/contrast correction:
  11837. @example
  11838. pp=de/-al
  11839. @end example
  11840. @item
  11841. Apply default filters and temporal denoiser:
  11842. @example
  11843. pp=default/tmpnoise|1|2|3
  11844. @end example
  11845. @item
  11846. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11847. automatically depending on available CPU time:
  11848. @example
  11849. pp=hb|y/vb|a
  11850. @end example
  11851. @end itemize
  11852. @section pp7
  11853. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11854. similar to spp = 6 with 7 point DCT, where only the center sample is
  11855. used after IDCT.
  11856. The filter accepts the following options:
  11857. @table @option
  11858. @item qp
  11859. Force a constant quantization parameter. It accepts an integer in range
  11860. 0 to 63. If not set, the filter will use the QP from the video stream
  11861. (if available).
  11862. @item mode
  11863. Set thresholding mode. Available modes are:
  11864. @table @samp
  11865. @item hard
  11866. Set hard thresholding.
  11867. @item soft
  11868. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11869. @item medium
  11870. Set medium thresholding (good results, default).
  11871. @end table
  11872. @end table
  11873. @section premultiply
  11874. Apply alpha premultiply effect to input video stream using first plane
  11875. of second stream as alpha.
  11876. Both streams must have same dimensions and same pixel format.
  11877. The filter accepts the following option:
  11878. @table @option
  11879. @item planes
  11880. Set which planes will be processed, unprocessed planes will be copied.
  11881. By default value 0xf, all planes will be processed.
  11882. @item inplace
  11883. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11884. @end table
  11885. @section prewitt
  11886. Apply prewitt operator to input video stream.
  11887. The filter accepts the following option:
  11888. @table @option
  11889. @item planes
  11890. Set which planes will be processed, unprocessed planes will be copied.
  11891. By default value 0xf, all planes will be processed.
  11892. @item scale
  11893. Set value which will be multiplied with filtered result.
  11894. @item delta
  11895. Set value which will be added to filtered result.
  11896. @end table
  11897. @section pseudocolor
  11898. Alter frame colors in video with pseudocolors.
  11899. This filter accepts the following options:
  11900. @table @option
  11901. @item c0
  11902. set pixel first component expression
  11903. @item c1
  11904. set pixel second component expression
  11905. @item c2
  11906. set pixel third component expression
  11907. @item c3
  11908. set pixel fourth component expression, corresponds to the alpha component
  11909. @item i
  11910. set component to use as base for altering colors
  11911. @end table
  11912. Each of them specifies the expression to use for computing the lookup table for
  11913. the corresponding pixel component values.
  11914. The expressions can contain the following constants and functions:
  11915. @table @option
  11916. @item w
  11917. @item h
  11918. The input width and height.
  11919. @item val
  11920. The input value for the pixel component.
  11921. @item ymin, umin, vmin, amin
  11922. The minimum allowed component value.
  11923. @item ymax, umax, vmax, amax
  11924. The maximum allowed component value.
  11925. @end table
  11926. All expressions default to "val".
  11927. @subsection Examples
  11928. @itemize
  11929. @item
  11930. Change too high luma values to gradient:
  11931. @example
  11932. 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'"
  11933. @end example
  11934. @end itemize
  11935. @section psnr
  11936. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11937. Ratio) between two input videos.
  11938. This filter takes in input two input videos, the first input is
  11939. considered the "main" source and is passed unchanged to the
  11940. output. The second input is used as a "reference" video for computing
  11941. the PSNR.
  11942. Both video inputs must have the same resolution and pixel format for
  11943. this filter to work correctly. Also it assumes that both inputs
  11944. have the same number of frames, which are compared one by one.
  11945. The obtained average PSNR is printed through the logging system.
  11946. The filter stores the accumulated MSE (mean squared error) of each
  11947. frame, and at the end of the processing it is averaged across all frames
  11948. equally, and the following formula is applied to obtain the PSNR:
  11949. @example
  11950. PSNR = 10*log10(MAX^2/MSE)
  11951. @end example
  11952. Where MAX is the average of the maximum values of each component of the
  11953. image.
  11954. The description of the accepted parameters follows.
  11955. @table @option
  11956. @item stats_file, f
  11957. If specified the filter will use the named file to save the PSNR of
  11958. each individual frame. When filename equals "-" the data is sent to
  11959. standard output.
  11960. @item stats_version
  11961. Specifies which version of the stats file format to use. Details of
  11962. each format are written below.
  11963. Default value is 1.
  11964. @item stats_add_max
  11965. Determines whether the max value is output to the stats log.
  11966. Default value is 0.
  11967. Requires stats_version >= 2. If this is set and stats_version < 2,
  11968. the filter will return an error.
  11969. @end table
  11970. This filter also supports the @ref{framesync} options.
  11971. The file printed if @var{stats_file} is selected, contains a sequence of
  11972. key/value pairs of the form @var{key}:@var{value} for each compared
  11973. couple of frames.
  11974. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11975. the list of per-frame-pair stats, with key value pairs following the frame
  11976. format with the following parameters:
  11977. @table @option
  11978. @item psnr_log_version
  11979. The version of the log file format. Will match @var{stats_version}.
  11980. @item fields
  11981. A comma separated list of the per-frame-pair parameters included in
  11982. the log.
  11983. @end table
  11984. A description of each shown per-frame-pair parameter follows:
  11985. @table @option
  11986. @item n
  11987. sequential number of the input frame, starting from 1
  11988. @item mse_avg
  11989. Mean Square Error pixel-by-pixel average difference of the compared
  11990. frames, averaged over all the image components.
  11991. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11992. Mean Square Error pixel-by-pixel average difference of the compared
  11993. frames for the component specified by the suffix.
  11994. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11995. Peak Signal to Noise ratio of the compared frames for the component
  11996. specified by the suffix.
  11997. @item max_avg, max_y, max_u, max_v
  11998. Maximum allowed value for each channel, and average over all
  11999. channels.
  12000. @end table
  12001. @subsection Examples
  12002. @itemize
  12003. @item
  12004. For example:
  12005. @example
  12006. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12007. [main][ref] psnr="stats_file=stats.log" [out]
  12008. @end example
  12009. On this example the input file being processed is compared with the
  12010. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  12011. is stored in @file{stats.log}.
  12012. @item
  12013. Another example with different containers:
  12014. @example
  12015. 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 -
  12016. @end example
  12017. @end itemize
  12018. @anchor{pullup}
  12019. @section pullup
  12020. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  12021. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  12022. content.
  12023. The pullup filter is designed to take advantage of future context in making
  12024. its decisions. This filter is stateless in the sense that it does not lock
  12025. onto a pattern to follow, but it instead looks forward to the following
  12026. fields in order to identify matches and rebuild progressive frames.
  12027. To produce content with an even framerate, insert the fps filter after
  12028. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  12029. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  12030. The filter accepts the following options:
  12031. @table @option
  12032. @item jl
  12033. @item jr
  12034. @item jt
  12035. @item jb
  12036. These options set the amount of "junk" to ignore at the left, right, top, and
  12037. bottom of the image, respectively. Left and right are in units of 8 pixels,
  12038. while top and bottom are in units of 2 lines.
  12039. The default is 8 pixels on each side.
  12040. @item sb
  12041. Set the strict breaks. Setting this option to 1 will reduce the chances of
  12042. filter generating an occasional mismatched frame, but it may also cause an
  12043. excessive number of frames to be dropped during high motion sequences.
  12044. Conversely, setting it to -1 will make filter match fields more easily.
  12045. This may help processing of video where there is slight blurring between
  12046. the fields, but may also cause there to be interlaced frames in the output.
  12047. Default value is @code{0}.
  12048. @item mp
  12049. Set the metric plane to use. It accepts the following values:
  12050. @table @samp
  12051. @item l
  12052. Use luma plane.
  12053. @item u
  12054. Use chroma blue plane.
  12055. @item v
  12056. Use chroma red plane.
  12057. @end table
  12058. This option may be set to use chroma plane instead of the default luma plane
  12059. for doing filter's computations. This may improve accuracy on very clean
  12060. source material, but more likely will decrease accuracy, especially if there
  12061. is chroma noise (rainbow effect) or any grayscale video.
  12062. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  12063. load and make pullup usable in realtime on slow machines.
  12064. @end table
  12065. For best results (without duplicated frames in the output file) it is
  12066. necessary to change the output frame rate. For example, to inverse
  12067. telecine NTSC input:
  12068. @example
  12069. ffmpeg -i input -vf pullup -r 24000/1001 ...
  12070. @end example
  12071. @section qp
  12072. Change video quantization parameters (QP).
  12073. The filter accepts the following option:
  12074. @table @option
  12075. @item qp
  12076. Set expression for quantization parameter.
  12077. @end table
  12078. The expression is evaluated through the eval API and can contain, among others,
  12079. the following constants:
  12080. @table @var
  12081. @item known
  12082. 1 if index is not 129, 0 otherwise.
  12083. @item qp
  12084. Sequential index starting from -129 to 128.
  12085. @end table
  12086. @subsection Examples
  12087. @itemize
  12088. @item
  12089. Some equation like:
  12090. @example
  12091. qp=2+2*sin(PI*qp)
  12092. @end example
  12093. @end itemize
  12094. @section random
  12095. Flush video frames from internal cache of frames into a random order.
  12096. No frame is discarded.
  12097. Inspired by @ref{frei0r} nervous filter.
  12098. @table @option
  12099. @item frames
  12100. Set size in number of frames of internal cache, in range from @code{2} to
  12101. @code{512}. Default is @code{30}.
  12102. @item seed
  12103. Set seed for random number generator, must be an integer included between
  12104. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12105. less than @code{0}, the filter will try to use a good random seed on a
  12106. best effort basis.
  12107. @end table
  12108. @section readeia608
  12109. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12110. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12111. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12112. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12113. @table @option
  12114. @item lavfi.readeia608.X.cc
  12115. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12116. @item lavfi.readeia608.X.line
  12117. The number of the line on which the EIA-608 data was identified and read.
  12118. @end table
  12119. This filter accepts the following options:
  12120. @table @option
  12121. @item scan_min
  12122. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12123. @item scan_max
  12124. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12125. @item spw
  12126. Set the ratio of width reserved for sync code detection.
  12127. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12128. @item chp
  12129. Enable checking the parity bit. In the event of a parity error, the filter will output
  12130. @code{0x00} for that character. Default is false.
  12131. @item lp
  12132. Lowpass lines prior to further processing. Default is enabled.
  12133. @end table
  12134. @subsection Examples
  12135. @itemize
  12136. @item
  12137. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12138. @example
  12139. 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
  12140. @end example
  12141. @end itemize
  12142. @section readvitc
  12143. Read vertical interval timecode (VITC) information from the top lines of a
  12144. video frame.
  12145. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12146. timecode value, if a valid timecode has been detected. Further metadata key
  12147. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12148. timecode data has been found or not.
  12149. This filter accepts the following options:
  12150. @table @option
  12151. @item scan_max
  12152. Set the maximum number of lines to scan for VITC data. If the value is set to
  12153. @code{-1} the full video frame is scanned. Default is @code{45}.
  12154. @item thr_b
  12155. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12156. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12157. @item thr_w
  12158. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12159. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12160. @end table
  12161. @subsection Examples
  12162. @itemize
  12163. @item
  12164. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12165. draw @code{--:--:--:--} as a placeholder:
  12166. @example
  12167. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12168. @end example
  12169. @end itemize
  12170. @section remap
  12171. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12172. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12173. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12174. value for pixel will be used for destination pixel.
  12175. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12176. will have Xmap/Ymap video stream dimensions.
  12177. Xmap and Ymap input video streams are 16bit depth, single channel.
  12178. @table @option
  12179. @item format
  12180. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12181. Default is @code{color}.
  12182. @item fill
  12183. Specify the color of the unmapped pixels. For the syntax of this option,
  12184. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12185. manual,ffmpeg-utils}. Default color is @code{black}.
  12186. @end table
  12187. @section removegrain
  12188. The removegrain filter is a spatial denoiser for progressive video.
  12189. @table @option
  12190. @item m0
  12191. Set mode for the first plane.
  12192. @item m1
  12193. Set mode for the second plane.
  12194. @item m2
  12195. Set mode for the third plane.
  12196. @item m3
  12197. Set mode for the fourth plane.
  12198. @end table
  12199. Range of mode is from 0 to 24. Description of each mode follows:
  12200. @table @var
  12201. @item 0
  12202. Leave input plane unchanged. Default.
  12203. @item 1
  12204. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12205. @item 2
  12206. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12207. @item 3
  12208. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12209. @item 4
  12210. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12211. This is equivalent to a median filter.
  12212. @item 5
  12213. Line-sensitive clipping giving the minimal change.
  12214. @item 6
  12215. Line-sensitive clipping, intermediate.
  12216. @item 7
  12217. Line-sensitive clipping, intermediate.
  12218. @item 8
  12219. Line-sensitive clipping, intermediate.
  12220. @item 9
  12221. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12222. @item 10
  12223. Replaces the target pixel with the closest neighbour.
  12224. @item 11
  12225. [1 2 1] horizontal and vertical kernel blur.
  12226. @item 12
  12227. Same as mode 11.
  12228. @item 13
  12229. Bob mode, interpolates top field from the line where the neighbours
  12230. pixels are the closest.
  12231. @item 14
  12232. Bob mode, interpolates bottom field from the line where the neighbours
  12233. pixels are the closest.
  12234. @item 15
  12235. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12236. interpolation formula.
  12237. @item 16
  12238. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12239. interpolation formula.
  12240. @item 17
  12241. Clips the pixel with the minimum and maximum of respectively the maximum and
  12242. minimum of each pair of opposite neighbour pixels.
  12243. @item 18
  12244. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12245. the current pixel is minimal.
  12246. @item 19
  12247. Replaces the pixel with the average of its 8 neighbours.
  12248. @item 20
  12249. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12250. @item 21
  12251. Clips pixels using the averages of opposite neighbour.
  12252. @item 22
  12253. Same as mode 21 but simpler and faster.
  12254. @item 23
  12255. Small edge and halo removal, but reputed useless.
  12256. @item 24
  12257. Similar as 23.
  12258. @end table
  12259. @section removelogo
  12260. Suppress a TV station logo, using an image file to determine which
  12261. pixels comprise the logo. It works by filling in the pixels that
  12262. comprise the logo with neighboring pixels.
  12263. The filter accepts the following options:
  12264. @table @option
  12265. @item filename, f
  12266. Set the filter bitmap file, which can be any image format supported by
  12267. libavformat. The width and height of the image file must match those of the
  12268. video stream being processed.
  12269. @end table
  12270. Pixels in the provided bitmap image with a value of zero are not
  12271. considered part of the logo, non-zero pixels are considered part of
  12272. the logo. If you use white (255) for the logo and black (0) for the
  12273. rest, you will be safe. For making the filter bitmap, it is
  12274. recommended to take a screen capture of a black frame with the logo
  12275. visible, and then using a threshold filter followed by the erode
  12276. filter once or twice.
  12277. If needed, little splotches can be fixed manually. Remember that if
  12278. logo pixels are not covered, the filter quality will be much
  12279. reduced. Marking too many pixels as part of the logo does not hurt as
  12280. much, but it will increase the amount of blurring needed to cover over
  12281. the image and will destroy more information than necessary, and extra
  12282. pixels will slow things down on a large logo.
  12283. @section repeatfields
  12284. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12285. fields based on its value.
  12286. @section reverse
  12287. Reverse a video clip.
  12288. Warning: This filter requires memory to buffer the entire clip, so trimming
  12289. is suggested.
  12290. @subsection Examples
  12291. @itemize
  12292. @item
  12293. Take the first 5 seconds of a clip, and reverse it.
  12294. @example
  12295. trim=end=5,reverse
  12296. @end example
  12297. @end itemize
  12298. @section rgbashift
  12299. Shift R/G/B/A pixels horizontally and/or vertically.
  12300. The filter accepts the following options:
  12301. @table @option
  12302. @item rh
  12303. Set amount to shift red horizontally.
  12304. @item rv
  12305. Set amount to shift red vertically.
  12306. @item gh
  12307. Set amount to shift green horizontally.
  12308. @item gv
  12309. Set amount to shift green vertically.
  12310. @item bh
  12311. Set amount to shift blue horizontally.
  12312. @item bv
  12313. Set amount to shift blue vertically.
  12314. @item ah
  12315. Set amount to shift alpha horizontally.
  12316. @item av
  12317. Set amount to shift alpha vertically.
  12318. @item edge
  12319. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12320. @end table
  12321. @subsection Commands
  12322. This filter supports the all above options as @ref{commands}.
  12323. @section roberts
  12324. Apply roberts cross operator to input video stream.
  12325. The filter accepts the following option:
  12326. @table @option
  12327. @item planes
  12328. Set which planes will be processed, unprocessed planes will be copied.
  12329. By default value 0xf, all planes will be processed.
  12330. @item scale
  12331. Set value which will be multiplied with filtered result.
  12332. @item delta
  12333. Set value which will be added to filtered result.
  12334. @end table
  12335. @section rotate
  12336. Rotate video by an arbitrary angle expressed in radians.
  12337. The filter accepts the following options:
  12338. A description of the optional parameters follows.
  12339. @table @option
  12340. @item angle, a
  12341. Set an expression for the angle by which to rotate the input video
  12342. clockwise, expressed as a number of radians. A negative value will
  12343. result in a counter-clockwise rotation. By default it is set to "0".
  12344. This expression is evaluated for each frame.
  12345. @item out_w, ow
  12346. Set the output width expression, default value is "iw".
  12347. This expression is evaluated just once during configuration.
  12348. @item out_h, oh
  12349. Set the output height expression, default value is "ih".
  12350. This expression is evaluated just once during configuration.
  12351. @item bilinear
  12352. Enable bilinear interpolation if set to 1, a value of 0 disables
  12353. it. Default value is 1.
  12354. @item fillcolor, c
  12355. Set the color used to fill the output area not covered by the rotated
  12356. image. For the general syntax of this option, check the
  12357. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12358. If the special value "none" is selected then no
  12359. background is printed (useful for example if the background is never shown).
  12360. Default value is "black".
  12361. @end table
  12362. The expressions for the angle and the output size can contain the
  12363. following constants and functions:
  12364. @table @option
  12365. @item n
  12366. sequential number of the input frame, starting from 0. It is always NAN
  12367. before the first frame is filtered.
  12368. @item t
  12369. time in seconds of the input frame, it is set to 0 when the filter is
  12370. configured. It is always NAN before the first frame is filtered.
  12371. @item hsub
  12372. @item vsub
  12373. horizontal and vertical chroma subsample values. For example for the
  12374. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12375. @item in_w, iw
  12376. @item in_h, ih
  12377. the input video width and height
  12378. @item out_w, ow
  12379. @item out_h, oh
  12380. the output width and height, that is the size of the padded area as
  12381. specified by the @var{width} and @var{height} expressions
  12382. @item rotw(a)
  12383. @item roth(a)
  12384. the minimal width/height required for completely containing the input
  12385. video rotated by @var{a} radians.
  12386. These are only available when computing the @option{out_w} and
  12387. @option{out_h} expressions.
  12388. @end table
  12389. @subsection Examples
  12390. @itemize
  12391. @item
  12392. Rotate the input by PI/6 radians clockwise:
  12393. @example
  12394. rotate=PI/6
  12395. @end example
  12396. @item
  12397. Rotate the input by PI/6 radians counter-clockwise:
  12398. @example
  12399. rotate=-PI/6
  12400. @end example
  12401. @item
  12402. Rotate the input by 45 degrees clockwise:
  12403. @example
  12404. rotate=45*PI/180
  12405. @end example
  12406. @item
  12407. Apply a constant rotation with period T, starting from an angle of PI/3:
  12408. @example
  12409. rotate=PI/3+2*PI*t/T
  12410. @end example
  12411. @item
  12412. Make the input video rotation oscillating with a period of T
  12413. seconds and an amplitude of A radians:
  12414. @example
  12415. rotate=A*sin(2*PI/T*t)
  12416. @end example
  12417. @item
  12418. Rotate the video, output size is chosen so that the whole rotating
  12419. input video is always completely contained in the output:
  12420. @example
  12421. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12422. @end example
  12423. @item
  12424. Rotate the video, reduce the output size so that no background is ever
  12425. shown:
  12426. @example
  12427. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12428. @end example
  12429. @end itemize
  12430. @subsection Commands
  12431. The filter supports the following commands:
  12432. @table @option
  12433. @item a, angle
  12434. Set the angle expression.
  12435. The command accepts the same syntax of the corresponding option.
  12436. If the specified expression is not valid, it is kept at its current
  12437. value.
  12438. @end table
  12439. @section sab
  12440. Apply Shape Adaptive Blur.
  12441. The filter accepts the following options:
  12442. @table @option
  12443. @item luma_radius, lr
  12444. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12445. value is 1.0. A greater value will result in a more blurred image, and
  12446. in slower processing.
  12447. @item luma_pre_filter_radius, lpfr
  12448. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12449. value is 1.0.
  12450. @item luma_strength, ls
  12451. Set luma maximum difference between pixels to still be considered, must
  12452. be a value in the 0.1-100.0 range, default value is 1.0.
  12453. @item chroma_radius, cr
  12454. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12455. greater value will result in a more blurred image, and in slower
  12456. processing.
  12457. @item chroma_pre_filter_radius, cpfr
  12458. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12459. @item chroma_strength, cs
  12460. Set chroma maximum difference between pixels to still be considered,
  12461. must be a value in the -0.9-100.0 range.
  12462. @end table
  12463. Each chroma option value, if not explicitly specified, is set to the
  12464. corresponding luma option value.
  12465. @anchor{scale}
  12466. @section scale
  12467. Scale (resize) the input video, using the libswscale library.
  12468. The scale filter forces the output display aspect ratio to be the same
  12469. of the input, by changing the output sample aspect ratio.
  12470. If the input image format is different from the format requested by
  12471. the next filter, the scale filter will convert the input to the
  12472. requested format.
  12473. @subsection Options
  12474. The filter accepts the following options, or any of the options
  12475. supported by the libswscale scaler.
  12476. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12477. the complete list of scaler options.
  12478. @table @option
  12479. @item width, w
  12480. @item height, h
  12481. Set the output video dimension expression. Default value is the input
  12482. dimension.
  12483. If the @var{width} or @var{w} value is 0, the input width is used for
  12484. the output. If the @var{height} or @var{h} value is 0, the input height
  12485. is used for the output.
  12486. If one and only one of the values is -n with n >= 1, the scale filter
  12487. will use a value that maintains the aspect ratio of the input image,
  12488. calculated from the other specified dimension. After that it will,
  12489. however, make sure that the calculated dimension is divisible by n and
  12490. adjust the value if necessary.
  12491. If both values are -n with n >= 1, the behavior will be identical to
  12492. both values being set to 0 as previously detailed.
  12493. See below for the list of accepted constants for use in the dimension
  12494. expression.
  12495. @item eval
  12496. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12497. @table @samp
  12498. @item init
  12499. Only evaluate expressions once during the filter initialization or when a command is processed.
  12500. @item frame
  12501. Evaluate expressions for each incoming frame.
  12502. @end table
  12503. Default value is @samp{init}.
  12504. @item interl
  12505. Set the interlacing mode. It accepts the following values:
  12506. @table @samp
  12507. @item 1
  12508. Force interlaced aware scaling.
  12509. @item 0
  12510. Do not apply interlaced scaling.
  12511. @item -1
  12512. Select interlaced aware scaling depending on whether the source frames
  12513. are flagged as interlaced or not.
  12514. @end table
  12515. Default value is @samp{0}.
  12516. @item flags
  12517. Set libswscale scaling flags. See
  12518. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12519. complete list of values. If not explicitly specified the filter applies
  12520. the default flags.
  12521. @item param0, param1
  12522. Set libswscale input parameters for scaling algorithms that need them. See
  12523. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12524. complete documentation. If not explicitly specified the filter applies
  12525. empty parameters.
  12526. @item size, s
  12527. Set the video size. For the syntax of this option, check the
  12528. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12529. @item in_color_matrix
  12530. @item out_color_matrix
  12531. Set in/output YCbCr color space type.
  12532. This allows the autodetected value to be overridden as well as allows forcing
  12533. a specific value used for the output and encoder.
  12534. If not specified, the color space type depends on the pixel format.
  12535. Possible values:
  12536. @table @samp
  12537. @item auto
  12538. Choose automatically.
  12539. @item bt709
  12540. Format conforming to International Telecommunication Union (ITU)
  12541. Recommendation BT.709.
  12542. @item fcc
  12543. Set color space conforming to the United States Federal Communications
  12544. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12545. @item bt601
  12546. @item bt470
  12547. @item smpte170m
  12548. Set color space conforming to:
  12549. @itemize
  12550. @item
  12551. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12552. @item
  12553. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12554. @item
  12555. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12556. @end itemize
  12557. @item smpte240m
  12558. Set color space conforming to SMPTE ST 240:1999.
  12559. @item bt2020
  12560. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12561. @end table
  12562. @item in_range
  12563. @item out_range
  12564. Set in/output YCbCr sample range.
  12565. This allows the autodetected value to be overridden as well as allows forcing
  12566. a specific value used for the output and encoder. If not specified, the
  12567. range depends on the pixel format. Possible values:
  12568. @table @samp
  12569. @item auto/unknown
  12570. Choose automatically.
  12571. @item jpeg/full/pc
  12572. Set full range (0-255 in case of 8-bit luma).
  12573. @item mpeg/limited/tv
  12574. Set "MPEG" range (16-235 in case of 8-bit luma).
  12575. @end table
  12576. @item force_original_aspect_ratio
  12577. Enable decreasing or increasing output video width or height if necessary to
  12578. keep the original aspect ratio. Possible values:
  12579. @table @samp
  12580. @item disable
  12581. Scale the video as specified and disable this feature.
  12582. @item decrease
  12583. The output video dimensions will automatically be decreased if needed.
  12584. @item increase
  12585. The output video dimensions will automatically be increased if needed.
  12586. @end table
  12587. One useful instance of this option is that when you know a specific device's
  12588. maximum allowed resolution, you can use this to limit the output video to
  12589. that, while retaining the aspect ratio. For example, device A allows
  12590. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12591. decrease) and specifying 1280x720 to the command line makes the output
  12592. 1280x533.
  12593. Please note that this is a different thing than specifying -1 for @option{w}
  12594. or @option{h}, you still need to specify the output resolution for this option
  12595. to work.
  12596. @item force_divisible_by
  12597. Ensures that both the output dimensions, width and height, are divisible by the
  12598. given integer when used together with @option{force_original_aspect_ratio}. This
  12599. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12600. This option respects the value set for @option{force_original_aspect_ratio},
  12601. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12602. may be slightly modified.
  12603. This option can be handy if you need to have a video fit within or exceed
  12604. a defined resolution using @option{force_original_aspect_ratio} but also have
  12605. encoder restrictions on width or height divisibility.
  12606. @end table
  12607. The values of the @option{w} and @option{h} options are expressions
  12608. containing the following constants:
  12609. @table @var
  12610. @item in_w
  12611. @item in_h
  12612. The input width and height
  12613. @item iw
  12614. @item ih
  12615. These are the same as @var{in_w} and @var{in_h}.
  12616. @item out_w
  12617. @item out_h
  12618. The output (scaled) width and height
  12619. @item ow
  12620. @item oh
  12621. These are the same as @var{out_w} and @var{out_h}
  12622. @item a
  12623. The same as @var{iw} / @var{ih}
  12624. @item sar
  12625. input sample aspect ratio
  12626. @item dar
  12627. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12628. @item hsub
  12629. @item vsub
  12630. horizontal and vertical input chroma subsample values. For example for the
  12631. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12632. @item ohsub
  12633. @item ovsub
  12634. horizontal and vertical output chroma subsample values. For example for the
  12635. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12636. @item n
  12637. The (sequential) number of the input frame, starting from 0.
  12638. Only available with @code{eval=frame}.
  12639. @item t
  12640. The presentation timestamp of the input frame, expressed as a number of
  12641. seconds. Only available with @code{eval=frame}.
  12642. @item pos
  12643. The position (byte offset) of the frame in the input stream, or NaN if
  12644. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12645. Only available with @code{eval=frame}.
  12646. @end table
  12647. @subsection Examples
  12648. @itemize
  12649. @item
  12650. Scale the input video to a size of 200x100
  12651. @example
  12652. scale=w=200:h=100
  12653. @end example
  12654. This is equivalent to:
  12655. @example
  12656. scale=200:100
  12657. @end example
  12658. or:
  12659. @example
  12660. scale=200x100
  12661. @end example
  12662. @item
  12663. Specify a size abbreviation for the output size:
  12664. @example
  12665. scale=qcif
  12666. @end example
  12667. which can also be written as:
  12668. @example
  12669. scale=size=qcif
  12670. @end example
  12671. @item
  12672. Scale the input to 2x:
  12673. @example
  12674. scale=w=2*iw:h=2*ih
  12675. @end example
  12676. @item
  12677. The above is the same as:
  12678. @example
  12679. scale=2*in_w:2*in_h
  12680. @end example
  12681. @item
  12682. Scale the input to 2x with forced interlaced scaling:
  12683. @example
  12684. scale=2*iw:2*ih:interl=1
  12685. @end example
  12686. @item
  12687. Scale the input to half size:
  12688. @example
  12689. scale=w=iw/2:h=ih/2
  12690. @end example
  12691. @item
  12692. Increase the width, and set the height to the same size:
  12693. @example
  12694. scale=3/2*iw:ow
  12695. @end example
  12696. @item
  12697. Seek Greek harmony:
  12698. @example
  12699. scale=iw:1/PHI*iw
  12700. scale=ih*PHI:ih
  12701. @end example
  12702. @item
  12703. Increase the height, and set the width to 3/2 of the height:
  12704. @example
  12705. scale=w=3/2*oh:h=3/5*ih
  12706. @end example
  12707. @item
  12708. Increase the size, making the size a multiple of the chroma
  12709. subsample values:
  12710. @example
  12711. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12712. @end example
  12713. @item
  12714. Increase the width to a maximum of 500 pixels,
  12715. keeping the same aspect ratio as the input:
  12716. @example
  12717. scale=w='min(500\, iw*3/2):h=-1'
  12718. @end example
  12719. @item
  12720. Make pixels square by combining scale and setsar:
  12721. @example
  12722. scale='trunc(ih*dar):ih',setsar=1/1
  12723. @end example
  12724. @item
  12725. Make pixels square by combining scale and setsar,
  12726. making sure the resulting resolution is even (required by some codecs):
  12727. @example
  12728. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12729. @end example
  12730. @end itemize
  12731. @subsection Commands
  12732. This filter supports the following commands:
  12733. @table @option
  12734. @item width, w
  12735. @item height, h
  12736. Set the output video dimension expression.
  12737. The command accepts the same syntax of the corresponding option.
  12738. If the specified expression is not valid, it is kept at its current
  12739. value.
  12740. @end table
  12741. @section scale_npp
  12742. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12743. format conversion on CUDA video frames. Setting the output width and height
  12744. works in the same way as for the @var{scale} filter.
  12745. The following additional options are accepted:
  12746. @table @option
  12747. @item format
  12748. The pixel format of the output CUDA frames. If set to the string "same" (the
  12749. default), the input format will be kept. Note that automatic format negotiation
  12750. and conversion is not yet supported for hardware frames
  12751. @item interp_algo
  12752. The interpolation algorithm used for resizing. One of the following:
  12753. @table @option
  12754. @item nn
  12755. Nearest neighbour.
  12756. @item linear
  12757. @item cubic
  12758. @item cubic2p_bspline
  12759. 2-parameter cubic (B=1, C=0)
  12760. @item cubic2p_catmullrom
  12761. 2-parameter cubic (B=0, C=1/2)
  12762. @item cubic2p_b05c03
  12763. 2-parameter cubic (B=1/2, C=3/10)
  12764. @item super
  12765. Supersampling
  12766. @item lanczos
  12767. @end table
  12768. @item force_original_aspect_ratio
  12769. Enable decreasing or increasing output video width or height if necessary to
  12770. keep the original aspect ratio. Possible values:
  12771. @table @samp
  12772. @item disable
  12773. Scale the video as specified and disable this feature.
  12774. @item decrease
  12775. The output video dimensions will automatically be decreased if needed.
  12776. @item increase
  12777. The output video dimensions will automatically be increased if needed.
  12778. @end table
  12779. One useful instance of this option is that when you know a specific device's
  12780. maximum allowed resolution, you can use this to limit the output video to
  12781. that, while retaining the aspect ratio. For example, device A allows
  12782. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12783. decrease) and specifying 1280x720 to the command line makes the output
  12784. 1280x533.
  12785. Please note that this is a different thing than specifying -1 for @option{w}
  12786. or @option{h}, you still need to specify the output resolution for this option
  12787. to work.
  12788. @item force_divisible_by
  12789. Ensures that both the output dimensions, width and height, are divisible by the
  12790. given integer when used together with @option{force_original_aspect_ratio}. This
  12791. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12792. This option respects the value set for @option{force_original_aspect_ratio},
  12793. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12794. may be slightly modified.
  12795. This option can be handy if you need to have a video fit within or exceed
  12796. a defined resolution using @option{force_original_aspect_ratio} but also have
  12797. encoder restrictions on width or height divisibility.
  12798. @end table
  12799. @section scale2ref
  12800. Scale (resize) the input video, based on a reference video.
  12801. See the scale filter for available options, scale2ref supports the same but
  12802. uses the reference video instead of the main input as basis. scale2ref also
  12803. supports the following additional constants for the @option{w} and
  12804. @option{h} options:
  12805. @table @var
  12806. @item main_w
  12807. @item main_h
  12808. The main input video's width and height
  12809. @item main_a
  12810. The same as @var{main_w} / @var{main_h}
  12811. @item main_sar
  12812. The main input video's sample aspect ratio
  12813. @item main_dar, mdar
  12814. The main input video's display aspect ratio. Calculated from
  12815. @code{(main_w / main_h) * main_sar}.
  12816. @item main_hsub
  12817. @item main_vsub
  12818. The main input video's horizontal and vertical chroma subsample values.
  12819. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12820. is 1.
  12821. @item main_n
  12822. The (sequential) number of the main input frame, starting from 0.
  12823. Only available with @code{eval=frame}.
  12824. @item main_t
  12825. The presentation timestamp of the main input frame, expressed as a number of
  12826. seconds. Only available with @code{eval=frame}.
  12827. @item main_pos
  12828. The position (byte offset) of the frame in the main input stream, or NaN if
  12829. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12830. Only available with @code{eval=frame}.
  12831. @end table
  12832. @subsection Examples
  12833. @itemize
  12834. @item
  12835. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12836. @example
  12837. 'scale2ref[b][a];[a][b]overlay'
  12838. @end example
  12839. @item
  12840. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12841. @example
  12842. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12843. @end example
  12844. @end itemize
  12845. @subsection Commands
  12846. This filter supports the following commands:
  12847. @table @option
  12848. @item width, w
  12849. @item height, h
  12850. Set the output video dimension expression.
  12851. The command accepts the same syntax of the corresponding option.
  12852. If the specified expression is not valid, it is kept at its current
  12853. value.
  12854. @end table
  12855. @section scroll
  12856. Scroll input video horizontally and/or vertically by constant speed.
  12857. The filter accepts the following options:
  12858. @table @option
  12859. @item horizontal, h
  12860. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12861. Negative values changes scrolling direction.
  12862. @item vertical, v
  12863. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12864. Negative values changes scrolling direction.
  12865. @item hpos
  12866. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12867. @item vpos
  12868. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12869. @end table
  12870. @subsection Commands
  12871. This filter supports the following @ref{commands}:
  12872. @table @option
  12873. @item horizontal, h
  12874. Set the horizontal scrolling speed.
  12875. @item vertical, v
  12876. Set the vertical scrolling speed.
  12877. @end table
  12878. @anchor{scdet}
  12879. @section scdet
  12880. Detect video scene change.
  12881. This filter sets frame metadata with mafd between frame, the scene score, and
  12882. forward the frame to the next filter, so they can use these metadata to detect
  12883. scene change or others.
  12884. In addition, this filter logs a message and sets frame metadata when it detects
  12885. a scene change by @option{threshold}.
  12886. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  12887. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  12888. to detect scene change.
  12889. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  12890. detect scene change with @option{threshold}.
  12891. The filter accepts the following options:
  12892. @table @option
  12893. @item threshold, t
  12894. Set the scene change detection threshold as a percentage of maximum change. Good
  12895. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  12896. @code{[0., 100.]}.
  12897. Default value is @code{10.}.
  12898. @item sc_pass, s
  12899. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  12900. You can enable it if you want to get snapshot of scene change frames only.
  12901. @end table
  12902. @anchor{selectivecolor}
  12903. @section selectivecolor
  12904. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12905. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12906. by the "purity" of the color (that is, how saturated it already is).
  12907. This filter is similar to the Adobe Photoshop Selective Color tool.
  12908. The filter accepts the following options:
  12909. @table @option
  12910. @item correction_method
  12911. Select color correction method.
  12912. Available values are:
  12913. @table @samp
  12914. @item absolute
  12915. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12916. component value).
  12917. @item relative
  12918. Specified adjustments are relative to the original component value.
  12919. @end table
  12920. Default is @code{absolute}.
  12921. @item reds
  12922. Adjustments for red pixels (pixels where the red component is the maximum)
  12923. @item yellows
  12924. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12925. @item greens
  12926. Adjustments for green pixels (pixels where the green component is the maximum)
  12927. @item cyans
  12928. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12929. @item blues
  12930. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12931. @item magentas
  12932. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12933. @item whites
  12934. Adjustments for white pixels (pixels where all components are greater than 128)
  12935. @item neutrals
  12936. Adjustments for all pixels except pure black and pure white
  12937. @item blacks
  12938. Adjustments for black pixels (pixels where all components are lesser than 128)
  12939. @item psfile
  12940. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12941. @end table
  12942. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12943. 4 space separated floating point adjustment values in the [-1,1] range,
  12944. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12945. pixels of its range.
  12946. @subsection Examples
  12947. @itemize
  12948. @item
  12949. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12950. increase magenta by 27% in blue areas:
  12951. @example
  12952. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12953. @end example
  12954. @item
  12955. Use a Photoshop selective color preset:
  12956. @example
  12957. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12958. @end example
  12959. @end itemize
  12960. @anchor{separatefields}
  12961. @section separatefields
  12962. The @code{separatefields} takes a frame-based video input and splits
  12963. each frame into its components fields, producing a new half height clip
  12964. with twice the frame rate and twice the frame count.
  12965. This filter use field-dominance information in frame to decide which
  12966. of each pair of fields to place first in the output.
  12967. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12968. @section setdar, setsar
  12969. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12970. output video.
  12971. This is done by changing the specified Sample (aka Pixel) Aspect
  12972. Ratio, according to the following equation:
  12973. @example
  12974. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12975. @end example
  12976. Keep in mind that the @code{setdar} filter does not modify the pixel
  12977. dimensions of the video frame. Also, the display aspect ratio set by
  12978. this filter may be changed by later filters in the filterchain,
  12979. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12980. applied.
  12981. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12982. the filter output video.
  12983. Note that as a consequence of the application of this filter, the
  12984. output display aspect ratio will change according to the equation
  12985. above.
  12986. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12987. filter may be changed by later filters in the filterchain, e.g. if
  12988. another "setsar" or a "setdar" filter is applied.
  12989. It accepts the following parameters:
  12990. @table @option
  12991. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12992. Set the aspect ratio used by the filter.
  12993. The parameter can be a floating point number string, an expression, or
  12994. a string of the form @var{num}:@var{den}, where @var{num} and
  12995. @var{den} are the numerator and denominator of the aspect ratio. If
  12996. the parameter is not specified, it is assumed the value "0".
  12997. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12998. should be escaped.
  12999. @item max
  13000. Set the maximum integer value to use for expressing numerator and
  13001. denominator when reducing the expressed aspect ratio to a rational.
  13002. Default value is @code{100}.
  13003. @end table
  13004. The parameter @var{sar} is an expression containing
  13005. the following constants:
  13006. @table @option
  13007. @item E, PI, PHI
  13008. These are approximated values for the mathematical constants e
  13009. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  13010. @item w, h
  13011. The input width and height.
  13012. @item a
  13013. These are the same as @var{w} / @var{h}.
  13014. @item sar
  13015. The input sample aspect ratio.
  13016. @item dar
  13017. The input display aspect ratio. It is the same as
  13018. (@var{w} / @var{h}) * @var{sar}.
  13019. @item hsub, vsub
  13020. Horizontal and vertical chroma subsample values. For example, for the
  13021. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13022. @end table
  13023. @subsection Examples
  13024. @itemize
  13025. @item
  13026. To change the display aspect ratio to 16:9, specify one of the following:
  13027. @example
  13028. setdar=dar=1.77777
  13029. setdar=dar=16/9
  13030. @end example
  13031. @item
  13032. To change the sample aspect ratio to 10:11, specify:
  13033. @example
  13034. setsar=sar=10/11
  13035. @end example
  13036. @item
  13037. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  13038. 1000 in the aspect ratio reduction, use the command:
  13039. @example
  13040. setdar=ratio=16/9:max=1000
  13041. @end example
  13042. @end itemize
  13043. @anchor{setfield}
  13044. @section setfield
  13045. Force field for the output video frame.
  13046. The @code{setfield} filter marks the interlace type field for the
  13047. output frames. It does not change the input frame, but only sets the
  13048. corresponding property, which affects how the frame is treated by
  13049. following filters (e.g. @code{fieldorder} or @code{yadif}).
  13050. The filter accepts the following options:
  13051. @table @option
  13052. @item mode
  13053. Available values are:
  13054. @table @samp
  13055. @item auto
  13056. Keep the same field property.
  13057. @item bff
  13058. Mark the frame as bottom-field-first.
  13059. @item tff
  13060. Mark the frame as top-field-first.
  13061. @item prog
  13062. Mark the frame as progressive.
  13063. @end table
  13064. @end table
  13065. @anchor{setparams}
  13066. @section setparams
  13067. Force frame parameter for the output video frame.
  13068. The @code{setparams} filter marks interlace and color range for the
  13069. output frames. It does not change the input frame, but only sets the
  13070. corresponding property, which affects how the frame is treated by
  13071. filters/encoders.
  13072. @table @option
  13073. @item field_mode
  13074. Available values are:
  13075. @table @samp
  13076. @item auto
  13077. Keep the same field property (default).
  13078. @item bff
  13079. Mark the frame as bottom-field-first.
  13080. @item tff
  13081. Mark the frame as top-field-first.
  13082. @item prog
  13083. Mark the frame as progressive.
  13084. @end table
  13085. @item range
  13086. Available values are:
  13087. @table @samp
  13088. @item auto
  13089. Keep the same color range property (default).
  13090. @item unspecified, unknown
  13091. Mark the frame as unspecified color range.
  13092. @item limited, tv, mpeg
  13093. Mark the frame as limited range.
  13094. @item full, pc, jpeg
  13095. Mark the frame as full range.
  13096. @end table
  13097. @item color_primaries
  13098. Set the color primaries.
  13099. Available values are:
  13100. @table @samp
  13101. @item auto
  13102. Keep the same color primaries property (default).
  13103. @item bt709
  13104. @item unknown
  13105. @item bt470m
  13106. @item bt470bg
  13107. @item smpte170m
  13108. @item smpte240m
  13109. @item film
  13110. @item bt2020
  13111. @item smpte428
  13112. @item smpte431
  13113. @item smpte432
  13114. @item jedec-p22
  13115. @end table
  13116. @item color_trc
  13117. Set the color transfer.
  13118. Available values are:
  13119. @table @samp
  13120. @item auto
  13121. Keep the same color trc property (default).
  13122. @item bt709
  13123. @item unknown
  13124. @item bt470m
  13125. @item bt470bg
  13126. @item smpte170m
  13127. @item smpte240m
  13128. @item linear
  13129. @item log100
  13130. @item log316
  13131. @item iec61966-2-4
  13132. @item bt1361e
  13133. @item iec61966-2-1
  13134. @item bt2020-10
  13135. @item bt2020-12
  13136. @item smpte2084
  13137. @item smpte428
  13138. @item arib-std-b67
  13139. @end table
  13140. @item colorspace
  13141. Set the colorspace.
  13142. Available values are:
  13143. @table @samp
  13144. @item auto
  13145. Keep the same colorspace property (default).
  13146. @item gbr
  13147. @item bt709
  13148. @item unknown
  13149. @item fcc
  13150. @item bt470bg
  13151. @item smpte170m
  13152. @item smpte240m
  13153. @item ycgco
  13154. @item bt2020nc
  13155. @item bt2020c
  13156. @item smpte2085
  13157. @item chroma-derived-nc
  13158. @item chroma-derived-c
  13159. @item ictcp
  13160. @end table
  13161. @end table
  13162. @section showinfo
  13163. Show a line containing various information for each input video frame.
  13164. The input video is not modified.
  13165. This filter supports the following options:
  13166. @table @option
  13167. @item checksum
  13168. Calculate checksums of each plane. By default enabled.
  13169. @end table
  13170. The shown line contains a sequence of key/value pairs of the form
  13171. @var{key}:@var{value}.
  13172. The following values are shown in the output:
  13173. @table @option
  13174. @item n
  13175. The (sequential) number of the input frame, starting from 0.
  13176. @item pts
  13177. The Presentation TimeStamp of the input frame, expressed as a number of
  13178. time base units. The time base unit depends on the filter input pad.
  13179. @item pts_time
  13180. The Presentation TimeStamp of the input frame, expressed as a number of
  13181. seconds.
  13182. @item pos
  13183. The position of the frame in the input stream, or -1 if this information is
  13184. unavailable and/or meaningless (for example in case of synthetic video).
  13185. @item fmt
  13186. The pixel format name.
  13187. @item sar
  13188. The sample aspect ratio of the input frame, expressed in the form
  13189. @var{num}/@var{den}.
  13190. @item s
  13191. The size of the input frame. For the syntax of this option, check the
  13192. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13193. @item i
  13194. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13195. for bottom field first).
  13196. @item iskey
  13197. This is 1 if the frame is a key frame, 0 otherwise.
  13198. @item type
  13199. The picture type of the input frame ("I" for an I-frame, "P" for a
  13200. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13201. Also refer to the documentation of the @code{AVPictureType} enum and of
  13202. the @code{av_get_picture_type_char} function defined in
  13203. @file{libavutil/avutil.h}.
  13204. @item checksum
  13205. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13206. @item plane_checksum
  13207. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13208. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13209. @item mean
  13210. The mean value of pixels in each plane of the input frame, expressed in the form
  13211. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13212. @item stdev
  13213. The standard deviation of pixel values in each plane of the input frame, expressed
  13214. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13215. @end table
  13216. @section showpalette
  13217. Displays the 256 colors palette of each frame. This filter is only relevant for
  13218. @var{pal8} pixel format frames.
  13219. It accepts the following option:
  13220. @table @option
  13221. @item s
  13222. Set the size of the box used to represent one palette color entry. Default is
  13223. @code{30} (for a @code{30x30} pixel box).
  13224. @end table
  13225. @section shuffleframes
  13226. Reorder and/or duplicate and/or drop video frames.
  13227. It accepts the following parameters:
  13228. @table @option
  13229. @item mapping
  13230. Set the destination indexes of input frames.
  13231. This is space or '|' separated list of indexes that maps input frames to output
  13232. frames. Number of indexes also sets maximal value that each index may have.
  13233. '-1' index have special meaning and that is to drop frame.
  13234. @end table
  13235. The first frame has the index 0. The default is to keep the input unchanged.
  13236. @subsection Examples
  13237. @itemize
  13238. @item
  13239. Swap second and third frame of every three frames of the input:
  13240. @example
  13241. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13242. @end example
  13243. @item
  13244. Swap 10th and 1st frame of every ten frames of the input:
  13245. @example
  13246. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13247. @end example
  13248. @end itemize
  13249. @section shuffleplanes
  13250. Reorder and/or duplicate video planes.
  13251. It accepts the following parameters:
  13252. @table @option
  13253. @item map0
  13254. The index of the input plane to be used as the first output plane.
  13255. @item map1
  13256. The index of the input plane to be used as the second output plane.
  13257. @item map2
  13258. The index of the input plane to be used as the third output plane.
  13259. @item map3
  13260. The index of the input plane to be used as the fourth output plane.
  13261. @end table
  13262. The first plane has the index 0. The default is to keep the input unchanged.
  13263. @subsection Examples
  13264. @itemize
  13265. @item
  13266. Swap the second and third planes of the input:
  13267. @example
  13268. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13269. @end example
  13270. @end itemize
  13271. @anchor{signalstats}
  13272. @section signalstats
  13273. Evaluate various visual metrics that assist in determining issues associated
  13274. with the digitization of analog video media.
  13275. By default the filter will log these metadata values:
  13276. @table @option
  13277. @item YMIN
  13278. Display the minimal Y value contained within the input frame. Expressed in
  13279. range of [0-255].
  13280. @item YLOW
  13281. Display the Y value at the 10% percentile within the input frame. Expressed in
  13282. range of [0-255].
  13283. @item YAVG
  13284. Display the average Y value within the input frame. Expressed in range of
  13285. [0-255].
  13286. @item YHIGH
  13287. Display the Y value at the 90% percentile within the input frame. Expressed in
  13288. range of [0-255].
  13289. @item YMAX
  13290. Display the maximum Y value contained within the input frame. Expressed in
  13291. range of [0-255].
  13292. @item UMIN
  13293. Display the minimal U value contained within the input frame. Expressed in
  13294. range of [0-255].
  13295. @item ULOW
  13296. Display the U value at the 10% percentile within the input frame. Expressed in
  13297. range of [0-255].
  13298. @item UAVG
  13299. Display the average U value within the input frame. Expressed in range of
  13300. [0-255].
  13301. @item UHIGH
  13302. Display the U value at the 90% percentile within the input frame. Expressed in
  13303. range of [0-255].
  13304. @item UMAX
  13305. Display the maximum U value contained within the input frame. Expressed in
  13306. range of [0-255].
  13307. @item VMIN
  13308. Display the minimal V value contained within the input frame. Expressed in
  13309. range of [0-255].
  13310. @item VLOW
  13311. Display the V value at the 10% percentile within the input frame. Expressed in
  13312. range of [0-255].
  13313. @item VAVG
  13314. Display the average V value within the input frame. Expressed in range of
  13315. [0-255].
  13316. @item VHIGH
  13317. Display the V value at the 90% percentile within the input frame. Expressed in
  13318. range of [0-255].
  13319. @item VMAX
  13320. Display the maximum V value contained within the input frame. Expressed in
  13321. range of [0-255].
  13322. @item SATMIN
  13323. Display the minimal saturation value contained within the input frame.
  13324. Expressed in range of [0-~181.02].
  13325. @item SATLOW
  13326. Display the saturation value at the 10% percentile within the input frame.
  13327. Expressed in range of [0-~181.02].
  13328. @item SATAVG
  13329. Display the average saturation value within the input frame. Expressed in range
  13330. of [0-~181.02].
  13331. @item SATHIGH
  13332. Display the saturation value at the 90% percentile within the input frame.
  13333. Expressed in range of [0-~181.02].
  13334. @item SATMAX
  13335. Display the maximum saturation value contained within the input frame.
  13336. Expressed in range of [0-~181.02].
  13337. @item HUEMED
  13338. Display the median value for hue within the input frame. Expressed in range of
  13339. [0-360].
  13340. @item HUEAVG
  13341. Display the average value for hue within the input frame. Expressed in range of
  13342. [0-360].
  13343. @item YDIF
  13344. Display the average of sample value difference between all values of the Y
  13345. plane in the current frame and corresponding values of the previous input frame.
  13346. Expressed in range of [0-255].
  13347. @item UDIF
  13348. Display the average of sample value difference between all values of the U
  13349. plane in the current frame and corresponding values of the previous input frame.
  13350. Expressed in range of [0-255].
  13351. @item VDIF
  13352. Display the average of sample value difference between all values of the V
  13353. plane in the current frame and corresponding values of the previous input frame.
  13354. Expressed in range of [0-255].
  13355. @item YBITDEPTH
  13356. Display bit depth of Y plane in current frame.
  13357. Expressed in range of [0-16].
  13358. @item UBITDEPTH
  13359. Display bit depth of U plane in current frame.
  13360. Expressed in range of [0-16].
  13361. @item VBITDEPTH
  13362. Display bit depth of V plane in current frame.
  13363. Expressed in range of [0-16].
  13364. @end table
  13365. The filter accepts the following options:
  13366. @table @option
  13367. @item stat
  13368. @item out
  13369. @option{stat} specify an additional form of image analysis.
  13370. @option{out} output video with the specified type of pixel highlighted.
  13371. Both options accept the following values:
  13372. @table @samp
  13373. @item tout
  13374. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13375. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13376. include the results of video dropouts, head clogs, or tape tracking issues.
  13377. @item vrep
  13378. Identify @var{vertical line repetition}. Vertical line repetition includes
  13379. similar rows of pixels within a frame. In born-digital video vertical line
  13380. repetition is common, but this pattern is uncommon in video digitized from an
  13381. analog source. When it occurs in video that results from the digitization of an
  13382. analog source it can indicate concealment from a dropout compensator.
  13383. @item brng
  13384. Identify pixels that fall outside of legal broadcast range.
  13385. @end table
  13386. @item color, c
  13387. Set the highlight color for the @option{out} option. The default color is
  13388. yellow.
  13389. @end table
  13390. @subsection Examples
  13391. @itemize
  13392. @item
  13393. Output data of various video metrics:
  13394. @example
  13395. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13396. @end example
  13397. @item
  13398. Output specific data about the minimum and maximum values of the Y plane per frame:
  13399. @example
  13400. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13401. @end example
  13402. @item
  13403. Playback video while highlighting pixels that are outside of broadcast range in red.
  13404. @example
  13405. ffplay example.mov -vf signalstats="out=brng:color=red"
  13406. @end example
  13407. @item
  13408. Playback video with signalstats metadata drawn over the frame.
  13409. @example
  13410. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13411. @end example
  13412. The contents of signalstat_drawtext.txt used in the command are:
  13413. @example
  13414. time %@{pts:hms@}
  13415. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13416. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13417. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13418. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13419. @end example
  13420. @end itemize
  13421. @anchor{signature}
  13422. @section signature
  13423. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13424. input. In this case the matching between the inputs can be calculated additionally.
  13425. The filter always passes through the first input. The signature of each stream can
  13426. be written into a file.
  13427. It accepts the following options:
  13428. @table @option
  13429. @item detectmode
  13430. Enable or disable the matching process.
  13431. Available values are:
  13432. @table @samp
  13433. @item off
  13434. Disable the calculation of a matching (default).
  13435. @item full
  13436. Calculate the matching for the whole video and output whether the whole video
  13437. matches or only parts.
  13438. @item fast
  13439. Calculate only until a matching is found or the video ends. Should be faster in
  13440. some cases.
  13441. @end table
  13442. @item nb_inputs
  13443. Set the number of inputs. The option value must be a non negative integer.
  13444. Default value is 1.
  13445. @item filename
  13446. Set the path to which the output is written. If there is more than one input,
  13447. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13448. integer), that will be replaced with the input number. If no filename is
  13449. specified, no output will be written. This is the default.
  13450. @item format
  13451. Choose the output format.
  13452. Available values are:
  13453. @table @samp
  13454. @item binary
  13455. Use the specified binary representation (default).
  13456. @item xml
  13457. Use the specified xml representation.
  13458. @end table
  13459. @item th_d
  13460. Set threshold to detect one word as similar. The option value must be an integer
  13461. greater than zero. The default value is 9000.
  13462. @item th_dc
  13463. Set threshold to detect all words as similar. The option value must be an integer
  13464. greater than zero. The default value is 60000.
  13465. @item th_xh
  13466. Set threshold to detect frames as similar. The option value must be an integer
  13467. greater than zero. The default value is 116.
  13468. @item th_di
  13469. Set the minimum length of a sequence in frames to recognize it as matching
  13470. sequence. The option value must be a non negative integer value.
  13471. The default value is 0.
  13472. @item th_it
  13473. Set the minimum relation, that matching frames to all frames must have.
  13474. The option value must be a double value between 0 and 1. The default value is 0.5.
  13475. @end table
  13476. @subsection Examples
  13477. @itemize
  13478. @item
  13479. To calculate the signature of an input video and store it in signature.bin:
  13480. @example
  13481. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13482. @end example
  13483. @item
  13484. To detect whether two videos match and store the signatures in XML format in
  13485. signature0.xml and signature1.xml:
  13486. @example
  13487. 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 -
  13488. @end example
  13489. @end itemize
  13490. @anchor{smartblur}
  13491. @section smartblur
  13492. Blur the input video without impacting the outlines.
  13493. It accepts the following options:
  13494. @table @option
  13495. @item luma_radius, lr
  13496. Set the luma radius. The option value must be a float number in
  13497. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13498. used to blur the image (slower if larger). Default value is 1.0.
  13499. @item luma_strength, ls
  13500. Set the luma strength. The option value must be a float number
  13501. in the range [-1.0,1.0] that configures the blurring. A value included
  13502. in [0.0,1.0] will blur the image whereas a value included in
  13503. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13504. @item luma_threshold, lt
  13505. Set the luma threshold used as a coefficient to determine
  13506. whether a pixel should be blurred or not. The option value must be an
  13507. integer in the range [-30,30]. A value of 0 will filter all the image,
  13508. a value included in [0,30] will filter flat areas and a value included
  13509. in [-30,0] will filter edges. Default value is 0.
  13510. @item chroma_radius, cr
  13511. Set the chroma radius. The option value must be a float number in
  13512. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13513. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13514. @item chroma_strength, cs
  13515. Set the chroma strength. The option value must be a float number
  13516. in the range [-1.0,1.0] that configures the blurring. A value included
  13517. in [0.0,1.0] will blur the image whereas a value included in
  13518. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13519. @item chroma_threshold, ct
  13520. Set the chroma threshold used as a coefficient to determine
  13521. whether a pixel should be blurred or not. The option value must be an
  13522. integer in the range [-30,30]. A value of 0 will filter all the image,
  13523. a value included in [0,30] will filter flat areas and a value included
  13524. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13525. @end table
  13526. If a chroma option is not explicitly set, the corresponding luma value
  13527. is set.
  13528. @section sobel
  13529. Apply sobel operator to input video stream.
  13530. The filter accepts the following option:
  13531. @table @option
  13532. @item planes
  13533. Set which planes will be processed, unprocessed planes will be copied.
  13534. By default value 0xf, all planes will be processed.
  13535. @item scale
  13536. Set value which will be multiplied with filtered result.
  13537. @item delta
  13538. Set value which will be added to filtered result.
  13539. @end table
  13540. @anchor{spp}
  13541. @section spp
  13542. Apply a simple postprocessing filter that compresses and decompresses the image
  13543. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13544. and average the results.
  13545. The filter accepts the following options:
  13546. @table @option
  13547. @item quality
  13548. Set quality. This option defines the number of levels for averaging. It accepts
  13549. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13550. effect. A value of @code{6} means the higher quality. For each increment of
  13551. that value the speed drops by a factor of approximately 2. Default value is
  13552. @code{3}.
  13553. @item qp
  13554. Force a constant quantization parameter. If not set, the filter will use the QP
  13555. from the video stream (if available).
  13556. @item mode
  13557. Set thresholding mode. Available modes are:
  13558. @table @samp
  13559. @item hard
  13560. Set hard thresholding (default).
  13561. @item soft
  13562. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13563. @end table
  13564. @item use_bframe_qp
  13565. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13566. option may cause flicker since the B-Frames have often larger QP. Default is
  13567. @code{0} (not enabled).
  13568. @end table
  13569. @subsection Commands
  13570. This filter supports the following commands:
  13571. @table @option
  13572. @item quality, level
  13573. Set quality level. The value @code{max} can be used to set the maximum level,
  13574. currently @code{6}.
  13575. @end table
  13576. @anchor{sr}
  13577. @section sr
  13578. Scale the input by applying one of the super-resolution methods based on
  13579. convolutional neural networks. Supported models:
  13580. @itemize
  13581. @item
  13582. Super-Resolution Convolutional Neural Network model (SRCNN).
  13583. See @url{https://arxiv.org/abs/1501.00092}.
  13584. @item
  13585. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13586. See @url{https://arxiv.org/abs/1609.05158}.
  13587. @end itemize
  13588. Training scripts as well as scripts for model file (.pb) saving can be found at
  13589. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13590. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13591. Native model files (.model) can be generated from TensorFlow model
  13592. files (.pb) by using tools/python/convert.py
  13593. The filter accepts the following options:
  13594. @table @option
  13595. @item dnn_backend
  13596. Specify which DNN backend to use for model loading and execution. This option accepts
  13597. the following values:
  13598. @table @samp
  13599. @item native
  13600. Native implementation of DNN loading and execution.
  13601. @item tensorflow
  13602. TensorFlow backend. To enable this backend you
  13603. need to install the TensorFlow for C library (see
  13604. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13605. @code{--enable-libtensorflow}
  13606. @end table
  13607. Default value is @samp{native}.
  13608. @item model
  13609. Set path to model file specifying network architecture and its parameters.
  13610. Note that different backends use different file formats. TensorFlow backend
  13611. can load files for both formats, while native backend can load files for only
  13612. its format.
  13613. @item scale_factor
  13614. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13615. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13616. input upscaled using bicubic upscaling with proper scale factor.
  13617. @end table
  13618. This feature can also be finished with @ref{dnn_processing} filter.
  13619. @section ssim
  13620. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13621. This filter takes in input two input videos, the first input is
  13622. considered the "main" source and is passed unchanged to the
  13623. output. The second input is used as a "reference" video for computing
  13624. the SSIM.
  13625. Both video inputs must have the same resolution and pixel format for
  13626. this filter to work correctly. Also it assumes that both inputs
  13627. have the same number of frames, which are compared one by one.
  13628. The filter stores the calculated SSIM of each frame.
  13629. The description of the accepted parameters follows.
  13630. @table @option
  13631. @item stats_file, f
  13632. If specified the filter will use the named file to save the SSIM of
  13633. each individual frame. When filename equals "-" the data is sent to
  13634. standard output.
  13635. @end table
  13636. The file printed if @var{stats_file} is selected, contains a sequence of
  13637. key/value pairs of the form @var{key}:@var{value} for each compared
  13638. couple of frames.
  13639. A description of each shown parameter follows:
  13640. @table @option
  13641. @item n
  13642. sequential number of the input frame, starting from 1
  13643. @item Y, U, V, R, G, B
  13644. SSIM of the compared frames for the component specified by the suffix.
  13645. @item All
  13646. SSIM of the compared frames for the whole frame.
  13647. @item dB
  13648. Same as above but in dB representation.
  13649. @end table
  13650. This filter also supports the @ref{framesync} options.
  13651. @subsection Examples
  13652. @itemize
  13653. @item
  13654. For example:
  13655. @example
  13656. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13657. [main][ref] ssim="stats_file=stats.log" [out]
  13658. @end example
  13659. On this example the input file being processed is compared with the
  13660. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13661. is stored in @file{stats.log}.
  13662. @item
  13663. Another example with both psnr and ssim at same time:
  13664. @example
  13665. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13666. @end example
  13667. @item
  13668. Another example with different containers:
  13669. @example
  13670. 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 -
  13671. @end example
  13672. @end itemize
  13673. @section stereo3d
  13674. Convert between different stereoscopic image formats.
  13675. The filters accept the following options:
  13676. @table @option
  13677. @item in
  13678. Set stereoscopic image format of input.
  13679. Available values for input image formats are:
  13680. @table @samp
  13681. @item sbsl
  13682. side by side parallel (left eye left, right eye right)
  13683. @item sbsr
  13684. side by side crosseye (right eye left, left eye right)
  13685. @item sbs2l
  13686. side by side parallel with half width resolution
  13687. (left eye left, right eye right)
  13688. @item sbs2r
  13689. side by side crosseye with half width resolution
  13690. (right eye left, left eye right)
  13691. @item abl
  13692. @item tbl
  13693. above-below (left eye above, right eye below)
  13694. @item abr
  13695. @item tbr
  13696. above-below (right eye above, left eye below)
  13697. @item ab2l
  13698. @item tb2l
  13699. above-below with half height resolution
  13700. (left eye above, right eye below)
  13701. @item ab2r
  13702. @item tb2r
  13703. above-below with half height resolution
  13704. (right eye above, left eye below)
  13705. @item al
  13706. alternating frames (left eye first, right eye second)
  13707. @item ar
  13708. alternating frames (right eye first, left eye second)
  13709. @item irl
  13710. interleaved rows (left eye has top row, right eye starts on next row)
  13711. @item irr
  13712. interleaved rows (right eye has top row, left eye starts on next row)
  13713. @item icl
  13714. interleaved columns, left eye first
  13715. @item icr
  13716. interleaved columns, right eye first
  13717. Default value is @samp{sbsl}.
  13718. @end table
  13719. @item out
  13720. Set stereoscopic image format of output.
  13721. @table @samp
  13722. @item sbsl
  13723. side by side parallel (left eye left, right eye right)
  13724. @item sbsr
  13725. side by side crosseye (right eye left, left eye right)
  13726. @item sbs2l
  13727. side by side parallel with half width resolution
  13728. (left eye left, right eye right)
  13729. @item sbs2r
  13730. side by side crosseye with half width resolution
  13731. (right eye left, left eye right)
  13732. @item abl
  13733. @item tbl
  13734. above-below (left eye above, right eye below)
  13735. @item abr
  13736. @item tbr
  13737. above-below (right eye above, left eye below)
  13738. @item ab2l
  13739. @item tb2l
  13740. above-below with half height resolution
  13741. (left eye above, right eye below)
  13742. @item ab2r
  13743. @item tb2r
  13744. above-below with half height resolution
  13745. (right eye above, left eye below)
  13746. @item al
  13747. alternating frames (left eye first, right eye second)
  13748. @item ar
  13749. alternating frames (right eye first, left eye second)
  13750. @item irl
  13751. interleaved rows (left eye has top row, right eye starts on next row)
  13752. @item irr
  13753. interleaved rows (right eye has top row, left eye starts on next row)
  13754. @item arbg
  13755. anaglyph red/blue gray
  13756. (red filter on left eye, blue filter on right eye)
  13757. @item argg
  13758. anaglyph red/green gray
  13759. (red filter on left eye, green filter on right eye)
  13760. @item arcg
  13761. anaglyph red/cyan gray
  13762. (red filter on left eye, cyan filter on right eye)
  13763. @item arch
  13764. anaglyph red/cyan half colored
  13765. (red filter on left eye, cyan filter on right eye)
  13766. @item arcc
  13767. anaglyph red/cyan color
  13768. (red filter on left eye, cyan filter on right eye)
  13769. @item arcd
  13770. anaglyph red/cyan color optimized with the least squares projection of dubois
  13771. (red filter on left eye, cyan filter on right eye)
  13772. @item agmg
  13773. anaglyph green/magenta gray
  13774. (green filter on left eye, magenta filter on right eye)
  13775. @item agmh
  13776. anaglyph green/magenta half colored
  13777. (green filter on left eye, magenta filter on right eye)
  13778. @item agmc
  13779. anaglyph green/magenta colored
  13780. (green filter on left eye, magenta filter on right eye)
  13781. @item agmd
  13782. anaglyph green/magenta color optimized with the least squares projection of dubois
  13783. (green filter on left eye, magenta filter on right eye)
  13784. @item aybg
  13785. anaglyph yellow/blue gray
  13786. (yellow filter on left eye, blue filter on right eye)
  13787. @item aybh
  13788. anaglyph yellow/blue half colored
  13789. (yellow filter on left eye, blue filter on right eye)
  13790. @item aybc
  13791. anaglyph yellow/blue colored
  13792. (yellow filter on left eye, blue filter on right eye)
  13793. @item aybd
  13794. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13795. (yellow filter on left eye, blue filter on right eye)
  13796. @item ml
  13797. mono output (left eye only)
  13798. @item mr
  13799. mono output (right eye only)
  13800. @item chl
  13801. checkerboard, left eye first
  13802. @item chr
  13803. checkerboard, right eye first
  13804. @item icl
  13805. interleaved columns, left eye first
  13806. @item icr
  13807. interleaved columns, right eye first
  13808. @item hdmi
  13809. HDMI frame pack
  13810. @end table
  13811. Default value is @samp{arcd}.
  13812. @end table
  13813. @subsection Examples
  13814. @itemize
  13815. @item
  13816. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13817. @example
  13818. stereo3d=sbsl:aybd
  13819. @end example
  13820. @item
  13821. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13822. @example
  13823. stereo3d=abl:sbsr
  13824. @end example
  13825. @end itemize
  13826. @section streamselect, astreamselect
  13827. Select video or audio streams.
  13828. The filter accepts the following options:
  13829. @table @option
  13830. @item inputs
  13831. Set number of inputs. Default is 2.
  13832. @item map
  13833. Set input indexes to remap to outputs.
  13834. @end table
  13835. @subsection Commands
  13836. The @code{streamselect} and @code{astreamselect} filter supports the following
  13837. commands:
  13838. @table @option
  13839. @item map
  13840. Set input indexes to remap to outputs.
  13841. @end table
  13842. @subsection Examples
  13843. @itemize
  13844. @item
  13845. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13846. @example
  13847. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13848. @end example
  13849. @item
  13850. Same as above, but for audio:
  13851. @example
  13852. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13853. @end example
  13854. @end itemize
  13855. @anchor{subtitles}
  13856. @section subtitles
  13857. Draw subtitles on top of input video using the libass library.
  13858. To enable compilation of this filter you need to configure FFmpeg with
  13859. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13860. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13861. Alpha) subtitles format.
  13862. The filter accepts the following options:
  13863. @table @option
  13864. @item filename, f
  13865. Set the filename of the subtitle file to read. It must be specified.
  13866. @item original_size
  13867. Specify the size of the original video, the video for which the ASS file
  13868. was composed. For the syntax of this option, check the
  13869. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13870. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13871. correctly scale the fonts if the aspect ratio has been changed.
  13872. @item fontsdir
  13873. Set a directory path containing fonts that can be used by the filter.
  13874. These fonts will be used in addition to whatever the font provider uses.
  13875. @item alpha
  13876. Process alpha channel, by default alpha channel is untouched.
  13877. @item charenc
  13878. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13879. useful if not UTF-8.
  13880. @item stream_index, si
  13881. Set subtitles stream index. @code{subtitles} filter only.
  13882. @item force_style
  13883. Override default style or script info parameters of the subtitles. It accepts a
  13884. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13885. @end table
  13886. If the first key is not specified, it is assumed that the first value
  13887. specifies the @option{filename}.
  13888. For example, to render the file @file{sub.srt} on top of the input
  13889. video, use the command:
  13890. @example
  13891. subtitles=sub.srt
  13892. @end example
  13893. which is equivalent to:
  13894. @example
  13895. subtitles=filename=sub.srt
  13896. @end example
  13897. To render the default subtitles stream from file @file{video.mkv}, use:
  13898. @example
  13899. subtitles=video.mkv
  13900. @end example
  13901. To render the second subtitles stream from that file, use:
  13902. @example
  13903. subtitles=video.mkv:si=1
  13904. @end example
  13905. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13906. @code{DejaVu Serif}, use:
  13907. @example
  13908. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13909. @end example
  13910. @section super2xsai
  13911. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13912. Interpolate) pixel art scaling algorithm.
  13913. Useful for enlarging pixel art images without reducing sharpness.
  13914. @section swaprect
  13915. Swap two rectangular objects in video.
  13916. This filter accepts the following options:
  13917. @table @option
  13918. @item w
  13919. Set object width.
  13920. @item h
  13921. Set object height.
  13922. @item x1
  13923. Set 1st rect x coordinate.
  13924. @item y1
  13925. Set 1st rect y coordinate.
  13926. @item x2
  13927. Set 2nd rect x coordinate.
  13928. @item y2
  13929. Set 2nd rect y coordinate.
  13930. All expressions are evaluated once for each frame.
  13931. @end table
  13932. The all options are expressions containing the following constants:
  13933. @table @option
  13934. @item w
  13935. @item h
  13936. The input width and height.
  13937. @item a
  13938. same as @var{w} / @var{h}
  13939. @item sar
  13940. input sample aspect ratio
  13941. @item dar
  13942. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13943. @item n
  13944. The number of the input frame, starting from 0.
  13945. @item t
  13946. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13947. @item pos
  13948. the position in the file of the input frame, NAN if unknown
  13949. @end table
  13950. @section swapuv
  13951. Swap U & V plane.
  13952. @section tblend
  13953. Blend successive video frames.
  13954. See @ref{blend}
  13955. @section telecine
  13956. Apply telecine process to the video.
  13957. This filter accepts the following options:
  13958. @table @option
  13959. @item first_field
  13960. @table @samp
  13961. @item top, t
  13962. top field first
  13963. @item bottom, b
  13964. bottom field first
  13965. The default value is @code{top}.
  13966. @end table
  13967. @item pattern
  13968. A string of numbers representing the pulldown pattern you wish to apply.
  13969. The default value is @code{23}.
  13970. @end table
  13971. @example
  13972. Some typical patterns:
  13973. NTSC output (30i):
  13974. 27.5p: 32222
  13975. 24p: 23 (classic)
  13976. 24p: 2332 (preferred)
  13977. 20p: 33
  13978. 18p: 334
  13979. 16p: 3444
  13980. PAL output (25i):
  13981. 27.5p: 12222
  13982. 24p: 222222222223 ("Euro pulldown")
  13983. 16.67p: 33
  13984. 16p: 33333334
  13985. @end example
  13986. @section thistogram
  13987. Compute and draw a color distribution histogram for the input video across time.
  13988. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13989. at certain time, this filter shows also past histograms of number of frames defined
  13990. by @code{width} option.
  13991. The computed histogram is a representation of the color component
  13992. distribution in an image.
  13993. The filter accepts the following options:
  13994. @table @option
  13995. @item width, w
  13996. Set width of single color component output. Default value is @code{0}.
  13997. Value of @code{0} means width will be picked from input video.
  13998. This also set number of passed histograms to keep.
  13999. Allowed range is [0, 8192].
  14000. @item display_mode, d
  14001. Set display mode.
  14002. It accepts the following values:
  14003. @table @samp
  14004. @item stack
  14005. Per color component graphs are placed below each other.
  14006. @item parade
  14007. Per color component graphs are placed side by side.
  14008. @item overlay
  14009. Presents information identical to that in the @code{parade}, except
  14010. that the graphs representing color components are superimposed directly
  14011. over one another.
  14012. @end table
  14013. Default is @code{stack}.
  14014. @item levels_mode, m
  14015. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  14016. Default is @code{linear}.
  14017. @item components, c
  14018. Set what color components to display.
  14019. Default is @code{7}.
  14020. @item bgopacity, b
  14021. Set background opacity. Default is @code{0.9}.
  14022. @item envelope, e
  14023. Show envelope. Default is disabled.
  14024. @item ecolor, ec
  14025. Set envelope color. Default is @code{gold}.
  14026. @item slide
  14027. Set slide mode.
  14028. Available values for slide is:
  14029. @table @samp
  14030. @item frame
  14031. Draw new frame when right border is reached.
  14032. @item replace
  14033. Replace old columns with new ones.
  14034. @item scroll
  14035. Scroll from right to left.
  14036. @item rscroll
  14037. Scroll from left to right.
  14038. @item picture
  14039. Draw single picture.
  14040. @end table
  14041. Default is @code{replace}.
  14042. @end table
  14043. @section threshold
  14044. Apply threshold effect to video stream.
  14045. This filter needs four video streams to perform thresholding.
  14046. First stream is stream we are filtering.
  14047. Second stream is holding threshold values, third stream is holding min values,
  14048. and last, fourth stream is holding max values.
  14049. The filter accepts the following option:
  14050. @table @option
  14051. @item planes
  14052. Set which planes will be processed, unprocessed planes will be copied.
  14053. By default value 0xf, all planes will be processed.
  14054. @end table
  14055. For example if first stream pixel's component value is less then threshold value
  14056. of pixel component from 2nd threshold stream, third stream value will picked,
  14057. otherwise fourth stream pixel component value will be picked.
  14058. Using color source filter one can perform various types of thresholding:
  14059. @subsection Examples
  14060. @itemize
  14061. @item
  14062. Binary threshold, using gray color as threshold:
  14063. @example
  14064. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  14065. @end example
  14066. @item
  14067. Inverted binary threshold, using gray color as threshold:
  14068. @example
  14069. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  14070. @end example
  14071. @item
  14072. Truncate binary threshold, using gray color as threshold:
  14073. @example
  14074. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14075. @end example
  14076. @item
  14077. Threshold to zero, using gray color as threshold:
  14078. @example
  14079. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14080. @end example
  14081. @item
  14082. Inverted threshold to zero, using gray color as threshold:
  14083. @example
  14084. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14085. @end example
  14086. @end itemize
  14087. @section thumbnail
  14088. Select the most representative frame in a given sequence of consecutive frames.
  14089. The filter accepts the following options:
  14090. @table @option
  14091. @item n
  14092. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14093. will pick one of them, and then handle the next batch of @var{n} frames until
  14094. the end. Default is @code{100}.
  14095. @end table
  14096. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14097. value will result in a higher memory usage, so a high value is not recommended.
  14098. @subsection Examples
  14099. @itemize
  14100. @item
  14101. Extract one picture each 50 frames:
  14102. @example
  14103. thumbnail=50
  14104. @end example
  14105. @item
  14106. Complete example of a thumbnail creation with @command{ffmpeg}:
  14107. @example
  14108. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14109. @end example
  14110. @end itemize
  14111. @anchor{tile}
  14112. @section tile
  14113. Tile several successive frames together.
  14114. The @ref{untile} filter can do the reverse.
  14115. The filter accepts the following options:
  14116. @table @option
  14117. @item layout
  14118. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14119. this option, check the
  14120. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14121. @item nb_frames
  14122. Set the maximum number of frames to render in the given area. It must be less
  14123. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14124. the area will be used.
  14125. @item margin
  14126. Set the outer border margin in pixels.
  14127. @item padding
  14128. Set the inner border thickness (i.e. the number of pixels between frames). For
  14129. more advanced padding options (such as having different values for the edges),
  14130. refer to the pad video filter.
  14131. @item color
  14132. Specify the color of the unused area. For the syntax of this option, check the
  14133. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14134. The default value of @var{color} is "black".
  14135. @item overlap
  14136. Set the number of frames to overlap when tiling several successive frames together.
  14137. The value must be between @code{0} and @var{nb_frames - 1}.
  14138. @item init_padding
  14139. Set the number of frames to initially be empty before displaying first output frame.
  14140. This controls how soon will one get first output frame.
  14141. The value must be between @code{0} and @var{nb_frames - 1}.
  14142. @end table
  14143. @subsection Examples
  14144. @itemize
  14145. @item
  14146. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14147. @example
  14148. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14149. @end example
  14150. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14151. duplicating each output frame to accommodate the originally detected frame
  14152. rate.
  14153. @item
  14154. Display @code{5} pictures in an area of @code{3x2} frames,
  14155. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14156. mixed flat and named options:
  14157. @example
  14158. tile=3x2:nb_frames=5:padding=7:margin=2
  14159. @end example
  14160. @end itemize
  14161. @section tinterlace
  14162. Perform various types of temporal field interlacing.
  14163. Frames are counted starting from 1, so the first input frame is
  14164. considered odd.
  14165. The filter accepts the following options:
  14166. @table @option
  14167. @item mode
  14168. Specify the mode of the interlacing. This option can also be specified
  14169. as a value alone. See below for a list of values for this option.
  14170. Available values are:
  14171. @table @samp
  14172. @item merge, 0
  14173. Move odd frames into the upper field, even into the lower field,
  14174. generating a double height frame at half frame rate.
  14175. @example
  14176. ------> time
  14177. Input:
  14178. Frame 1 Frame 2 Frame 3 Frame 4
  14179. 11111 22222 33333 44444
  14180. 11111 22222 33333 44444
  14181. 11111 22222 33333 44444
  14182. 11111 22222 33333 44444
  14183. Output:
  14184. 11111 33333
  14185. 22222 44444
  14186. 11111 33333
  14187. 22222 44444
  14188. 11111 33333
  14189. 22222 44444
  14190. 11111 33333
  14191. 22222 44444
  14192. @end example
  14193. @item drop_even, 1
  14194. Only output odd frames, even frames are dropped, generating a frame with
  14195. unchanged height at half frame rate.
  14196. @example
  14197. ------> time
  14198. Input:
  14199. Frame 1 Frame 2 Frame 3 Frame 4
  14200. 11111 22222 33333 44444
  14201. 11111 22222 33333 44444
  14202. 11111 22222 33333 44444
  14203. 11111 22222 33333 44444
  14204. Output:
  14205. 11111 33333
  14206. 11111 33333
  14207. 11111 33333
  14208. 11111 33333
  14209. @end example
  14210. @item drop_odd, 2
  14211. Only output even frames, odd frames are dropped, generating a frame with
  14212. unchanged height at half frame rate.
  14213. @example
  14214. ------> time
  14215. Input:
  14216. Frame 1 Frame 2 Frame 3 Frame 4
  14217. 11111 22222 33333 44444
  14218. 11111 22222 33333 44444
  14219. 11111 22222 33333 44444
  14220. 11111 22222 33333 44444
  14221. Output:
  14222. 22222 44444
  14223. 22222 44444
  14224. 22222 44444
  14225. 22222 44444
  14226. @end example
  14227. @item pad, 3
  14228. Expand each frame to full height, but pad alternate lines with black,
  14229. generating a frame with double height at the same input frame rate.
  14230. @example
  14231. ------> time
  14232. Input:
  14233. Frame 1 Frame 2 Frame 3 Frame 4
  14234. 11111 22222 33333 44444
  14235. 11111 22222 33333 44444
  14236. 11111 22222 33333 44444
  14237. 11111 22222 33333 44444
  14238. Output:
  14239. 11111 ..... 33333 .....
  14240. ..... 22222 ..... 44444
  14241. 11111 ..... 33333 .....
  14242. ..... 22222 ..... 44444
  14243. 11111 ..... 33333 .....
  14244. ..... 22222 ..... 44444
  14245. 11111 ..... 33333 .....
  14246. ..... 22222 ..... 44444
  14247. @end example
  14248. @item interleave_top, 4
  14249. Interleave the upper field from odd frames with the lower field from
  14250. even frames, generating a frame with unchanged height at half frame rate.
  14251. @example
  14252. ------> time
  14253. Input:
  14254. Frame 1 Frame 2 Frame 3 Frame 4
  14255. 11111<- 22222 33333<- 44444
  14256. 11111 22222<- 33333 44444<-
  14257. 11111<- 22222 33333<- 44444
  14258. 11111 22222<- 33333 44444<-
  14259. Output:
  14260. 11111 33333
  14261. 22222 44444
  14262. 11111 33333
  14263. 22222 44444
  14264. @end example
  14265. @item interleave_bottom, 5
  14266. Interleave the lower field from odd frames with the upper field from
  14267. even frames, generating a frame with unchanged height at half frame rate.
  14268. @example
  14269. ------> time
  14270. Input:
  14271. Frame 1 Frame 2 Frame 3 Frame 4
  14272. 11111 22222<- 33333 44444<-
  14273. 11111<- 22222 33333<- 44444
  14274. 11111 22222<- 33333 44444<-
  14275. 11111<- 22222 33333<- 44444
  14276. Output:
  14277. 22222 44444
  14278. 11111 33333
  14279. 22222 44444
  14280. 11111 33333
  14281. @end example
  14282. @item interlacex2, 6
  14283. Double frame rate with unchanged height. Frames are inserted each
  14284. containing the second temporal field from the previous input frame and
  14285. the first temporal field from the next input frame. This mode relies on
  14286. the top_field_first flag. Useful for interlaced video displays with no
  14287. field synchronisation.
  14288. @example
  14289. ------> time
  14290. Input:
  14291. Frame 1 Frame 2 Frame 3 Frame 4
  14292. 11111 22222 33333 44444
  14293. 11111 22222 33333 44444
  14294. 11111 22222 33333 44444
  14295. 11111 22222 33333 44444
  14296. Output:
  14297. 11111 22222 22222 33333 33333 44444 44444
  14298. 11111 11111 22222 22222 33333 33333 44444
  14299. 11111 22222 22222 33333 33333 44444 44444
  14300. 11111 11111 22222 22222 33333 33333 44444
  14301. @end example
  14302. @item mergex2, 7
  14303. Move odd frames into the upper field, even into the lower field,
  14304. generating a double height frame at same frame rate.
  14305. @example
  14306. ------> time
  14307. Input:
  14308. Frame 1 Frame 2 Frame 3 Frame 4
  14309. 11111 22222 33333 44444
  14310. 11111 22222 33333 44444
  14311. 11111 22222 33333 44444
  14312. 11111 22222 33333 44444
  14313. Output:
  14314. 11111 33333 33333 55555
  14315. 22222 22222 44444 44444
  14316. 11111 33333 33333 55555
  14317. 22222 22222 44444 44444
  14318. 11111 33333 33333 55555
  14319. 22222 22222 44444 44444
  14320. 11111 33333 33333 55555
  14321. 22222 22222 44444 44444
  14322. @end example
  14323. @end table
  14324. Numeric values are deprecated but are accepted for backward
  14325. compatibility reasons.
  14326. Default mode is @code{merge}.
  14327. @item flags
  14328. Specify flags influencing the filter process.
  14329. Available value for @var{flags} is:
  14330. @table @option
  14331. @item low_pass_filter, vlpf
  14332. Enable linear vertical low-pass filtering in the filter.
  14333. Vertical low-pass filtering is required when creating an interlaced
  14334. destination from a progressive source which contains high-frequency
  14335. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14336. patterning.
  14337. @item complex_filter, cvlpf
  14338. Enable complex vertical low-pass filtering.
  14339. This will slightly less reduce interlace 'twitter' and Moire
  14340. patterning but better retain detail and subjective sharpness impression.
  14341. @item bypass_il
  14342. Bypass already interlaced frames, only adjust the frame rate.
  14343. @end table
  14344. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14345. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14346. @end table
  14347. @section tmedian
  14348. Pick median pixels from several successive input video frames.
  14349. The filter accepts the following options:
  14350. @table @option
  14351. @item radius
  14352. Set radius of median filter.
  14353. Default is 1. Allowed range is from 1 to 127.
  14354. @item planes
  14355. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14356. @item percentile
  14357. Set median percentile. Default value is @code{0.5}.
  14358. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14359. minimum values, and @code{1} maximum values.
  14360. @end table
  14361. @section tmix
  14362. Mix successive video frames.
  14363. A description of the accepted options follows.
  14364. @table @option
  14365. @item frames
  14366. The number of successive frames to mix. If unspecified, it defaults to 3.
  14367. @item weights
  14368. Specify weight of each input video frame.
  14369. Each weight is separated by space. If number of weights is smaller than
  14370. number of @var{frames} last specified weight will be used for all remaining
  14371. unset weights.
  14372. @item scale
  14373. Specify scale, if it is set it will be multiplied with sum
  14374. of each weight multiplied with pixel values to give final destination
  14375. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14376. @end table
  14377. @subsection Examples
  14378. @itemize
  14379. @item
  14380. Average 7 successive frames:
  14381. @example
  14382. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14383. @end example
  14384. @item
  14385. Apply simple temporal convolution:
  14386. @example
  14387. tmix=frames=3:weights="-1 3 -1"
  14388. @end example
  14389. @item
  14390. Similar as above but only showing temporal differences:
  14391. @example
  14392. tmix=frames=3:weights="-1 2 -1":scale=1
  14393. @end example
  14394. @end itemize
  14395. @anchor{tonemap}
  14396. @section tonemap
  14397. Tone map colors from different dynamic ranges.
  14398. This filter expects data in single precision floating point, as it needs to
  14399. operate on (and can output) out-of-range values. Another filter, such as
  14400. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14401. The tonemapping algorithms implemented only work on linear light, so input
  14402. data should be linearized beforehand (and possibly correctly tagged).
  14403. @example
  14404. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14405. @end example
  14406. @subsection Options
  14407. The filter accepts the following options.
  14408. @table @option
  14409. @item tonemap
  14410. Set the tone map algorithm to use.
  14411. Possible values are:
  14412. @table @var
  14413. @item none
  14414. Do not apply any tone map, only desaturate overbright pixels.
  14415. @item clip
  14416. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14417. in-range values, while distorting out-of-range values.
  14418. @item linear
  14419. Stretch the entire reference gamut to a linear multiple of the display.
  14420. @item gamma
  14421. Fit a logarithmic transfer between the tone curves.
  14422. @item reinhard
  14423. Preserve overall image brightness with a simple curve, using nonlinear
  14424. contrast, which results in flattening details and degrading color accuracy.
  14425. @item hable
  14426. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14427. of slightly darkening everything. Use it when detail preservation is more
  14428. important than color and brightness accuracy.
  14429. @item mobius
  14430. Smoothly map out-of-range values, while retaining contrast and colors for
  14431. in-range material as much as possible. Use it when color accuracy is more
  14432. important than detail preservation.
  14433. @end table
  14434. Default is none.
  14435. @item param
  14436. Tune the tone mapping algorithm.
  14437. This affects the following algorithms:
  14438. @table @var
  14439. @item none
  14440. Ignored.
  14441. @item linear
  14442. Specifies the scale factor to use while stretching.
  14443. Default to 1.0.
  14444. @item gamma
  14445. Specifies the exponent of the function.
  14446. Default to 1.8.
  14447. @item clip
  14448. Specify an extra linear coefficient to multiply into the signal before clipping.
  14449. Default to 1.0.
  14450. @item reinhard
  14451. Specify the local contrast coefficient at the display peak.
  14452. Default to 0.5, which means that in-gamut values will be about half as bright
  14453. as when clipping.
  14454. @item hable
  14455. Ignored.
  14456. @item mobius
  14457. Specify the transition point from linear to mobius transform. Every value
  14458. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14459. more accurate the result will be, at the cost of losing bright details.
  14460. Default to 0.3, which due to the steep initial slope still preserves in-range
  14461. colors fairly accurately.
  14462. @end table
  14463. @item desat
  14464. Apply desaturation for highlights that exceed this level of brightness. The
  14465. higher the parameter, the more color information will be preserved. This
  14466. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14467. (smoothly) turning into white instead. This makes images feel more natural,
  14468. at the cost of reducing information about out-of-range colors.
  14469. The default of 2.0 is somewhat conservative and will mostly just apply to
  14470. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14471. This option works only if the input frame has a supported color tag.
  14472. @item peak
  14473. Override signal/nominal/reference peak with this value. Useful when the
  14474. embedded peak information in display metadata is not reliable or when tone
  14475. mapping from a lower range to a higher range.
  14476. @end table
  14477. @section tpad
  14478. Temporarily pad video frames.
  14479. The filter accepts the following options:
  14480. @table @option
  14481. @item start
  14482. Specify number of delay frames before input video stream. Default is 0.
  14483. @item stop
  14484. Specify number of padding frames after input video stream.
  14485. Set to -1 to pad indefinitely. Default is 0.
  14486. @item start_mode
  14487. Set kind of frames added to beginning of stream.
  14488. Can be either @var{add} or @var{clone}.
  14489. With @var{add} frames of solid-color are added.
  14490. With @var{clone} frames are clones of first frame.
  14491. Default is @var{add}.
  14492. @item stop_mode
  14493. Set kind of frames added to end of stream.
  14494. Can be either @var{add} or @var{clone}.
  14495. With @var{add} frames of solid-color are added.
  14496. With @var{clone} frames are clones of last frame.
  14497. Default is @var{add}.
  14498. @item start_duration, stop_duration
  14499. Specify the duration of the start/stop delay. See
  14500. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14501. for the accepted syntax.
  14502. These options override @var{start} and @var{stop}. Default is 0.
  14503. @item color
  14504. Specify the color of the padded area. For the syntax of this option,
  14505. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14506. manual,ffmpeg-utils}.
  14507. The default value of @var{color} is "black".
  14508. @end table
  14509. @anchor{transpose}
  14510. @section transpose
  14511. Transpose rows with columns in the input video and optionally flip it.
  14512. It accepts the following parameters:
  14513. @table @option
  14514. @item dir
  14515. Specify the transposition direction.
  14516. Can assume the following values:
  14517. @table @samp
  14518. @item 0, 4, cclock_flip
  14519. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14520. @example
  14521. L.R L.l
  14522. . . -> . .
  14523. l.r R.r
  14524. @end example
  14525. @item 1, 5, clock
  14526. Rotate by 90 degrees clockwise, that is:
  14527. @example
  14528. L.R l.L
  14529. . . -> . .
  14530. l.r r.R
  14531. @end example
  14532. @item 2, 6, cclock
  14533. Rotate by 90 degrees counterclockwise, that is:
  14534. @example
  14535. L.R R.r
  14536. . . -> . .
  14537. l.r L.l
  14538. @end example
  14539. @item 3, 7, clock_flip
  14540. Rotate by 90 degrees clockwise and vertically flip, that is:
  14541. @example
  14542. L.R r.R
  14543. . . -> . .
  14544. l.r l.L
  14545. @end example
  14546. @end table
  14547. For values between 4-7, the transposition is only done if the input
  14548. video geometry is portrait and not landscape. These values are
  14549. deprecated, the @code{passthrough} option should be used instead.
  14550. Numerical values are deprecated, and should be dropped in favor of
  14551. symbolic constants.
  14552. @item passthrough
  14553. Do not apply the transposition if the input geometry matches the one
  14554. specified by the specified value. It accepts the following values:
  14555. @table @samp
  14556. @item none
  14557. Always apply transposition.
  14558. @item portrait
  14559. Preserve portrait geometry (when @var{height} >= @var{width}).
  14560. @item landscape
  14561. Preserve landscape geometry (when @var{width} >= @var{height}).
  14562. @end table
  14563. Default value is @code{none}.
  14564. @end table
  14565. For example to rotate by 90 degrees clockwise and preserve portrait
  14566. layout:
  14567. @example
  14568. transpose=dir=1:passthrough=portrait
  14569. @end example
  14570. The command above can also be specified as:
  14571. @example
  14572. transpose=1:portrait
  14573. @end example
  14574. @section transpose_npp
  14575. Transpose rows with columns in the input video and optionally flip it.
  14576. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14577. It accepts the following parameters:
  14578. @table @option
  14579. @item dir
  14580. Specify the transposition direction.
  14581. Can assume the following values:
  14582. @table @samp
  14583. @item cclock_flip
  14584. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14585. @item clock
  14586. Rotate by 90 degrees clockwise.
  14587. @item cclock
  14588. Rotate by 90 degrees counterclockwise.
  14589. @item clock_flip
  14590. Rotate by 90 degrees clockwise and vertically flip.
  14591. @end table
  14592. @item passthrough
  14593. Do not apply the transposition if the input geometry matches the one
  14594. specified by the specified value. It accepts the following values:
  14595. @table @samp
  14596. @item none
  14597. Always apply transposition. (default)
  14598. @item portrait
  14599. Preserve portrait geometry (when @var{height} >= @var{width}).
  14600. @item landscape
  14601. Preserve landscape geometry (when @var{width} >= @var{height}).
  14602. @end table
  14603. @end table
  14604. @section trim
  14605. Trim the input so that the output contains one continuous subpart of the input.
  14606. It accepts the following parameters:
  14607. @table @option
  14608. @item start
  14609. Specify the time of the start of the kept section, i.e. the frame with the
  14610. timestamp @var{start} will be the first frame in the output.
  14611. @item end
  14612. Specify the time of the first frame that will be dropped, i.e. the frame
  14613. immediately preceding the one with the timestamp @var{end} will be the last
  14614. frame in the output.
  14615. @item start_pts
  14616. This is the same as @var{start}, except this option sets the start timestamp
  14617. in timebase units instead of seconds.
  14618. @item end_pts
  14619. This is the same as @var{end}, except this option sets the end timestamp
  14620. in timebase units instead of seconds.
  14621. @item duration
  14622. The maximum duration of the output in seconds.
  14623. @item start_frame
  14624. The number of the first frame that should be passed to the output.
  14625. @item end_frame
  14626. The number of the first frame that should be dropped.
  14627. @end table
  14628. @option{start}, @option{end}, and @option{duration} are expressed as time
  14629. duration specifications; see
  14630. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14631. for the accepted syntax.
  14632. Note that the first two sets of the start/end options and the @option{duration}
  14633. option look at the frame timestamp, while the _frame variants simply count the
  14634. frames that pass through the filter. Also note that this filter does not modify
  14635. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14636. setpts filter after the trim filter.
  14637. If multiple start or end options are set, this filter tries to be greedy and
  14638. keep all the frames that match at least one of the specified constraints. To keep
  14639. only the part that matches all the constraints at once, chain multiple trim
  14640. filters.
  14641. The defaults are such that all the input is kept. So it is possible to set e.g.
  14642. just the end values to keep everything before the specified time.
  14643. Examples:
  14644. @itemize
  14645. @item
  14646. Drop everything except the second minute of input:
  14647. @example
  14648. ffmpeg -i INPUT -vf trim=60:120
  14649. @end example
  14650. @item
  14651. Keep only the first second:
  14652. @example
  14653. ffmpeg -i INPUT -vf trim=duration=1
  14654. @end example
  14655. @end itemize
  14656. @section unpremultiply
  14657. Apply alpha unpremultiply effect to input video stream using first plane
  14658. of second stream as alpha.
  14659. Both streams must have same dimensions and same pixel format.
  14660. The filter accepts the following option:
  14661. @table @option
  14662. @item planes
  14663. Set which planes will be processed, unprocessed planes will be copied.
  14664. By default value 0xf, all planes will be processed.
  14665. If the format has 1 or 2 components, then luma is bit 0.
  14666. If the format has 3 or 4 components:
  14667. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14668. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14669. If present, the alpha channel is always the last bit.
  14670. @item inplace
  14671. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14672. @end table
  14673. @anchor{unsharp}
  14674. @section unsharp
  14675. Sharpen or blur the input video.
  14676. It accepts the following parameters:
  14677. @table @option
  14678. @item luma_msize_x, lx
  14679. Set the luma matrix horizontal size. It must be an odd integer between
  14680. 3 and 23. The default value is 5.
  14681. @item luma_msize_y, ly
  14682. Set the luma matrix vertical size. It must be an odd integer between 3
  14683. and 23. The default value is 5.
  14684. @item luma_amount, la
  14685. Set the luma effect strength. It must be a floating point number, reasonable
  14686. values lay between -1.5 and 1.5.
  14687. Negative values will blur the input video, while positive values will
  14688. sharpen it, a value of zero will disable the effect.
  14689. Default value is 1.0.
  14690. @item chroma_msize_x, cx
  14691. Set the chroma matrix horizontal size. It must be an odd integer
  14692. between 3 and 23. The default value is 5.
  14693. @item chroma_msize_y, cy
  14694. Set the chroma matrix vertical size. It must be an odd integer
  14695. between 3 and 23. The default value is 5.
  14696. @item chroma_amount, ca
  14697. Set the chroma effect strength. It must be a floating point number, reasonable
  14698. values lay between -1.5 and 1.5.
  14699. Negative values will blur the input video, while positive values will
  14700. sharpen it, a value of zero will disable the effect.
  14701. Default value is 0.0.
  14702. @end table
  14703. All parameters are optional and default to the equivalent of the
  14704. string '5:5:1.0:5:5:0.0'.
  14705. @subsection Examples
  14706. @itemize
  14707. @item
  14708. Apply strong luma sharpen effect:
  14709. @example
  14710. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14711. @end example
  14712. @item
  14713. Apply a strong blur of both luma and chroma parameters:
  14714. @example
  14715. unsharp=7:7:-2:7:7:-2
  14716. @end example
  14717. @end itemize
  14718. @anchor{untile}
  14719. @section untile
  14720. Decompose a video made of tiled images into the individual images.
  14721. The frame rate of the output video is the frame rate of the input video
  14722. multiplied by the number of tiles.
  14723. This filter does the reverse of @ref{tile}.
  14724. The filter accepts the following options:
  14725. @table @option
  14726. @item layout
  14727. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14728. this option, check the
  14729. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14730. @end table
  14731. @subsection Examples
  14732. @itemize
  14733. @item
  14734. Produce a 1-second video from a still image file made of 25 frames stacked
  14735. vertically, like an analogic film reel:
  14736. @example
  14737. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  14738. @end example
  14739. @end itemize
  14740. @section uspp
  14741. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14742. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14743. shifts and average the results.
  14744. The way this differs from the behavior of spp is that uspp actually encodes &
  14745. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14746. DCT similar to MJPEG.
  14747. The filter accepts the following options:
  14748. @table @option
  14749. @item quality
  14750. Set quality. This option defines the number of levels for averaging. It accepts
  14751. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14752. effect. A value of @code{8} means the higher quality. For each increment of
  14753. that value the speed drops by a factor of approximately 2. Default value is
  14754. @code{3}.
  14755. @item qp
  14756. Force a constant quantization parameter. If not set, the filter will use the QP
  14757. from the video stream (if available).
  14758. @end table
  14759. @section v360
  14760. Convert 360 videos between various formats.
  14761. The filter accepts the following options:
  14762. @table @option
  14763. @item input
  14764. @item output
  14765. Set format of the input/output video.
  14766. Available formats:
  14767. @table @samp
  14768. @item e
  14769. @item equirect
  14770. Equirectangular projection.
  14771. @item c3x2
  14772. @item c6x1
  14773. @item c1x6
  14774. Cubemap with 3x2/6x1/1x6 layout.
  14775. Format specific options:
  14776. @table @option
  14777. @item in_pad
  14778. @item out_pad
  14779. Set padding proportion for the input/output cubemap. Values in decimals.
  14780. Example values:
  14781. @table @samp
  14782. @item 0
  14783. No padding.
  14784. @item 0.01
  14785. 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)
  14786. @end table
  14787. Default value is @b{@samp{0}}.
  14788. Maximum value is @b{@samp{0.1}}.
  14789. @item fin_pad
  14790. @item fout_pad
  14791. Set fixed padding for the input/output cubemap. Values in pixels.
  14792. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14793. @item in_forder
  14794. @item out_forder
  14795. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14796. Designation of directions:
  14797. @table @samp
  14798. @item r
  14799. right
  14800. @item l
  14801. left
  14802. @item u
  14803. up
  14804. @item d
  14805. down
  14806. @item f
  14807. forward
  14808. @item b
  14809. back
  14810. @end table
  14811. Default value is @b{@samp{rludfb}}.
  14812. @item in_frot
  14813. @item out_frot
  14814. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14815. Designation of angles:
  14816. @table @samp
  14817. @item 0
  14818. 0 degrees clockwise
  14819. @item 1
  14820. 90 degrees clockwise
  14821. @item 2
  14822. 180 degrees clockwise
  14823. @item 3
  14824. 270 degrees clockwise
  14825. @end table
  14826. Default value is @b{@samp{000000}}.
  14827. @end table
  14828. @item eac
  14829. Equi-Angular Cubemap.
  14830. @item flat
  14831. @item gnomonic
  14832. @item rectilinear
  14833. Regular video.
  14834. Format specific options:
  14835. @table @option
  14836. @item h_fov
  14837. @item v_fov
  14838. @item d_fov
  14839. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14840. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14841. @item ih_fov
  14842. @item iv_fov
  14843. @item id_fov
  14844. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14845. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14846. @end table
  14847. @item dfisheye
  14848. Dual fisheye.
  14849. Format specific options:
  14850. @table @option
  14851. @item h_fov
  14852. @item v_fov
  14853. @item d_fov
  14854. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14855. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14856. @item ih_fov
  14857. @item iv_fov
  14858. @item id_fov
  14859. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14860. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14861. @end table
  14862. @item barrel
  14863. @item fb
  14864. @item barrelsplit
  14865. Facebook's 360 formats.
  14866. @item sg
  14867. Stereographic format.
  14868. Format specific options:
  14869. @table @option
  14870. @item h_fov
  14871. @item v_fov
  14872. @item d_fov
  14873. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14874. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14875. @item ih_fov
  14876. @item iv_fov
  14877. @item id_fov
  14878. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14879. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14880. @end table
  14881. @item mercator
  14882. Mercator format.
  14883. @item ball
  14884. Ball format, gives significant distortion toward the back.
  14885. @item hammer
  14886. Hammer-Aitoff map projection format.
  14887. @item sinusoidal
  14888. Sinusoidal map projection format.
  14889. @item fisheye
  14890. Fisheye projection.
  14891. Format specific options:
  14892. @table @option
  14893. @item h_fov
  14894. @item v_fov
  14895. @item d_fov
  14896. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14897. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14898. @item ih_fov
  14899. @item iv_fov
  14900. @item id_fov
  14901. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14902. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14903. @end table
  14904. @item pannini
  14905. Pannini projection.
  14906. Format specific options:
  14907. @table @option
  14908. @item h_fov
  14909. Set output pannini parameter.
  14910. @item ih_fov
  14911. Set input pannini parameter.
  14912. @end table
  14913. @item cylindrical
  14914. Cylindrical projection.
  14915. Format specific options:
  14916. @table @option
  14917. @item h_fov
  14918. @item v_fov
  14919. @item d_fov
  14920. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14921. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14922. @item ih_fov
  14923. @item iv_fov
  14924. @item id_fov
  14925. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14926. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14927. @end table
  14928. @item perspective
  14929. Perspective projection. @i{(output only)}
  14930. Format specific options:
  14931. @table @option
  14932. @item v_fov
  14933. Set perspective parameter.
  14934. @end table
  14935. @item tetrahedron
  14936. Tetrahedron projection.
  14937. @item tsp
  14938. Truncated square pyramid projection.
  14939. @item he
  14940. @item hequirect
  14941. Half equirectangular projection.
  14942. @item equisolid
  14943. Equisolid format.
  14944. Format specific options:
  14945. @table @option
  14946. @item h_fov
  14947. @item v_fov
  14948. @item d_fov
  14949. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14950. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14951. @item ih_fov
  14952. @item iv_fov
  14953. @item id_fov
  14954. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14955. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14956. @end table
  14957. @item og
  14958. Orthographic format.
  14959. Format specific options:
  14960. @table @option
  14961. @item h_fov
  14962. @item v_fov
  14963. @item d_fov
  14964. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14965. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14966. @item ih_fov
  14967. @item iv_fov
  14968. @item id_fov
  14969. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14970. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14971. @end table
  14972. @item octahedron
  14973. Octahedron projection.
  14974. @end table
  14975. @item interp
  14976. Set interpolation method.@*
  14977. @i{Note: more complex interpolation methods require much more memory to run.}
  14978. Available methods:
  14979. @table @samp
  14980. @item near
  14981. @item nearest
  14982. Nearest neighbour.
  14983. @item line
  14984. @item linear
  14985. Bilinear interpolation.
  14986. @item lagrange9
  14987. Lagrange9 interpolation.
  14988. @item cube
  14989. @item cubic
  14990. Bicubic interpolation.
  14991. @item lanc
  14992. @item lanczos
  14993. Lanczos interpolation.
  14994. @item sp16
  14995. @item spline16
  14996. Spline16 interpolation.
  14997. @item gauss
  14998. @item gaussian
  14999. Gaussian interpolation.
  15000. @item mitchell
  15001. Mitchell interpolation.
  15002. @end table
  15003. Default value is @b{@samp{line}}.
  15004. @item w
  15005. @item h
  15006. Set the output video resolution.
  15007. Default resolution depends on formats.
  15008. @item in_stereo
  15009. @item out_stereo
  15010. Set the input/output stereo format.
  15011. @table @samp
  15012. @item 2d
  15013. 2D mono
  15014. @item sbs
  15015. Side by side
  15016. @item tb
  15017. Top bottom
  15018. @end table
  15019. Default value is @b{@samp{2d}} for input and output format.
  15020. @item yaw
  15021. @item pitch
  15022. @item roll
  15023. Set rotation for the output video. Values in degrees.
  15024. @item rorder
  15025. Set rotation order for the output video. Choose one item for each position.
  15026. @table @samp
  15027. @item y, Y
  15028. yaw
  15029. @item p, P
  15030. pitch
  15031. @item r, R
  15032. roll
  15033. @end table
  15034. Default value is @b{@samp{ypr}}.
  15035. @item h_flip
  15036. @item v_flip
  15037. @item d_flip
  15038. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  15039. @item ih_flip
  15040. @item iv_flip
  15041. Set if input video is flipped horizontally/vertically. Boolean values.
  15042. @item in_trans
  15043. Set if input video is transposed. Boolean value, by default disabled.
  15044. @item out_trans
  15045. Set if output video needs to be transposed. Boolean value, by default disabled.
  15046. @item alpha_mask
  15047. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  15048. @end table
  15049. @subsection Examples
  15050. @itemize
  15051. @item
  15052. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  15053. @example
  15054. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  15055. @end example
  15056. @item
  15057. Extract back view of Equi-Angular Cubemap:
  15058. @example
  15059. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  15060. @end example
  15061. @item
  15062. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  15063. @example
  15064. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  15065. @end example
  15066. @end itemize
  15067. @subsection Commands
  15068. This filter supports subset of above options as @ref{commands}.
  15069. @section vaguedenoiser
  15070. Apply a wavelet based denoiser.
  15071. It transforms each frame from the video input into the wavelet domain,
  15072. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15073. the obtained coefficients. It does an inverse wavelet transform after.
  15074. Due to wavelet properties, it should give a nice smoothed result, and
  15075. reduced noise, without blurring picture features.
  15076. This filter accepts the following options:
  15077. @table @option
  15078. @item threshold
  15079. The filtering strength. The higher, the more filtered the video will be.
  15080. Hard thresholding can use a higher threshold than soft thresholding
  15081. before the video looks overfiltered. Default value is 2.
  15082. @item method
  15083. The filtering method the filter will use.
  15084. It accepts the following values:
  15085. @table @samp
  15086. @item hard
  15087. All values under the threshold will be zeroed.
  15088. @item soft
  15089. All values under the threshold will be zeroed. All values above will be
  15090. reduced by the threshold.
  15091. @item garrote
  15092. Scales or nullifies coefficients - intermediary between (more) soft and
  15093. (less) hard thresholding.
  15094. @end table
  15095. Default is garrote.
  15096. @item nsteps
  15097. Number of times, the wavelet will decompose the picture. Picture can't
  15098. be decomposed beyond a particular point (typically, 8 for a 640x480
  15099. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15100. @item percent
  15101. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15102. @item planes
  15103. A list of the planes to process. By default all planes are processed.
  15104. @item type
  15105. The threshold type the filter will use.
  15106. It accepts the following values:
  15107. @table @samp
  15108. @item universal
  15109. Threshold used is same for all decompositions.
  15110. @item bayes
  15111. Threshold used depends also on each decomposition coefficients.
  15112. @end table
  15113. Default is universal.
  15114. @end table
  15115. @section vectorscope
  15116. Display 2 color component values in the two dimensional graph (which is called
  15117. a vectorscope).
  15118. This filter accepts the following options:
  15119. @table @option
  15120. @item mode, m
  15121. Set vectorscope mode.
  15122. It accepts the following values:
  15123. @table @samp
  15124. @item gray
  15125. @item tint
  15126. Gray values are displayed on graph, higher brightness means more pixels have
  15127. same component color value on location in graph. This is the default mode.
  15128. @item color
  15129. Gray values are displayed on graph. Surrounding pixels values which are not
  15130. present in video frame are drawn in gradient of 2 color components which are
  15131. set by option @code{x} and @code{y}. The 3rd color component is static.
  15132. @item color2
  15133. Actual color components values present in video frame are displayed on graph.
  15134. @item color3
  15135. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15136. on graph increases value of another color component, which is luminance by
  15137. default values of @code{x} and @code{y}.
  15138. @item color4
  15139. Actual colors present in video frame are displayed on graph. If two different
  15140. colors map to same position on graph then color with higher value of component
  15141. not present in graph is picked.
  15142. @item color5
  15143. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15144. component picked from radial gradient.
  15145. @end table
  15146. @item x
  15147. Set which color component will be represented on X-axis. Default is @code{1}.
  15148. @item y
  15149. Set which color component will be represented on Y-axis. Default is @code{2}.
  15150. @item intensity, i
  15151. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15152. of color component which represents frequency of (X, Y) location in graph.
  15153. @item envelope, e
  15154. @table @samp
  15155. @item none
  15156. No envelope, this is default.
  15157. @item instant
  15158. Instant envelope, even darkest single pixel will be clearly highlighted.
  15159. @item peak
  15160. Hold maximum and minimum values presented in graph over time. This way you
  15161. can still spot out of range values without constantly looking at vectorscope.
  15162. @item peak+instant
  15163. Peak and instant envelope combined together.
  15164. @end table
  15165. @item graticule, g
  15166. Set what kind of graticule to draw.
  15167. @table @samp
  15168. @item none
  15169. @item green
  15170. @item color
  15171. @item invert
  15172. @end table
  15173. @item opacity, o
  15174. Set graticule opacity.
  15175. @item flags, f
  15176. Set graticule flags.
  15177. @table @samp
  15178. @item white
  15179. Draw graticule for white point.
  15180. @item black
  15181. Draw graticule for black point.
  15182. @item name
  15183. Draw color points short names.
  15184. @end table
  15185. @item bgopacity, b
  15186. Set background opacity.
  15187. @item lthreshold, l
  15188. Set low threshold for color component not represented on X or Y axis.
  15189. Values lower than this value will be ignored. Default is 0.
  15190. Note this value is multiplied with actual max possible value one pixel component
  15191. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15192. is 0.1 * 255 = 25.
  15193. @item hthreshold, h
  15194. Set high threshold for color component not represented on X or Y axis.
  15195. Values higher than this value will be ignored. Default is 1.
  15196. Note this value is multiplied with actual max possible value one pixel component
  15197. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15198. is 0.9 * 255 = 230.
  15199. @item colorspace, c
  15200. Set what kind of colorspace to use when drawing graticule.
  15201. @table @samp
  15202. @item auto
  15203. @item 601
  15204. @item 709
  15205. @end table
  15206. Default is auto.
  15207. @item tint0, t0
  15208. @item tint1, t1
  15209. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15210. This means no tint, and output will remain gray.
  15211. @end table
  15212. @anchor{vidstabdetect}
  15213. @section vidstabdetect
  15214. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15215. @ref{vidstabtransform} for pass 2.
  15216. This filter generates a file with relative translation and rotation
  15217. transform information about subsequent frames, which is then used by
  15218. the @ref{vidstabtransform} filter.
  15219. To enable compilation of this filter you need to configure FFmpeg with
  15220. @code{--enable-libvidstab}.
  15221. This filter accepts the following options:
  15222. @table @option
  15223. @item result
  15224. Set the path to the file used to write the transforms information.
  15225. Default value is @file{transforms.trf}.
  15226. @item shakiness
  15227. Set how shaky the video is and how quick the camera is. It accepts an
  15228. integer in the range 1-10, a value of 1 means little shakiness, a
  15229. value of 10 means strong shakiness. Default value is 5.
  15230. @item accuracy
  15231. Set the accuracy of the detection process. It must be a value in the
  15232. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15233. accuracy. Default value is 15.
  15234. @item stepsize
  15235. Set stepsize of the search process. The region around minimum is
  15236. scanned with 1 pixel resolution. Default value is 6.
  15237. @item mincontrast
  15238. Set minimum contrast. Below this value a local measurement field is
  15239. discarded. Must be a floating point value in the range 0-1. Default
  15240. value is 0.3.
  15241. @item tripod
  15242. Set reference frame number for tripod mode.
  15243. If enabled, the motion of the frames is compared to a reference frame
  15244. in the filtered stream, identified by the specified number. The idea
  15245. is to compensate all movements in a more-or-less static scene and keep
  15246. the camera view absolutely still.
  15247. If set to 0, it is disabled. The frames are counted starting from 1.
  15248. @item show
  15249. Show fields and transforms in the resulting frames. It accepts an
  15250. integer in the range 0-2. Default value is 0, which disables any
  15251. visualization.
  15252. @end table
  15253. @subsection Examples
  15254. @itemize
  15255. @item
  15256. Use default values:
  15257. @example
  15258. vidstabdetect
  15259. @end example
  15260. @item
  15261. Analyze strongly shaky movie and put the results in file
  15262. @file{mytransforms.trf}:
  15263. @example
  15264. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15265. @end example
  15266. @item
  15267. Visualize the result of internal transformations in the resulting
  15268. video:
  15269. @example
  15270. vidstabdetect=show=1
  15271. @end example
  15272. @item
  15273. Analyze a video with medium shakiness using @command{ffmpeg}:
  15274. @example
  15275. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15276. @end example
  15277. @end itemize
  15278. @anchor{vidstabtransform}
  15279. @section vidstabtransform
  15280. Video stabilization/deshaking: pass 2 of 2,
  15281. see @ref{vidstabdetect} for pass 1.
  15282. Read a file with transform information for each frame and
  15283. apply/compensate them. Together with the @ref{vidstabdetect}
  15284. filter this can be used to deshake videos. See also
  15285. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15286. the @ref{unsharp} filter, see below.
  15287. To enable compilation of this filter you need to configure FFmpeg with
  15288. @code{--enable-libvidstab}.
  15289. @subsection Options
  15290. @table @option
  15291. @item input
  15292. Set path to the file used to read the transforms. Default value is
  15293. @file{transforms.trf}.
  15294. @item smoothing
  15295. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15296. camera movements. Default value is 10.
  15297. For example a number of 10 means that 21 frames are used (10 in the
  15298. past and 10 in the future) to smoothen the motion in the video. A
  15299. larger value leads to a smoother video, but limits the acceleration of
  15300. the camera (pan/tilt movements). 0 is a special case where a static
  15301. camera is simulated.
  15302. @item optalgo
  15303. Set the camera path optimization algorithm.
  15304. Accepted values are:
  15305. @table @samp
  15306. @item gauss
  15307. gaussian kernel low-pass filter on camera motion (default)
  15308. @item avg
  15309. averaging on transformations
  15310. @end table
  15311. @item maxshift
  15312. Set maximal number of pixels to translate frames. Default value is -1,
  15313. meaning no limit.
  15314. @item maxangle
  15315. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15316. value is -1, meaning no limit.
  15317. @item crop
  15318. Specify how to deal with borders that may be visible due to movement
  15319. compensation.
  15320. Available values are:
  15321. @table @samp
  15322. @item keep
  15323. keep image information from previous frame (default)
  15324. @item black
  15325. fill the border black
  15326. @end table
  15327. @item invert
  15328. Invert transforms if set to 1. Default value is 0.
  15329. @item relative
  15330. Consider transforms as relative to previous frame if set to 1,
  15331. absolute if set to 0. Default value is 0.
  15332. @item zoom
  15333. Set percentage to zoom. A positive value will result in a zoom-in
  15334. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15335. zoom).
  15336. @item optzoom
  15337. Set optimal zooming to avoid borders.
  15338. Accepted values are:
  15339. @table @samp
  15340. @item 0
  15341. disabled
  15342. @item 1
  15343. optimal static zoom value is determined (only very strong movements
  15344. will lead to visible borders) (default)
  15345. @item 2
  15346. optimal adaptive zoom value is determined (no borders will be
  15347. visible), see @option{zoomspeed}
  15348. @end table
  15349. Note that the value given at zoom is added to the one calculated here.
  15350. @item zoomspeed
  15351. Set percent to zoom maximally each frame (enabled when
  15352. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15353. 0.25.
  15354. @item interpol
  15355. Specify type of interpolation.
  15356. Available values are:
  15357. @table @samp
  15358. @item no
  15359. no interpolation
  15360. @item linear
  15361. linear only horizontal
  15362. @item bilinear
  15363. linear in both directions (default)
  15364. @item bicubic
  15365. cubic in both directions (slow)
  15366. @end table
  15367. @item tripod
  15368. Enable virtual tripod mode if set to 1, which is equivalent to
  15369. @code{relative=0:smoothing=0}. Default value is 0.
  15370. Use also @code{tripod} option of @ref{vidstabdetect}.
  15371. @item debug
  15372. Increase log verbosity if set to 1. Also the detected global motions
  15373. are written to the temporary file @file{global_motions.trf}. Default
  15374. value is 0.
  15375. @end table
  15376. @subsection Examples
  15377. @itemize
  15378. @item
  15379. Use @command{ffmpeg} for a typical stabilization with default values:
  15380. @example
  15381. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15382. @end example
  15383. Note the use of the @ref{unsharp} filter which is always recommended.
  15384. @item
  15385. Zoom in a bit more and load transform data from a given file:
  15386. @example
  15387. vidstabtransform=zoom=5:input="mytransforms.trf"
  15388. @end example
  15389. @item
  15390. Smoothen the video even more:
  15391. @example
  15392. vidstabtransform=smoothing=30
  15393. @end example
  15394. @end itemize
  15395. @section vflip
  15396. Flip the input video vertically.
  15397. For example, to vertically flip a video with @command{ffmpeg}:
  15398. @example
  15399. ffmpeg -i in.avi -vf "vflip" out.avi
  15400. @end example
  15401. @section vfrdet
  15402. Detect variable frame rate video.
  15403. This filter tries to detect if the input is variable or constant frame rate.
  15404. At end it will output number of frames detected as having variable delta pts,
  15405. and ones with constant delta pts.
  15406. If there was frames with variable delta, than it will also show min, max and
  15407. average delta encountered.
  15408. @section vibrance
  15409. Boost or alter saturation.
  15410. The filter accepts the following options:
  15411. @table @option
  15412. @item intensity
  15413. Set strength of boost if positive value or strength of alter if negative value.
  15414. Default is 0. Allowed range is from -2 to 2.
  15415. @item rbal
  15416. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15417. @item gbal
  15418. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15419. @item bbal
  15420. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15421. @item rlum
  15422. Set the red luma coefficient.
  15423. @item glum
  15424. Set the green luma coefficient.
  15425. @item blum
  15426. Set the blue luma coefficient.
  15427. @item alternate
  15428. If @code{intensity} is negative and this is set to 1, colors will change,
  15429. otherwise colors will be less saturated, more towards gray.
  15430. @end table
  15431. @subsection Commands
  15432. This filter supports the all above options as @ref{commands}.
  15433. @anchor{vignette}
  15434. @section vignette
  15435. Make or reverse a natural vignetting effect.
  15436. The filter accepts the following options:
  15437. @table @option
  15438. @item angle, a
  15439. Set lens angle expression as a number of radians.
  15440. The value is clipped in the @code{[0,PI/2]} range.
  15441. Default value: @code{"PI/5"}
  15442. @item x0
  15443. @item y0
  15444. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15445. by default.
  15446. @item mode
  15447. Set forward/backward mode.
  15448. Available modes are:
  15449. @table @samp
  15450. @item forward
  15451. The larger the distance from the central point, the darker the image becomes.
  15452. @item backward
  15453. The larger the distance from the central point, the brighter the image becomes.
  15454. This can be used to reverse a vignette effect, though there is no automatic
  15455. detection to extract the lens @option{angle} and other settings (yet). It can
  15456. also be used to create a burning effect.
  15457. @end table
  15458. Default value is @samp{forward}.
  15459. @item eval
  15460. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15461. It accepts the following values:
  15462. @table @samp
  15463. @item init
  15464. Evaluate expressions only once during the filter initialization.
  15465. @item frame
  15466. Evaluate expressions for each incoming frame. This is way slower than the
  15467. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15468. allows advanced dynamic expressions.
  15469. @end table
  15470. Default value is @samp{init}.
  15471. @item dither
  15472. Set dithering to reduce the circular banding effects. Default is @code{1}
  15473. (enabled).
  15474. @item aspect
  15475. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15476. Setting this value to the SAR of the input will make a rectangular vignetting
  15477. following the dimensions of the video.
  15478. Default is @code{1/1}.
  15479. @end table
  15480. @subsection Expressions
  15481. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15482. following parameters.
  15483. @table @option
  15484. @item w
  15485. @item h
  15486. input width and height
  15487. @item n
  15488. the number of input frame, starting from 0
  15489. @item pts
  15490. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15491. @var{TB} units, NAN if undefined
  15492. @item r
  15493. frame rate of the input video, NAN if the input frame rate is unknown
  15494. @item t
  15495. the PTS (Presentation TimeStamp) of the filtered video frame,
  15496. expressed in seconds, NAN if undefined
  15497. @item tb
  15498. time base of the input video
  15499. @end table
  15500. @subsection Examples
  15501. @itemize
  15502. @item
  15503. Apply simple strong vignetting effect:
  15504. @example
  15505. vignette=PI/4
  15506. @end example
  15507. @item
  15508. Make a flickering vignetting:
  15509. @example
  15510. vignette='PI/4+random(1)*PI/50':eval=frame
  15511. @end example
  15512. @end itemize
  15513. @section vmafmotion
  15514. Obtain the average VMAF motion score of a video.
  15515. It is one of the component metrics of VMAF.
  15516. The obtained average motion score is printed through the logging system.
  15517. The filter accepts the following options:
  15518. @table @option
  15519. @item stats_file
  15520. If specified, the filter will use the named file to save the motion score of
  15521. each frame with respect to the previous frame.
  15522. When filename equals "-" the data is sent to standard output.
  15523. @end table
  15524. Example:
  15525. @example
  15526. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15527. @end example
  15528. @section vstack
  15529. Stack input videos vertically.
  15530. All streams must be of same pixel format and of same width.
  15531. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15532. to create same output.
  15533. The filter accepts the following options:
  15534. @table @option
  15535. @item inputs
  15536. Set number of input streams. Default is 2.
  15537. @item shortest
  15538. If set to 1, force the output to terminate when the shortest input
  15539. terminates. Default value is 0.
  15540. @end table
  15541. @section w3fdif
  15542. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15543. Deinterlacing Filter").
  15544. Based on the process described by Martin Weston for BBC R&D, and
  15545. implemented based on the de-interlace algorithm written by Jim
  15546. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15547. uses filter coefficients calculated by BBC R&D.
  15548. This filter uses field-dominance information in frame to decide which
  15549. of each pair of fields to place first in the output.
  15550. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15551. There are two sets of filter coefficients, so called "simple"
  15552. and "complex". Which set of filter coefficients is used can
  15553. be set by passing an optional parameter:
  15554. @table @option
  15555. @item filter
  15556. Set the interlacing filter coefficients. Accepts one of the following values:
  15557. @table @samp
  15558. @item simple
  15559. Simple filter coefficient set.
  15560. @item complex
  15561. More-complex filter coefficient set.
  15562. @end table
  15563. Default value is @samp{complex}.
  15564. @item deint
  15565. Specify which frames to deinterlace. Accepts one of the following values:
  15566. @table @samp
  15567. @item all
  15568. Deinterlace all frames,
  15569. @item interlaced
  15570. Only deinterlace frames marked as interlaced.
  15571. @end table
  15572. Default value is @samp{all}.
  15573. @end table
  15574. @section waveform
  15575. Video waveform monitor.
  15576. The waveform monitor plots color component intensity. By default luminance
  15577. only. Each column of the waveform corresponds to a column of pixels in the
  15578. source video.
  15579. It accepts the following options:
  15580. @table @option
  15581. @item mode, m
  15582. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15583. In row mode, the graph on the left side represents color component value 0 and
  15584. the right side represents value = 255. In column mode, the top side represents
  15585. color component value = 0 and bottom side represents value = 255.
  15586. @item intensity, i
  15587. Set intensity. Smaller values are useful to find out how many values of the same
  15588. luminance are distributed across input rows/columns.
  15589. Default value is @code{0.04}. Allowed range is [0, 1].
  15590. @item mirror, r
  15591. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15592. In mirrored mode, higher values will be represented on the left
  15593. side for @code{row} mode and at the top for @code{column} mode. Default is
  15594. @code{1} (mirrored).
  15595. @item display, d
  15596. Set display mode.
  15597. It accepts the following values:
  15598. @table @samp
  15599. @item overlay
  15600. Presents information identical to that in the @code{parade}, except
  15601. that the graphs representing color components are superimposed directly
  15602. over one another.
  15603. This display mode makes it easier to spot relative differences or similarities
  15604. in overlapping areas of the color components that are supposed to be identical,
  15605. such as neutral whites, grays, or blacks.
  15606. @item stack
  15607. Display separate graph for the color components side by side in
  15608. @code{row} mode or one below the other in @code{column} mode.
  15609. @item parade
  15610. Display separate graph for the color components side by side in
  15611. @code{column} mode or one below the other in @code{row} mode.
  15612. Using this display mode makes it easy to spot color casts in the highlights
  15613. and shadows of an image, by comparing the contours of the top and the bottom
  15614. graphs of each waveform. Since whites, grays, and blacks are characterized
  15615. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15616. should display three waveforms of roughly equal width/height. If not, the
  15617. correction is easy to perform by making level adjustments the three waveforms.
  15618. @end table
  15619. Default is @code{stack}.
  15620. @item components, c
  15621. Set which color components to display. Default is 1, which means only luminance
  15622. or red color component if input is in RGB colorspace. If is set for example to
  15623. 7 it will display all 3 (if) available color components.
  15624. @item envelope, e
  15625. @table @samp
  15626. @item none
  15627. No envelope, this is default.
  15628. @item instant
  15629. Instant envelope, minimum and maximum values presented in graph will be easily
  15630. visible even with small @code{step} value.
  15631. @item peak
  15632. Hold minimum and maximum values presented in graph across time. This way you
  15633. can still spot out of range values without constantly looking at waveforms.
  15634. @item peak+instant
  15635. Peak and instant envelope combined together.
  15636. @end table
  15637. @item filter, f
  15638. @table @samp
  15639. @item lowpass
  15640. No filtering, this is default.
  15641. @item flat
  15642. Luma and chroma combined together.
  15643. @item aflat
  15644. Similar as above, but shows difference between blue and red chroma.
  15645. @item xflat
  15646. Similar as above, but use different colors.
  15647. @item yflat
  15648. Similar as above, but again with different colors.
  15649. @item chroma
  15650. Displays only chroma.
  15651. @item color
  15652. Displays actual color value on waveform.
  15653. @item acolor
  15654. Similar as above, but with luma showing frequency of chroma values.
  15655. @end table
  15656. @item graticule, g
  15657. Set which graticule to display.
  15658. @table @samp
  15659. @item none
  15660. Do not display graticule.
  15661. @item green
  15662. Display green graticule showing legal broadcast ranges.
  15663. @item orange
  15664. Display orange graticule showing legal broadcast ranges.
  15665. @item invert
  15666. Display invert graticule showing legal broadcast ranges.
  15667. @end table
  15668. @item opacity, o
  15669. Set graticule opacity.
  15670. @item flags, fl
  15671. Set graticule flags.
  15672. @table @samp
  15673. @item numbers
  15674. Draw numbers above lines. By default enabled.
  15675. @item dots
  15676. Draw dots instead of lines.
  15677. @end table
  15678. @item scale, s
  15679. Set scale used for displaying graticule.
  15680. @table @samp
  15681. @item digital
  15682. @item millivolts
  15683. @item ire
  15684. @end table
  15685. Default is digital.
  15686. @item bgopacity, b
  15687. Set background opacity.
  15688. @item tint0, t0
  15689. @item tint1, t1
  15690. Set tint for output.
  15691. Only used with lowpass filter and when display is not overlay and input
  15692. pixel formats are not RGB.
  15693. @end table
  15694. @section weave, doubleweave
  15695. The @code{weave} takes a field-based video input and join
  15696. each two sequential fields into single frame, producing a new double
  15697. height clip with half the frame rate and half the frame count.
  15698. The @code{doubleweave} works same as @code{weave} but without
  15699. halving frame rate and frame count.
  15700. It accepts the following option:
  15701. @table @option
  15702. @item first_field
  15703. Set first field. Available values are:
  15704. @table @samp
  15705. @item top, t
  15706. Set the frame as top-field-first.
  15707. @item bottom, b
  15708. Set the frame as bottom-field-first.
  15709. @end table
  15710. @end table
  15711. @subsection Examples
  15712. @itemize
  15713. @item
  15714. Interlace video using @ref{select} and @ref{separatefields} filter:
  15715. @example
  15716. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15717. @end example
  15718. @end itemize
  15719. @section xbr
  15720. Apply the xBR high-quality magnification filter which is designed for pixel
  15721. art. It follows a set of edge-detection rules, see
  15722. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15723. It accepts the following option:
  15724. @table @option
  15725. @item n
  15726. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15727. @code{3xBR} and @code{4} for @code{4xBR}.
  15728. Default is @code{3}.
  15729. @end table
  15730. @section xfade
  15731. Apply cross fade from one input video stream to another input video stream.
  15732. The cross fade is applied for specified duration.
  15733. The filter accepts the following options:
  15734. @table @option
  15735. @item transition
  15736. Set one of available transition effects:
  15737. @table @samp
  15738. @item custom
  15739. @item fade
  15740. @item wipeleft
  15741. @item wiperight
  15742. @item wipeup
  15743. @item wipedown
  15744. @item slideleft
  15745. @item slideright
  15746. @item slideup
  15747. @item slidedown
  15748. @item circlecrop
  15749. @item rectcrop
  15750. @item distance
  15751. @item fadeblack
  15752. @item fadewhite
  15753. @item radial
  15754. @item smoothleft
  15755. @item smoothright
  15756. @item smoothup
  15757. @item smoothdown
  15758. @item circleopen
  15759. @item circleclose
  15760. @item vertopen
  15761. @item vertclose
  15762. @item horzopen
  15763. @item horzclose
  15764. @item dissolve
  15765. @item pixelize
  15766. @item diagtl
  15767. @item diagtr
  15768. @item diagbl
  15769. @item diagbr
  15770. @item hlslice
  15771. @item hrslice
  15772. @item vuslice
  15773. @item vdslice
  15774. @item hblur
  15775. @item fadegrays
  15776. @item wipetl
  15777. @item wipetr
  15778. @item wipebl
  15779. @item wipebr
  15780. @end table
  15781. Default transition effect is fade.
  15782. @item duration
  15783. Set cross fade duration in seconds.
  15784. Default duration is 1 second.
  15785. @item offset
  15786. Set cross fade start relative to first input stream in seconds.
  15787. Default offset is 0.
  15788. @item expr
  15789. Set expression for custom transition effect.
  15790. The expressions can use the following variables and functions:
  15791. @table @option
  15792. @item X
  15793. @item Y
  15794. The coordinates of the current sample.
  15795. @item W
  15796. @item H
  15797. The width and height of the image.
  15798. @item P
  15799. Progress of transition effect.
  15800. @item PLANE
  15801. Currently processed plane.
  15802. @item A
  15803. Return value of first input at current location and plane.
  15804. @item B
  15805. Return value of second input at current location and plane.
  15806. @item a0(x, y)
  15807. @item a1(x, y)
  15808. @item a2(x, y)
  15809. @item a3(x, y)
  15810. Return the value of the pixel at location (@var{x},@var{y}) of the
  15811. first/second/third/fourth component of first input.
  15812. @item b0(x, y)
  15813. @item b1(x, y)
  15814. @item b2(x, y)
  15815. @item b3(x, y)
  15816. Return the value of the pixel at location (@var{x},@var{y}) of the
  15817. first/second/third/fourth component of second input.
  15818. @end table
  15819. @end table
  15820. @subsection Examples
  15821. @itemize
  15822. @item
  15823. Cross fade from one input video to another input video, with fade transition and duration of transition
  15824. of 2 seconds starting at offset of 5 seconds:
  15825. @example
  15826. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15827. @end example
  15828. @end itemize
  15829. @section xmedian
  15830. Pick median pixels from several input videos.
  15831. The filter accepts the following options:
  15832. @table @option
  15833. @item inputs
  15834. Set number of inputs.
  15835. Default is 3. Allowed range is from 3 to 255.
  15836. If number of inputs is even number, than result will be mean value between two median values.
  15837. @item planes
  15838. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15839. @item percentile
  15840. Set median percentile. Default value is @code{0.5}.
  15841. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15842. minimum values, and @code{1} maximum values.
  15843. @end table
  15844. @section xstack
  15845. Stack video inputs into custom layout.
  15846. All streams must be of same pixel format.
  15847. The filter accepts the following options:
  15848. @table @option
  15849. @item inputs
  15850. Set number of input streams. Default is 2.
  15851. @item layout
  15852. Specify layout of inputs.
  15853. This option requires the desired layout configuration to be explicitly set by the user.
  15854. This sets position of each video input in output. Each input
  15855. is separated by '|'.
  15856. The first number represents the column, and the second number represents the row.
  15857. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15858. where X is video input from which to take width or height.
  15859. Multiple values can be used when separated by '+'. In such
  15860. case values are summed together.
  15861. Note that if inputs are of different sizes gaps may appear, as not all of
  15862. the output video frame will be filled. Similarly, videos can overlap each
  15863. other if their position doesn't leave enough space for the full frame of
  15864. adjoining videos.
  15865. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15866. a layout must be set by the user.
  15867. @item shortest
  15868. If set to 1, force the output to terminate when the shortest input
  15869. terminates. Default value is 0.
  15870. @item fill
  15871. If set to valid color, all unused pixels will be filled with that color.
  15872. By default fill is set to none, so it is disabled.
  15873. @end table
  15874. @subsection Examples
  15875. @itemize
  15876. @item
  15877. Display 4 inputs into 2x2 grid.
  15878. Layout:
  15879. @example
  15880. input1(0, 0) | input3(w0, 0)
  15881. input2(0, h0) | input4(w0, h0)
  15882. @end example
  15883. @example
  15884. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15885. @end example
  15886. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15887. @item
  15888. Display 4 inputs into 1x4 grid.
  15889. Layout:
  15890. @example
  15891. input1(0, 0)
  15892. input2(0, h0)
  15893. input3(0, h0+h1)
  15894. input4(0, h0+h1+h2)
  15895. @end example
  15896. @example
  15897. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15898. @end example
  15899. Note that if inputs are of different widths, unused space will appear.
  15900. @item
  15901. Display 9 inputs into 3x3 grid.
  15902. Layout:
  15903. @example
  15904. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15905. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15906. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15907. @end example
  15908. @example
  15909. 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
  15910. @end example
  15911. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15912. @item
  15913. Display 16 inputs into 4x4 grid.
  15914. Layout:
  15915. @example
  15916. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15917. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15918. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15919. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15920. @end example
  15921. @example
  15922. 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|
  15923. 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
  15924. @end example
  15925. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15926. @end itemize
  15927. @anchor{yadif}
  15928. @section yadif
  15929. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15930. filter").
  15931. It accepts the following parameters:
  15932. @table @option
  15933. @item mode
  15934. The interlacing mode to adopt. It accepts one of the following values:
  15935. @table @option
  15936. @item 0, send_frame
  15937. Output one frame for each frame.
  15938. @item 1, send_field
  15939. Output one frame for each field.
  15940. @item 2, send_frame_nospatial
  15941. Like @code{send_frame}, but it skips the spatial interlacing check.
  15942. @item 3, send_field_nospatial
  15943. Like @code{send_field}, but it skips the spatial interlacing check.
  15944. @end table
  15945. The default value is @code{send_frame}.
  15946. @item parity
  15947. The picture field parity assumed for the input interlaced video. It accepts one
  15948. of the following values:
  15949. @table @option
  15950. @item 0, tff
  15951. Assume the top field is first.
  15952. @item 1, bff
  15953. Assume the bottom field is first.
  15954. @item -1, auto
  15955. Enable automatic detection of field parity.
  15956. @end table
  15957. The default value is @code{auto}.
  15958. If the interlacing is unknown or the decoder does not export this information,
  15959. top field first will be assumed.
  15960. @item deint
  15961. Specify which frames to deinterlace. Accepts one of the following
  15962. values:
  15963. @table @option
  15964. @item 0, all
  15965. Deinterlace all frames.
  15966. @item 1, interlaced
  15967. Only deinterlace frames marked as interlaced.
  15968. @end table
  15969. The default value is @code{all}.
  15970. @end table
  15971. @section yadif_cuda
  15972. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15973. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15974. and/or nvenc.
  15975. It accepts the following parameters:
  15976. @table @option
  15977. @item mode
  15978. The interlacing mode to adopt. It accepts one of the following values:
  15979. @table @option
  15980. @item 0, send_frame
  15981. Output one frame for each frame.
  15982. @item 1, send_field
  15983. Output one frame for each field.
  15984. @item 2, send_frame_nospatial
  15985. Like @code{send_frame}, but it skips the spatial interlacing check.
  15986. @item 3, send_field_nospatial
  15987. Like @code{send_field}, but it skips the spatial interlacing check.
  15988. @end table
  15989. The default value is @code{send_frame}.
  15990. @item parity
  15991. The picture field parity assumed for the input interlaced video. It accepts one
  15992. of the following values:
  15993. @table @option
  15994. @item 0, tff
  15995. Assume the top field is first.
  15996. @item 1, bff
  15997. Assume the bottom field is first.
  15998. @item -1, auto
  15999. Enable automatic detection of field parity.
  16000. @end table
  16001. The default value is @code{auto}.
  16002. If the interlacing is unknown or the decoder does not export this information,
  16003. top field first will be assumed.
  16004. @item deint
  16005. Specify which frames to deinterlace. Accepts one of the following
  16006. values:
  16007. @table @option
  16008. @item 0, all
  16009. Deinterlace all frames.
  16010. @item 1, interlaced
  16011. Only deinterlace frames marked as interlaced.
  16012. @end table
  16013. The default value is @code{all}.
  16014. @end table
  16015. @section yaepblur
  16016. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  16017. The algorithm is described in
  16018. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  16019. It accepts the following parameters:
  16020. @table @option
  16021. @item radius, r
  16022. Set the window radius. Default value is 3.
  16023. @item planes, p
  16024. Set which planes to filter. Default is only the first plane.
  16025. @item sigma, s
  16026. Set blur strength. Default value is 128.
  16027. @end table
  16028. @subsection Commands
  16029. This filter supports same @ref{commands} as options.
  16030. @section zoompan
  16031. Apply Zoom & Pan effect.
  16032. This filter accepts the following options:
  16033. @table @option
  16034. @item zoom, z
  16035. Set the zoom expression. Range is 1-10. Default is 1.
  16036. @item x
  16037. @item y
  16038. Set the x and y expression. Default is 0.
  16039. @item d
  16040. Set the duration expression in number of frames.
  16041. This sets for how many number of frames effect will last for
  16042. single input image.
  16043. @item s
  16044. Set the output image size, default is 'hd720'.
  16045. @item fps
  16046. Set the output frame rate, default is '25'.
  16047. @end table
  16048. Each expression can contain the following constants:
  16049. @table @option
  16050. @item in_w, iw
  16051. Input width.
  16052. @item in_h, ih
  16053. Input height.
  16054. @item out_w, ow
  16055. Output width.
  16056. @item out_h, oh
  16057. Output height.
  16058. @item in
  16059. Input frame count.
  16060. @item on
  16061. Output frame count.
  16062. @item in_time, it
  16063. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16064. @item out_time, time, ot
  16065. The output timestamp expressed in seconds.
  16066. @item x
  16067. @item y
  16068. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  16069. for current input frame.
  16070. @item px
  16071. @item py
  16072. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16073. not yet such frame (first input frame).
  16074. @item zoom
  16075. Last calculated zoom from 'z' expression for current input frame.
  16076. @item pzoom
  16077. Last calculated zoom of last output frame of previous input frame.
  16078. @item duration
  16079. Number of output frames for current input frame. Calculated from 'd' expression
  16080. for each input frame.
  16081. @item pduration
  16082. number of output frames created for previous input frame
  16083. @item a
  16084. Rational number: input width / input height
  16085. @item sar
  16086. sample aspect ratio
  16087. @item dar
  16088. display aspect ratio
  16089. @end table
  16090. @subsection Examples
  16091. @itemize
  16092. @item
  16093. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16094. @example
  16095. 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
  16096. @end example
  16097. @item
  16098. Zoom in up to 1.5x and pan always at center of picture:
  16099. @example
  16100. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16101. @end example
  16102. @item
  16103. Same as above but without pausing:
  16104. @example
  16105. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16106. @end example
  16107. @item
  16108. Zoom in 2x into center of picture only for the first second of the input video:
  16109. @example
  16110. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16111. @end example
  16112. @end itemize
  16113. @anchor{zscale}
  16114. @section zscale
  16115. Scale (resize) the input video, using the z.lib library:
  16116. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16117. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16118. The zscale filter forces the output display aspect ratio to be the same
  16119. as the input, by changing the output sample aspect ratio.
  16120. If the input image format is different from the format requested by
  16121. the next filter, the zscale filter will convert the input to the
  16122. requested format.
  16123. @subsection Options
  16124. The filter accepts the following options.
  16125. @table @option
  16126. @item width, w
  16127. @item height, h
  16128. Set the output video dimension expression. Default value is the input
  16129. dimension.
  16130. If the @var{width} or @var{w} value is 0, the input width is used for
  16131. the output. If the @var{height} or @var{h} value is 0, the input height
  16132. is used for the output.
  16133. If one and only one of the values is -n with n >= 1, the zscale filter
  16134. will use a value that maintains the aspect ratio of the input image,
  16135. calculated from the other specified dimension. After that it will,
  16136. however, make sure that the calculated dimension is divisible by n and
  16137. adjust the value if necessary.
  16138. If both values are -n with n >= 1, the behavior will be identical to
  16139. both values being set to 0 as previously detailed.
  16140. See below for the list of accepted constants for use in the dimension
  16141. expression.
  16142. @item size, s
  16143. Set the video size. For the syntax of this option, check the
  16144. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16145. @item dither, d
  16146. Set the dither type.
  16147. Possible values are:
  16148. @table @var
  16149. @item none
  16150. @item ordered
  16151. @item random
  16152. @item error_diffusion
  16153. @end table
  16154. Default is none.
  16155. @item filter, f
  16156. Set the resize filter type.
  16157. Possible values are:
  16158. @table @var
  16159. @item point
  16160. @item bilinear
  16161. @item bicubic
  16162. @item spline16
  16163. @item spline36
  16164. @item lanczos
  16165. @end table
  16166. Default is bilinear.
  16167. @item range, r
  16168. Set the color range.
  16169. Possible values are:
  16170. @table @var
  16171. @item input
  16172. @item limited
  16173. @item full
  16174. @end table
  16175. Default is same as input.
  16176. @item primaries, p
  16177. Set the color primaries.
  16178. Possible values are:
  16179. @table @var
  16180. @item input
  16181. @item 709
  16182. @item unspecified
  16183. @item 170m
  16184. @item 240m
  16185. @item 2020
  16186. @end table
  16187. Default is same as input.
  16188. @item transfer, t
  16189. Set the transfer characteristics.
  16190. Possible values are:
  16191. @table @var
  16192. @item input
  16193. @item 709
  16194. @item unspecified
  16195. @item 601
  16196. @item linear
  16197. @item 2020_10
  16198. @item 2020_12
  16199. @item smpte2084
  16200. @item iec61966-2-1
  16201. @item arib-std-b67
  16202. @end table
  16203. Default is same as input.
  16204. @item matrix, m
  16205. Set the colorspace matrix.
  16206. Possible value are:
  16207. @table @var
  16208. @item input
  16209. @item 709
  16210. @item unspecified
  16211. @item 470bg
  16212. @item 170m
  16213. @item 2020_ncl
  16214. @item 2020_cl
  16215. @end table
  16216. Default is same as input.
  16217. @item rangein, rin
  16218. Set the input color range.
  16219. Possible values are:
  16220. @table @var
  16221. @item input
  16222. @item limited
  16223. @item full
  16224. @end table
  16225. Default is same as input.
  16226. @item primariesin, pin
  16227. Set the input color primaries.
  16228. Possible values are:
  16229. @table @var
  16230. @item input
  16231. @item 709
  16232. @item unspecified
  16233. @item 170m
  16234. @item 240m
  16235. @item 2020
  16236. @end table
  16237. Default is same as input.
  16238. @item transferin, tin
  16239. Set the input transfer characteristics.
  16240. Possible values are:
  16241. @table @var
  16242. @item input
  16243. @item 709
  16244. @item unspecified
  16245. @item 601
  16246. @item linear
  16247. @item 2020_10
  16248. @item 2020_12
  16249. @end table
  16250. Default is same as input.
  16251. @item matrixin, min
  16252. Set the input colorspace matrix.
  16253. Possible value are:
  16254. @table @var
  16255. @item input
  16256. @item 709
  16257. @item unspecified
  16258. @item 470bg
  16259. @item 170m
  16260. @item 2020_ncl
  16261. @item 2020_cl
  16262. @end table
  16263. @item chromal, c
  16264. Set the output chroma location.
  16265. Possible values are:
  16266. @table @var
  16267. @item input
  16268. @item left
  16269. @item center
  16270. @item topleft
  16271. @item top
  16272. @item bottomleft
  16273. @item bottom
  16274. @end table
  16275. @item chromalin, cin
  16276. Set the input chroma location.
  16277. Possible values are:
  16278. @table @var
  16279. @item input
  16280. @item left
  16281. @item center
  16282. @item topleft
  16283. @item top
  16284. @item bottomleft
  16285. @item bottom
  16286. @end table
  16287. @item npl
  16288. Set the nominal peak luminance.
  16289. @end table
  16290. The values of the @option{w} and @option{h} options are expressions
  16291. containing the following constants:
  16292. @table @var
  16293. @item in_w
  16294. @item in_h
  16295. The input width and height
  16296. @item iw
  16297. @item ih
  16298. These are the same as @var{in_w} and @var{in_h}.
  16299. @item out_w
  16300. @item out_h
  16301. The output (scaled) width and height
  16302. @item ow
  16303. @item oh
  16304. These are the same as @var{out_w} and @var{out_h}
  16305. @item a
  16306. The same as @var{iw} / @var{ih}
  16307. @item sar
  16308. input sample aspect ratio
  16309. @item dar
  16310. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16311. @item hsub
  16312. @item vsub
  16313. horizontal and vertical input chroma subsample values. For example for the
  16314. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16315. @item ohsub
  16316. @item ovsub
  16317. horizontal and vertical output chroma subsample values. For example for the
  16318. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16319. @end table
  16320. @subsection Commands
  16321. This filter supports the following commands:
  16322. @table @option
  16323. @item width, w
  16324. @item height, h
  16325. Set the output video dimension expression.
  16326. The command accepts the same syntax of the corresponding option.
  16327. If the specified expression is not valid, it is kept at its current
  16328. value.
  16329. @end table
  16330. @c man end VIDEO FILTERS
  16331. @chapter OpenCL Video Filters
  16332. @c man begin OPENCL VIDEO FILTERS
  16333. Below is a description of the currently available OpenCL video filters.
  16334. To enable compilation of these filters you need to configure FFmpeg with
  16335. @code{--enable-opencl}.
  16336. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16337. @table @option
  16338. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16339. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16340. given device parameters.
  16341. @item -filter_hw_device @var{name}
  16342. Pass the hardware device called @var{name} to all filters in any filter graph.
  16343. @end table
  16344. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16345. @itemize
  16346. @item
  16347. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16348. @example
  16349. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16350. @end example
  16351. @end itemize
  16352. 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.
  16353. @section avgblur_opencl
  16354. Apply average blur filter.
  16355. The filter accepts the following options:
  16356. @table @option
  16357. @item sizeX
  16358. Set horizontal radius size.
  16359. Range is @code{[1, 1024]} and default value is @code{1}.
  16360. @item planes
  16361. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16362. @item sizeY
  16363. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16364. @end table
  16365. @subsection Example
  16366. @itemize
  16367. @item
  16368. 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.
  16369. @example
  16370. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16371. @end example
  16372. @end itemize
  16373. @section boxblur_opencl
  16374. Apply a boxblur algorithm to the input video.
  16375. It accepts the following parameters:
  16376. @table @option
  16377. @item luma_radius, lr
  16378. @item luma_power, lp
  16379. @item chroma_radius, cr
  16380. @item chroma_power, cp
  16381. @item alpha_radius, ar
  16382. @item alpha_power, ap
  16383. @end table
  16384. A description of the accepted options follows.
  16385. @table @option
  16386. @item luma_radius, lr
  16387. @item chroma_radius, cr
  16388. @item alpha_radius, ar
  16389. Set an expression for the box radius in pixels used for blurring the
  16390. corresponding input plane.
  16391. The radius value must be a non-negative number, and must not be
  16392. greater than the value of the expression @code{min(w,h)/2} for the
  16393. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16394. planes.
  16395. Default value for @option{luma_radius} is "2". If not specified,
  16396. @option{chroma_radius} and @option{alpha_radius} default to the
  16397. corresponding value set for @option{luma_radius}.
  16398. The expressions can contain the following constants:
  16399. @table @option
  16400. @item w
  16401. @item h
  16402. The input width and height in pixels.
  16403. @item cw
  16404. @item ch
  16405. The input chroma image width and height in pixels.
  16406. @item hsub
  16407. @item vsub
  16408. The horizontal and vertical chroma subsample values. For example, for the
  16409. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16410. @end table
  16411. @item luma_power, lp
  16412. @item chroma_power, cp
  16413. @item alpha_power, ap
  16414. Specify how many times the boxblur filter is applied to the
  16415. corresponding plane.
  16416. Default value for @option{luma_power} is 2. If not specified,
  16417. @option{chroma_power} and @option{alpha_power} default to the
  16418. corresponding value set for @option{luma_power}.
  16419. A value of 0 will disable the effect.
  16420. @end table
  16421. @subsection Examples
  16422. 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.
  16423. @itemize
  16424. @item
  16425. Apply a boxblur filter with the luma, chroma, and alpha radius
  16426. 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.
  16427. @example
  16428. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16429. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16430. @end example
  16431. @item
  16432. 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.
  16433. For the luma plane, a 2x2 box radius will be run once.
  16434. For the chroma plane, a 4x4 box radius will be run 5 times.
  16435. For the alpha plane, a 3x3 box radius will be run 7 times.
  16436. @example
  16437. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16438. @end example
  16439. @end itemize
  16440. @section colorkey_opencl
  16441. RGB colorspace color keying.
  16442. The filter accepts the following options:
  16443. @table @option
  16444. @item color
  16445. The color which will be replaced with transparency.
  16446. @item similarity
  16447. Similarity percentage with the key color.
  16448. 0.01 matches only the exact key color, while 1.0 matches everything.
  16449. @item blend
  16450. Blend percentage.
  16451. 0.0 makes pixels either fully transparent, or not transparent at all.
  16452. Higher values result in semi-transparent pixels, with a higher transparency
  16453. the more similar the pixels color is to the key color.
  16454. @end table
  16455. @subsection Examples
  16456. @itemize
  16457. @item
  16458. Make every semi-green pixel in the input transparent with some slight blending:
  16459. @example
  16460. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16461. @end example
  16462. @end itemize
  16463. @section convolution_opencl
  16464. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16465. The filter accepts the following options:
  16466. @table @option
  16467. @item 0m
  16468. @item 1m
  16469. @item 2m
  16470. @item 3m
  16471. Set matrix for each plane.
  16472. Matrix is sequence of 9, 25 or 49 signed numbers.
  16473. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16474. @item 0rdiv
  16475. @item 1rdiv
  16476. @item 2rdiv
  16477. @item 3rdiv
  16478. Set multiplier for calculated value for each plane.
  16479. If unset or 0, it will be sum of all matrix elements.
  16480. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16481. @item 0bias
  16482. @item 1bias
  16483. @item 2bias
  16484. @item 3bias
  16485. Set bias for each plane. This value is added to the result of the multiplication.
  16486. Useful for making the overall image brighter or darker.
  16487. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16488. @end table
  16489. @subsection Examples
  16490. @itemize
  16491. @item
  16492. Apply sharpen:
  16493. @example
  16494. -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
  16495. @end example
  16496. @item
  16497. Apply blur:
  16498. @example
  16499. -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
  16500. @end example
  16501. @item
  16502. Apply edge enhance:
  16503. @example
  16504. -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
  16505. @end example
  16506. @item
  16507. Apply edge detect:
  16508. @example
  16509. -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
  16510. @end example
  16511. @item
  16512. Apply laplacian edge detector which includes diagonals:
  16513. @example
  16514. -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
  16515. @end example
  16516. @item
  16517. Apply emboss:
  16518. @example
  16519. -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
  16520. @end example
  16521. @end itemize
  16522. @section erosion_opencl
  16523. Apply erosion effect to the video.
  16524. This filter replaces the pixel by the local(3x3) minimum.
  16525. It accepts the following options:
  16526. @table @option
  16527. @item threshold0
  16528. @item threshold1
  16529. @item threshold2
  16530. @item threshold3
  16531. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16532. If @code{0}, plane will remain unchanged.
  16533. @item coordinates
  16534. Flag which specifies the pixel to refer to.
  16535. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16536. Flags to local 3x3 coordinates region centered on @code{x}:
  16537. 1 2 3
  16538. 4 x 5
  16539. 6 7 8
  16540. @end table
  16541. @subsection Example
  16542. @itemize
  16543. @item
  16544. 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.
  16545. @example
  16546. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16547. @end example
  16548. @end itemize
  16549. @section deshake_opencl
  16550. Feature-point based video stabilization filter.
  16551. The filter accepts the following options:
  16552. @table @option
  16553. @item tripod
  16554. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16555. @item debug
  16556. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16557. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16558. Viewing point matches in the output video is only supported for RGB input.
  16559. Defaults to @code{0}.
  16560. @item adaptive_crop
  16561. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16562. Defaults to @code{1}.
  16563. @item refine_features
  16564. Whether or not feature points should be refined at a sub-pixel level.
  16565. This can be turned off for a slight performance gain at the cost of precision.
  16566. Defaults to @code{1}.
  16567. @item smooth_strength
  16568. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16569. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16570. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16571. Defaults to @code{0.0}.
  16572. @item smooth_window_multiplier
  16573. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16574. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16575. Acceptable values range from @code{0.1} to @code{10.0}.
  16576. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16577. potentially improving smoothness, but also increase latency and memory usage.
  16578. Defaults to @code{2.0}.
  16579. @end table
  16580. @subsection Examples
  16581. @itemize
  16582. @item
  16583. Stabilize a video with a fixed, medium smoothing strength:
  16584. @example
  16585. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16586. @end example
  16587. @item
  16588. Stabilize a video with debugging (both in console and in rendered video):
  16589. @example
  16590. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16591. @end example
  16592. @end itemize
  16593. @section dilation_opencl
  16594. Apply dilation effect to the video.
  16595. This filter replaces the pixel by the local(3x3) maximum.
  16596. It accepts the following options:
  16597. @table @option
  16598. @item threshold0
  16599. @item threshold1
  16600. @item threshold2
  16601. @item threshold3
  16602. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16603. If @code{0}, plane will remain unchanged.
  16604. @item coordinates
  16605. Flag which specifies the pixel to refer to.
  16606. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16607. Flags to local 3x3 coordinates region centered on @code{x}:
  16608. 1 2 3
  16609. 4 x 5
  16610. 6 7 8
  16611. @end table
  16612. @subsection Example
  16613. @itemize
  16614. @item
  16615. 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.
  16616. @example
  16617. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16618. @end example
  16619. @end itemize
  16620. @section nlmeans_opencl
  16621. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16622. @section overlay_opencl
  16623. Overlay one video on top of another.
  16624. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16625. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16626. The filter accepts the following options:
  16627. @table @option
  16628. @item x
  16629. Set the x coordinate of the overlaid video on the main video.
  16630. Default value is @code{0}.
  16631. @item y
  16632. Set the y coordinate of the overlaid video on the main video.
  16633. Default value is @code{0}.
  16634. @end table
  16635. @subsection Examples
  16636. @itemize
  16637. @item
  16638. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16639. @example
  16640. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16641. @end example
  16642. @item
  16643. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16644. @example
  16645. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16646. @end example
  16647. @end itemize
  16648. @section pad_opencl
  16649. Add paddings to the input image, and place the original input at the
  16650. provided @var{x}, @var{y} coordinates.
  16651. It accepts the following options:
  16652. @table @option
  16653. @item width, w
  16654. @item height, h
  16655. Specify an expression for the size of the output image with the
  16656. paddings added. If the value for @var{width} or @var{height} is 0, the
  16657. corresponding input size is used for the output.
  16658. The @var{width} expression can reference the value set by the
  16659. @var{height} expression, and vice versa.
  16660. The default value of @var{width} and @var{height} is 0.
  16661. @item x
  16662. @item y
  16663. Specify the offsets to place the input image at within the padded area,
  16664. with respect to the top/left border of the output image.
  16665. The @var{x} expression can reference the value set by the @var{y}
  16666. expression, and vice versa.
  16667. The default value of @var{x} and @var{y} is 0.
  16668. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16669. so the input image is centered on the padded area.
  16670. @item color
  16671. Specify the color of the padded area. For the syntax of this option,
  16672. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16673. manual,ffmpeg-utils}.
  16674. @item aspect
  16675. Pad to an aspect instead to a resolution.
  16676. @end table
  16677. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16678. options are expressions containing the following constants:
  16679. @table @option
  16680. @item in_w
  16681. @item in_h
  16682. The input video width and height.
  16683. @item iw
  16684. @item ih
  16685. These are the same as @var{in_w} and @var{in_h}.
  16686. @item out_w
  16687. @item out_h
  16688. The output width and height (the size of the padded area), as
  16689. specified by the @var{width} and @var{height} expressions.
  16690. @item ow
  16691. @item oh
  16692. These are the same as @var{out_w} and @var{out_h}.
  16693. @item x
  16694. @item y
  16695. The x and y offsets as specified by the @var{x} and @var{y}
  16696. expressions, or NAN if not yet specified.
  16697. @item a
  16698. same as @var{iw} / @var{ih}
  16699. @item sar
  16700. input sample aspect ratio
  16701. @item dar
  16702. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16703. @end table
  16704. @section prewitt_opencl
  16705. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16706. The filter accepts the following option:
  16707. @table @option
  16708. @item planes
  16709. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16710. @item scale
  16711. Set value which will be multiplied with filtered result.
  16712. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16713. @item delta
  16714. Set value which will be added to filtered result.
  16715. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16716. @end table
  16717. @subsection Example
  16718. @itemize
  16719. @item
  16720. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16721. @example
  16722. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16723. @end example
  16724. @end itemize
  16725. @anchor{program_opencl}
  16726. @section program_opencl
  16727. Filter video using an OpenCL program.
  16728. @table @option
  16729. @item source
  16730. OpenCL program source file.
  16731. @item kernel
  16732. Kernel name in program.
  16733. @item inputs
  16734. Number of inputs to the filter. Defaults to 1.
  16735. @item size, s
  16736. Size of output frames. Defaults to the same as the first input.
  16737. @end table
  16738. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16739. The program source file must contain a kernel function with the given name,
  16740. which will be run once for each plane of the output. Each run on a plane
  16741. gets enqueued as a separate 2D global NDRange with one work-item for each
  16742. pixel to be generated. The global ID offset for each work-item is therefore
  16743. the coordinates of a pixel in the destination image.
  16744. The kernel function needs to take the following arguments:
  16745. @itemize
  16746. @item
  16747. Destination image, @var{__write_only image2d_t}.
  16748. This image will become the output; the kernel should write all of it.
  16749. @item
  16750. Frame index, @var{unsigned int}.
  16751. This is a counter starting from zero and increasing by one for each frame.
  16752. @item
  16753. Source images, @var{__read_only image2d_t}.
  16754. These are the most recent images on each input. The kernel may read from
  16755. them to generate the output, but they can't be written to.
  16756. @end itemize
  16757. Example programs:
  16758. @itemize
  16759. @item
  16760. Copy the input to the output (output must be the same size as the input).
  16761. @verbatim
  16762. __kernel void copy(__write_only image2d_t destination,
  16763. unsigned int index,
  16764. __read_only image2d_t source)
  16765. {
  16766. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16767. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16768. float4 value = read_imagef(source, sampler, location);
  16769. write_imagef(destination, location, value);
  16770. }
  16771. @end verbatim
  16772. @item
  16773. Apply a simple transformation, rotating the input by an amount increasing
  16774. with the index counter. Pixel values are linearly interpolated by the
  16775. sampler, and the output need not have the same dimensions as the input.
  16776. @verbatim
  16777. __kernel void rotate_image(__write_only image2d_t dst,
  16778. unsigned int index,
  16779. __read_only image2d_t src)
  16780. {
  16781. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16782. CLK_FILTER_LINEAR);
  16783. float angle = (float)index / 100.0f;
  16784. float2 dst_dim = convert_float2(get_image_dim(dst));
  16785. float2 src_dim = convert_float2(get_image_dim(src));
  16786. float2 dst_cen = dst_dim / 2.0f;
  16787. float2 src_cen = src_dim / 2.0f;
  16788. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16789. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16790. float2 src_pos = {
  16791. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16792. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16793. };
  16794. src_pos = src_pos * src_dim / dst_dim;
  16795. float2 src_loc = src_pos + src_cen;
  16796. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16797. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16798. write_imagef(dst, dst_loc, 0.5f);
  16799. else
  16800. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16801. }
  16802. @end verbatim
  16803. @item
  16804. Blend two inputs together, with the amount of each input used varying
  16805. with the index counter.
  16806. @verbatim
  16807. __kernel void blend_images(__write_only image2d_t dst,
  16808. unsigned int index,
  16809. __read_only image2d_t src1,
  16810. __read_only image2d_t src2)
  16811. {
  16812. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16813. CLK_FILTER_LINEAR);
  16814. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16815. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16816. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16817. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16818. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16819. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16820. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16821. }
  16822. @end verbatim
  16823. @end itemize
  16824. @section roberts_opencl
  16825. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16826. The filter accepts the following option:
  16827. @table @option
  16828. @item planes
  16829. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16830. @item scale
  16831. Set value which will be multiplied with filtered result.
  16832. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16833. @item delta
  16834. Set value which will be added to filtered result.
  16835. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16836. @end table
  16837. @subsection Example
  16838. @itemize
  16839. @item
  16840. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16841. @example
  16842. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16843. @end example
  16844. @end itemize
  16845. @section sobel_opencl
  16846. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16847. The filter accepts the following option:
  16848. @table @option
  16849. @item planes
  16850. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16851. @item scale
  16852. Set value which will be multiplied with filtered result.
  16853. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16854. @item delta
  16855. Set value which will be added to filtered result.
  16856. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16857. @end table
  16858. @subsection Example
  16859. @itemize
  16860. @item
  16861. Apply sobel operator with scale set to 2 and delta set to 10
  16862. @example
  16863. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16864. @end example
  16865. @end itemize
  16866. @section tonemap_opencl
  16867. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16868. It accepts the following parameters:
  16869. @table @option
  16870. @item tonemap
  16871. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16872. @item param
  16873. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16874. @item desat
  16875. Apply desaturation for highlights that exceed this level of brightness. The
  16876. higher the parameter, the more color information will be preserved. This
  16877. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16878. (smoothly) turning into white instead. This makes images feel more natural,
  16879. at the cost of reducing information about out-of-range colors.
  16880. The default value is 0.5, and the algorithm here is a little different from
  16881. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16882. @item threshold
  16883. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16884. is used to detect whether the scene has changed or not. If the distance between
  16885. the current frame average brightness and the current running average exceeds
  16886. a threshold value, we would re-calculate scene average and peak brightness.
  16887. The default value is 0.2.
  16888. @item format
  16889. Specify the output pixel format.
  16890. Currently supported formats are:
  16891. @table @var
  16892. @item p010
  16893. @item nv12
  16894. @end table
  16895. @item range, r
  16896. Set the output color range.
  16897. Possible values are:
  16898. @table @var
  16899. @item tv/mpeg
  16900. @item pc/jpeg
  16901. @end table
  16902. Default is same as input.
  16903. @item primaries, p
  16904. Set the output color primaries.
  16905. Possible values are:
  16906. @table @var
  16907. @item bt709
  16908. @item bt2020
  16909. @end table
  16910. Default is same as input.
  16911. @item transfer, t
  16912. Set the output transfer characteristics.
  16913. Possible values are:
  16914. @table @var
  16915. @item bt709
  16916. @item bt2020
  16917. @end table
  16918. Default is bt709.
  16919. @item matrix, m
  16920. Set the output colorspace matrix.
  16921. Possible value are:
  16922. @table @var
  16923. @item bt709
  16924. @item bt2020
  16925. @end table
  16926. Default is same as input.
  16927. @end table
  16928. @subsection Example
  16929. @itemize
  16930. @item
  16931. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16932. @example
  16933. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16934. @end example
  16935. @end itemize
  16936. @section unsharp_opencl
  16937. Sharpen or blur the input video.
  16938. It accepts the following parameters:
  16939. @table @option
  16940. @item luma_msize_x, lx
  16941. Set the luma matrix horizontal size.
  16942. Range is @code{[1, 23]} and default value is @code{5}.
  16943. @item luma_msize_y, ly
  16944. Set the luma matrix vertical size.
  16945. Range is @code{[1, 23]} and default value is @code{5}.
  16946. @item luma_amount, la
  16947. Set the luma effect strength.
  16948. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16949. Negative values will blur the input video, while positive values will
  16950. sharpen it, a value of zero will disable the effect.
  16951. @item chroma_msize_x, cx
  16952. Set the chroma matrix horizontal size.
  16953. Range is @code{[1, 23]} and default value is @code{5}.
  16954. @item chroma_msize_y, cy
  16955. Set the chroma matrix vertical size.
  16956. Range is @code{[1, 23]} and default value is @code{5}.
  16957. @item chroma_amount, ca
  16958. Set the chroma effect strength.
  16959. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16960. Negative values will blur the input video, while positive values will
  16961. sharpen it, a value of zero will disable the effect.
  16962. @end table
  16963. All parameters are optional and default to the equivalent of the
  16964. string '5:5:1.0:5:5:0.0'.
  16965. @subsection Examples
  16966. @itemize
  16967. @item
  16968. Apply strong luma sharpen effect:
  16969. @example
  16970. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16971. @end example
  16972. @item
  16973. Apply a strong blur of both luma and chroma parameters:
  16974. @example
  16975. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16976. @end example
  16977. @end itemize
  16978. @section xfade_opencl
  16979. Cross fade two videos with custom transition effect by using OpenCL.
  16980. It accepts the following options:
  16981. @table @option
  16982. @item transition
  16983. Set one of possible transition effects.
  16984. @table @option
  16985. @item custom
  16986. Select custom transition effect, the actual transition description
  16987. will be picked from source and kernel options.
  16988. @item fade
  16989. @item wipeleft
  16990. @item wiperight
  16991. @item wipeup
  16992. @item wipedown
  16993. @item slideleft
  16994. @item slideright
  16995. @item slideup
  16996. @item slidedown
  16997. Default transition is fade.
  16998. @end table
  16999. @item source
  17000. OpenCL program source file for custom transition.
  17001. @item kernel
  17002. Set name of kernel to use for custom transition from program source file.
  17003. @item duration
  17004. Set duration of video transition.
  17005. @item offset
  17006. Set time of start of transition relative to first video.
  17007. @end table
  17008. The program source file must contain a kernel function with the given name,
  17009. which will be run once for each plane of the output. Each run on a plane
  17010. gets enqueued as a separate 2D global NDRange with one work-item for each
  17011. pixel to be generated. The global ID offset for each work-item is therefore
  17012. the coordinates of a pixel in the destination image.
  17013. The kernel function needs to take the following arguments:
  17014. @itemize
  17015. @item
  17016. Destination image, @var{__write_only image2d_t}.
  17017. This image will become the output; the kernel should write all of it.
  17018. @item
  17019. First Source image, @var{__read_only image2d_t}.
  17020. Second Source image, @var{__read_only image2d_t}.
  17021. These are the most recent images on each input. The kernel may read from
  17022. them to generate the output, but they can't be written to.
  17023. @item
  17024. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  17025. @end itemize
  17026. Example programs:
  17027. @itemize
  17028. @item
  17029. Apply dots curtain transition effect:
  17030. @verbatim
  17031. __kernel void blend_images(__write_only image2d_t dst,
  17032. __read_only image2d_t src1,
  17033. __read_only image2d_t src2,
  17034. float progress)
  17035. {
  17036. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17037. CLK_FILTER_LINEAR);
  17038. int2 p = (int2)(get_global_id(0), get_global_id(1));
  17039. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  17040. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  17041. rp = rp / dim;
  17042. float2 dots = (float2)(20.0, 20.0);
  17043. float2 center = (float2)(0,0);
  17044. float2 unused;
  17045. float4 val1 = read_imagef(src1, sampler, p);
  17046. float4 val2 = read_imagef(src2, sampler, p);
  17047. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  17048. write_imagef(dst, p, next ? val1 : val2);
  17049. }
  17050. @end verbatim
  17051. @end itemize
  17052. @c man end OPENCL VIDEO FILTERS
  17053. @chapter VAAPI Video Filters
  17054. @c man begin VAAPI VIDEO FILTERS
  17055. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  17056. To enable compilation of these filters you need to configure FFmpeg with
  17057. @code{--enable-vaapi}.
  17058. 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}
  17059. @section tonemap_vaapi
  17060. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  17061. It maps the dynamic range of HDR10 content to the SDR content.
  17062. It currently only accepts HDR10 as input.
  17063. It accepts the following parameters:
  17064. @table @option
  17065. @item format
  17066. Specify the output pixel format.
  17067. Currently supported formats are:
  17068. @table @var
  17069. @item p010
  17070. @item nv12
  17071. @end table
  17072. Default is nv12.
  17073. @item primaries, p
  17074. Set the output color primaries.
  17075. Default is same as input.
  17076. @item transfer, t
  17077. Set the output transfer characteristics.
  17078. Default is bt709.
  17079. @item matrix, m
  17080. Set the output colorspace matrix.
  17081. Default is same as input.
  17082. @end table
  17083. @subsection Example
  17084. @itemize
  17085. @item
  17086. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17087. @example
  17088. tonemap_vaapi=format=p010:t=bt2020-10
  17089. @end example
  17090. @end itemize
  17091. @c man end VAAPI VIDEO FILTERS
  17092. @chapter Video Sources
  17093. @c man begin VIDEO SOURCES
  17094. Below is a description of the currently available video sources.
  17095. @section buffer
  17096. Buffer video frames, and make them available to the filter chain.
  17097. This source is mainly intended for a programmatic use, in particular
  17098. through the interface defined in @file{libavfilter/buffersrc.h}.
  17099. It accepts the following parameters:
  17100. @table @option
  17101. @item video_size
  17102. Specify the size (width and height) of the buffered video frames. For the
  17103. syntax of this option, check the
  17104. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17105. @item width
  17106. The input video width.
  17107. @item height
  17108. The input video height.
  17109. @item pix_fmt
  17110. A string representing the pixel format of the buffered video frames.
  17111. It may be a number corresponding to a pixel format, or a pixel format
  17112. name.
  17113. @item time_base
  17114. Specify the timebase assumed by the timestamps of the buffered frames.
  17115. @item frame_rate
  17116. Specify the frame rate expected for the video stream.
  17117. @item pixel_aspect, sar
  17118. The sample (pixel) aspect ratio of the input video.
  17119. @item sws_param
  17120. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17121. to the filtergraph description to specify swscale flags for automatically
  17122. inserted scalers. See @ref{Filtergraph syntax}.
  17123. @item hw_frames_ctx
  17124. When using a hardware pixel format, this should be a reference to an
  17125. AVHWFramesContext describing input frames.
  17126. @end table
  17127. For example:
  17128. @example
  17129. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17130. @end example
  17131. will instruct the source to accept video frames with size 320x240 and
  17132. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17133. square pixels (1:1 sample aspect ratio).
  17134. Since the pixel format with name "yuv410p" corresponds to the number 6
  17135. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17136. this example corresponds to:
  17137. @example
  17138. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17139. @end example
  17140. Alternatively, the options can be specified as a flat string, but this
  17141. syntax is deprecated:
  17142. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17143. @section cellauto
  17144. Create a pattern generated by an elementary cellular automaton.
  17145. The initial state of the cellular automaton can be defined through the
  17146. @option{filename} and @option{pattern} options. If such options are
  17147. not specified an initial state is created randomly.
  17148. At each new frame a new row in the video is filled with the result of
  17149. the cellular automaton next generation. The behavior when the whole
  17150. frame is filled is defined by the @option{scroll} option.
  17151. This source accepts the following options:
  17152. @table @option
  17153. @item filename, f
  17154. Read the initial cellular automaton state, i.e. the starting row, from
  17155. the specified file.
  17156. In the file, each non-whitespace character is considered an alive
  17157. cell, a newline will terminate the row, and further characters in the
  17158. file will be ignored.
  17159. @item pattern, p
  17160. Read the initial cellular automaton state, i.e. the starting row, from
  17161. the specified string.
  17162. Each non-whitespace character in the string is considered an alive
  17163. cell, a newline will terminate the row, and further characters in the
  17164. string will be ignored.
  17165. @item rate, r
  17166. Set the video rate, that is the number of frames generated per second.
  17167. Default is 25.
  17168. @item random_fill_ratio, ratio
  17169. Set the random fill ratio for the initial cellular automaton row. It
  17170. is a floating point number value ranging from 0 to 1, defaults to
  17171. 1/PHI.
  17172. This option is ignored when a file or a pattern is specified.
  17173. @item random_seed, seed
  17174. Set the seed for filling randomly the initial row, must be an integer
  17175. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17176. set to -1, the filter will try to use a good random seed on a best
  17177. effort basis.
  17178. @item rule
  17179. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17180. Default value is 110.
  17181. @item size, s
  17182. Set the size of the output video. For the syntax of this option, check the
  17183. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17184. If @option{filename} or @option{pattern} is specified, the size is set
  17185. by default to the width of the specified initial state row, and the
  17186. height is set to @var{width} * PHI.
  17187. If @option{size} is set, it must contain the width of the specified
  17188. pattern string, and the specified pattern will be centered in the
  17189. larger row.
  17190. If a filename or a pattern string is not specified, the size value
  17191. defaults to "320x518" (used for a randomly generated initial state).
  17192. @item scroll
  17193. If set to 1, scroll the output upward when all the rows in the output
  17194. have been already filled. If set to 0, the new generated row will be
  17195. written over the top row just after the bottom row is filled.
  17196. Defaults to 1.
  17197. @item start_full, full
  17198. If set to 1, completely fill the output with generated rows before
  17199. outputting the first frame.
  17200. This is the default behavior, for disabling set the value to 0.
  17201. @item stitch
  17202. If set to 1, stitch the left and right row edges together.
  17203. This is the default behavior, for disabling set the value to 0.
  17204. @end table
  17205. @subsection Examples
  17206. @itemize
  17207. @item
  17208. Read the initial state from @file{pattern}, and specify an output of
  17209. size 200x400.
  17210. @example
  17211. cellauto=f=pattern:s=200x400
  17212. @end example
  17213. @item
  17214. Generate a random initial row with a width of 200 cells, with a fill
  17215. ratio of 2/3:
  17216. @example
  17217. cellauto=ratio=2/3:s=200x200
  17218. @end example
  17219. @item
  17220. Create a pattern generated by rule 18 starting by a single alive cell
  17221. centered on an initial row with width 100:
  17222. @example
  17223. cellauto=p=@@:s=100x400:full=0:rule=18
  17224. @end example
  17225. @item
  17226. Specify a more elaborated initial pattern:
  17227. @example
  17228. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17229. @end example
  17230. @end itemize
  17231. @anchor{coreimagesrc}
  17232. @section coreimagesrc
  17233. Video source generated on GPU using Apple's CoreImage API on OSX.
  17234. This video source is a specialized version of the @ref{coreimage} video filter.
  17235. Use a core image generator at the beginning of the applied filterchain to
  17236. generate the content.
  17237. The coreimagesrc video source accepts the following options:
  17238. @table @option
  17239. @item list_generators
  17240. List all available generators along with all their respective options as well as
  17241. possible minimum and maximum values along with the default values.
  17242. @example
  17243. list_generators=true
  17244. @end example
  17245. @item size, s
  17246. Specify the size of the sourced video. For the syntax of this option, check the
  17247. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17248. The default value is @code{320x240}.
  17249. @item rate, r
  17250. Specify the frame rate of the sourced video, as the number of frames
  17251. generated per second. It has to be a string in the format
  17252. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17253. number or a valid video frame rate abbreviation. The default value is
  17254. "25".
  17255. @item sar
  17256. Set the sample aspect ratio of the sourced video.
  17257. @item duration, d
  17258. Set the duration of the sourced video. See
  17259. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17260. for the accepted syntax.
  17261. If not specified, or the expressed duration is negative, the video is
  17262. supposed to be generated forever.
  17263. @end table
  17264. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17265. A complete filterchain can be used for further processing of the
  17266. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17267. and examples for details.
  17268. @subsection Examples
  17269. @itemize
  17270. @item
  17271. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17272. given as complete and escaped command-line for Apple's standard bash shell:
  17273. @example
  17274. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17275. @end example
  17276. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17277. need for a nullsrc video source.
  17278. @end itemize
  17279. @section gradients
  17280. Generate several gradients.
  17281. @table @option
  17282. @item size, s
  17283. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17284. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17285. @item rate, r
  17286. Set frame rate, expressed as number of frames per second. Default
  17287. value is "25".
  17288. @item c0, c1, c2, c3, c4, c5, c6, c7
  17289. Set 8 colors. Default values for colors is to pick random one.
  17290. @item x0, y0, y0, y1
  17291. Set gradient line source and destination points. If negative or out of range, random ones
  17292. are picked.
  17293. @item nb_colors, n
  17294. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17295. @item seed
  17296. Set seed for picking gradient line points.
  17297. @item duration, d
  17298. Set the duration of the sourced video. See
  17299. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17300. for the accepted syntax.
  17301. If not specified, or the expressed duration is negative, the video is
  17302. supposed to be generated forever.
  17303. @item speed
  17304. Set speed of gradients rotation.
  17305. @end table
  17306. @section mandelbrot
  17307. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17308. point specified with @var{start_x} and @var{start_y}.
  17309. This source accepts the following options:
  17310. @table @option
  17311. @item end_pts
  17312. Set the terminal pts value. Default value is 400.
  17313. @item end_scale
  17314. Set the terminal scale value.
  17315. Must be a floating point value. Default value is 0.3.
  17316. @item inner
  17317. Set the inner coloring mode, that is the algorithm used to draw the
  17318. Mandelbrot fractal internal region.
  17319. It shall assume one of the following values:
  17320. @table @option
  17321. @item black
  17322. Set black mode.
  17323. @item convergence
  17324. Show time until convergence.
  17325. @item mincol
  17326. Set color based on point closest to the origin of the iterations.
  17327. @item period
  17328. Set period mode.
  17329. @end table
  17330. Default value is @var{mincol}.
  17331. @item bailout
  17332. Set the bailout value. Default value is 10.0.
  17333. @item maxiter
  17334. Set the maximum of iterations performed by the rendering
  17335. algorithm. Default value is 7189.
  17336. @item outer
  17337. Set outer coloring mode.
  17338. It shall assume one of following values:
  17339. @table @option
  17340. @item iteration_count
  17341. Set iteration count mode.
  17342. @item normalized_iteration_count
  17343. set normalized iteration count mode.
  17344. @end table
  17345. Default value is @var{normalized_iteration_count}.
  17346. @item rate, r
  17347. Set frame rate, expressed as number of frames per second. Default
  17348. value is "25".
  17349. @item size, s
  17350. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17351. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17352. @item start_scale
  17353. Set the initial scale value. Default value is 3.0.
  17354. @item start_x
  17355. Set the initial x position. Must be a floating point value between
  17356. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17357. @item start_y
  17358. Set the initial y position. Must be a floating point value between
  17359. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17360. @end table
  17361. @section mptestsrc
  17362. Generate various test patterns, as generated by the MPlayer test filter.
  17363. The size of the generated video is fixed, and is 256x256.
  17364. This source is useful in particular for testing encoding features.
  17365. This source accepts the following options:
  17366. @table @option
  17367. @item rate, r
  17368. Specify the frame rate of the sourced video, as the number of frames
  17369. generated per second. It has to be a string in the format
  17370. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17371. number or a valid video frame rate abbreviation. The default value is
  17372. "25".
  17373. @item duration, d
  17374. Set the duration of the sourced video. See
  17375. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17376. for the accepted syntax.
  17377. If not specified, or the expressed duration is negative, the video is
  17378. supposed to be generated forever.
  17379. @item test, t
  17380. Set the number or the name of the test to perform. Supported tests are:
  17381. @table @option
  17382. @item dc_luma
  17383. @item dc_chroma
  17384. @item freq_luma
  17385. @item freq_chroma
  17386. @item amp_luma
  17387. @item amp_chroma
  17388. @item cbp
  17389. @item mv
  17390. @item ring1
  17391. @item ring2
  17392. @item all
  17393. @item max_frames, m
  17394. Set the maximum number of frames generated for each test, default value is 30.
  17395. @end table
  17396. Default value is "all", which will cycle through the list of all tests.
  17397. @end table
  17398. Some examples:
  17399. @example
  17400. mptestsrc=t=dc_luma
  17401. @end example
  17402. will generate a "dc_luma" test pattern.
  17403. @section frei0r_src
  17404. Provide a frei0r source.
  17405. To enable compilation of this filter you need to install the frei0r
  17406. header and configure FFmpeg with @code{--enable-frei0r}.
  17407. This source accepts the following parameters:
  17408. @table @option
  17409. @item size
  17410. The size of the video to generate. For the syntax of this option, check the
  17411. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17412. @item framerate
  17413. The framerate of the generated video. It may be a string of the form
  17414. @var{num}/@var{den} or a frame rate abbreviation.
  17415. @item filter_name
  17416. The name to the frei0r source to load. For more information regarding frei0r and
  17417. how to set the parameters, read the @ref{frei0r} section in the video filters
  17418. documentation.
  17419. @item filter_params
  17420. A '|'-separated list of parameters to pass to the frei0r source.
  17421. @end table
  17422. For example, to generate a frei0r partik0l source with size 200x200
  17423. and frame rate 10 which is overlaid on the overlay filter main input:
  17424. @example
  17425. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17426. @end example
  17427. @section life
  17428. Generate a life pattern.
  17429. This source is based on a generalization of John Conway's life game.
  17430. The sourced input represents a life grid, each pixel represents a cell
  17431. which can be in one of two possible states, alive or dead. Every cell
  17432. interacts with its eight neighbours, which are the cells that are
  17433. horizontally, vertically, or diagonally adjacent.
  17434. At each interaction the grid evolves according to the adopted rule,
  17435. which specifies the number of neighbor alive cells which will make a
  17436. cell stay alive or born. The @option{rule} option allows one to specify
  17437. the rule to adopt.
  17438. This source accepts the following options:
  17439. @table @option
  17440. @item filename, f
  17441. Set the file from which to read the initial grid state. In the file,
  17442. each non-whitespace character is considered an alive cell, and newline
  17443. is used to delimit the end of each row.
  17444. If this option is not specified, the initial grid is generated
  17445. randomly.
  17446. @item rate, r
  17447. Set the video rate, that is the number of frames generated per second.
  17448. Default is 25.
  17449. @item random_fill_ratio, ratio
  17450. Set the random fill ratio for the initial random grid. It is a
  17451. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17452. It is ignored when a file is specified.
  17453. @item random_seed, seed
  17454. Set the seed for filling the initial random grid, must be an integer
  17455. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17456. set to -1, the filter will try to use a good random seed on a best
  17457. effort basis.
  17458. @item rule
  17459. Set the life rule.
  17460. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17461. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17462. @var{NS} specifies the number of alive neighbor cells which make a
  17463. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17464. which make a dead cell to become alive (i.e. to "born").
  17465. "s" and "b" can be used in place of "S" and "B", respectively.
  17466. Alternatively a rule can be specified by an 18-bits integer. The 9
  17467. high order bits are used to encode the next cell state if it is alive
  17468. for each number of neighbor alive cells, the low order bits specify
  17469. the rule for "borning" new cells. Higher order bits encode for an
  17470. higher number of neighbor cells.
  17471. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17472. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17473. Default value is "S23/B3", which is the original Conway's game of life
  17474. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17475. cells, and will born a new cell if there are three alive cells around
  17476. a dead cell.
  17477. @item size, s
  17478. Set the size of the output video. For the syntax of this option, check the
  17479. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17480. If @option{filename} is specified, the size is set by default to the
  17481. same size of the input file. If @option{size} is set, it must contain
  17482. the size specified in the input file, and the initial grid defined in
  17483. that file is centered in the larger resulting area.
  17484. If a filename is not specified, the size value defaults to "320x240"
  17485. (used for a randomly generated initial grid).
  17486. @item stitch
  17487. If set to 1, stitch the left and right grid edges together, and the
  17488. top and bottom edges also. Defaults to 1.
  17489. @item mold
  17490. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17491. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17492. value from 0 to 255.
  17493. @item life_color
  17494. Set the color of living (or new born) cells.
  17495. @item death_color
  17496. Set the color of dead cells. If @option{mold} is set, this is the first color
  17497. used to represent a dead cell.
  17498. @item mold_color
  17499. Set mold color, for definitely dead and moldy cells.
  17500. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17501. ffmpeg-utils manual,ffmpeg-utils}.
  17502. @end table
  17503. @subsection Examples
  17504. @itemize
  17505. @item
  17506. Read a grid from @file{pattern}, and center it on a grid of size
  17507. 300x300 pixels:
  17508. @example
  17509. life=f=pattern:s=300x300
  17510. @end example
  17511. @item
  17512. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17513. @example
  17514. life=ratio=2/3:s=200x200
  17515. @end example
  17516. @item
  17517. Specify a custom rule for evolving a randomly generated grid:
  17518. @example
  17519. life=rule=S14/B34
  17520. @end example
  17521. @item
  17522. Full example with slow death effect (mold) using @command{ffplay}:
  17523. @example
  17524. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17525. @end example
  17526. @end itemize
  17527. @anchor{allrgb}
  17528. @anchor{allyuv}
  17529. @anchor{color}
  17530. @anchor{haldclutsrc}
  17531. @anchor{nullsrc}
  17532. @anchor{pal75bars}
  17533. @anchor{pal100bars}
  17534. @anchor{rgbtestsrc}
  17535. @anchor{smptebars}
  17536. @anchor{smptehdbars}
  17537. @anchor{testsrc}
  17538. @anchor{testsrc2}
  17539. @anchor{yuvtestsrc}
  17540. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17541. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17542. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17543. The @code{color} source provides an uniformly colored input.
  17544. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17545. @ref{haldclut} filter.
  17546. The @code{nullsrc} source returns unprocessed video frames. It is
  17547. mainly useful to be employed in analysis / debugging tools, or as the
  17548. source for filters which ignore the input data.
  17549. The @code{pal75bars} source generates a color bars pattern, based on
  17550. EBU PAL recommendations with 75% color levels.
  17551. The @code{pal100bars} source generates a color bars pattern, based on
  17552. EBU PAL recommendations with 100% color levels.
  17553. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17554. detecting RGB vs BGR issues. You should see a red, green and blue
  17555. stripe from top to bottom.
  17556. The @code{smptebars} source generates a color bars pattern, based on
  17557. the SMPTE Engineering Guideline EG 1-1990.
  17558. The @code{smptehdbars} source generates a color bars pattern, based on
  17559. the SMPTE RP 219-2002.
  17560. The @code{testsrc} source generates a test video pattern, showing a
  17561. color pattern, a scrolling gradient and a timestamp. This is mainly
  17562. intended for testing purposes.
  17563. The @code{testsrc2} source is similar to testsrc, but supports more
  17564. pixel formats instead of just @code{rgb24}. This allows using it as an
  17565. input for other tests without requiring a format conversion.
  17566. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17567. see a y, cb and cr stripe from top to bottom.
  17568. The sources accept the following parameters:
  17569. @table @option
  17570. @item level
  17571. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17572. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17573. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17574. coded on a @code{1/(N*N)} scale.
  17575. @item color, c
  17576. Specify the color of the source, only available in the @code{color}
  17577. source. For the syntax of this option, check the
  17578. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17579. @item size, s
  17580. Specify the size of the sourced video. For the syntax of this option, check the
  17581. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17582. The default value is @code{320x240}.
  17583. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17584. @code{haldclutsrc} filters.
  17585. @item rate, r
  17586. Specify the frame rate of the sourced video, as the number of frames
  17587. generated per second. It has to be a string in the format
  17588. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17589. number or a valid video frame rate abbreviation. The default value is
  17590. "25".
  17591. @item duration, d
  17592. Set the duration of the sourced video. See
  17593. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17594. for the accepted syntax.
  17595. If not specified, or the expressed duration is negative, the video is
  17596. supposed to be generated forever.
  17597. Since the frame rate is used as time base, all frames including the last one
  17598. will have their full duration. If the specified duration is not a multiple
  17599. of the frame duration, it will be rounded up.
  17600. @item sar
  17601. Set the sample aspect ratio of the sourced video.
  17602. @item alpha
  17603. Specify the alpha (opacity) of the background, only available in the
  17604. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17605. 255 (fully opaque, the default).
  17606. @item decimals, n
  17607. Set the number of decimals to show in the timestamp, only available in the
  17608. @code{testsrc} source.
  17609. The displayed timestamp value will correspond to the original
  17610. timestamp value multiplied by the power of 10 of the specified
  17611. value. Default value is 0.
  17612. @end table
  17613. @subsection Examples
  17614. @itemize
  17615. @item
  17616. Generate a video with a duration of 5.3 seconds, with size
  17617. 176x144 and a frame rate of 10 frames per second:
  17618. @example
  17619. testsrc=duration=5.3:size=qcif:rate=10
  17620. @end example
  17621. @item
  17622. The following graph description will generate a red source
  17623. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17624. frames per second:
  17625. @example
  17626. color=c=red@@0.2:s=qcif:r=10
  17627. @end example
  17628. @item
  17629. If the input content is to be ignored, @code{nullsrc} can be used. The
  17630. following command generates noise in the luminance plane by employing
  17631. the @code{geq} filter:
  17632. @example
  17633. nullsrc=s=256x256, geq=random(1)*255:128:128
  17634. @end example
  17635. @end itemize
  17636. @subsection Commands
  17637. The @code{color} source supports the following commands:
  17638. @table @option
  17639. @item c, color
  17640. Set the color of the created image. Accepts the same syntax of the
  17641. corresponding @option{color} option.
  17642. @end table
  17643. @section openclsrc
  17644. Generate video using an OpenCL program.
  17645. @table @option
  17646. @item source
  17647. OpenCL program source file.
  17648. @item kernel
  17649. Kernel name in program.
  17650. @item size, s
  17651. Size of frames to generate. This must be set.
  17652. @item format
  17653. Pixel format to use for the generated frames. This must be set.
  17654. @item rate, r
  17655. Number of frames generated every second. Default value is '25'.
  17656. @end table
  17657. For details of how the program loading works, see the @ref{program_opencl}
  17658. filter.
  17659. Example programs:
  17660. @itemize
  17661. @item
  17662. Generate a colour ramp by setting pixel values from the position of the pixel
  17663. in the output image. (Note that this will work with all pixel formats, but
  17664. the generated output will not be the same.)
  17665. @verbatim
  17666. __kernel void ramp(__write_only image2d_t dst,
  17667. unsigned int index)
  17668. {
  17669. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17670. float4 val;
  17671. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17672. write_imagef(dst, loc, val);
  17673. }
  17674. @end verbatim
  17675. @item
  17676. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17677. @verbatim
  17678. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17679. unsigned int index)
  17680. {
  17681. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17682. float4 value = 0.0f;
  17683. int x = loc.x + index;
  17684. int y = loc.y + index;
  17685. while (x > 0 || y > 0) {
  17686. if (x % 3 == 1 && y % 3 == 1) {
  17687. value = 1.0f;
  17688. break;
  17689. }
  17690. x /= 3;
  17691. y /= 3;
  17692. }
  17693. write_imagef(dst, loc, value);
  17694. }
  17695. @end verbatim
  17696. @end itemize
  17697. @section sierpinski
  17698. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17699. This source accepts the following options:
  17700. @table @option
  17701. @item size, s
  17702. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17703. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17704. @item rate, r
  17705. Set frame rate, expressed as number of frames per second. Default
  17706. value is "25".
  17707. @item seed
  17708. Set seed which is used for random panning.
  17709. @item jump
  17710. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17711. @item type
  17712. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17713. @end table
  17714. @c man end VIDEO SOURCES
  17715. @chapter Video Sinks
  17716. @c man begin VIDEO SINKS
  17717. Below is a description of the currently available video sinks.
  17718. @section buffersink
  17719. Buffer video frames, and make them available to the end of the filter
  17720. graph.
  17721. This sink is mainly intended for programmatic use, in particular
  17722. through the interface defined in @file{libavfilter/buffersink.h}
  17723. or the options system.
  17724. It accepts a pointer to an AVBufferSinkContext structure, which
  17725. defines the incoming buffers' formats, to be passed as the opaque
  17726. parameter to @code{avfilter_init_filter} for initialization.
  17727. @section nullsink
  17728. Null video sink: do absolutely nothing with the input video. It is
  17729. mainly useful as a template and for use in analysis / debugging
  17730. tools.
  17731. @c man end VIDEO SINKS
  17732. @chapter Multimedia Filters
  17733. @c man begin MULTIMEDIA FILTERS
  17734. Below is a description of the currently available multimedia filters.
  17735. @section abitscope
  17736. Convert input audio to a video output, displaying the audio bit scope.
  17737. The filter accepts the following options:
  17738. @table @option
  17739. @item rate, r
  17740. Set frame rate, expressed as number of frames per second. Default
  17741. value is "25".
  17742. @item size, s
  17743. Specify the video size for the output. For the syntax of this option, check the
  17744. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17745. Default value is @code{1024x256}.
  17746. @item colors
  17747. Specify list of colors separated by space or by '|' which will be used to
  17748. draw channels. Unrecognized or missing colors will be replaced
  17749. by white color.
  17750. @end table
  17751. @section adrawgraph
  17752. Draw a graph using input audio metadata.
  17753. See @ref{drawgraph}
  17754. @section agraphmonitor
  17755. See @ref{graphmonitor}.
  17756. @section ahistogram
  17757. Convert input audio to a video output, displaying the volume histogram.
  17758. The filter accepts the following options:
  17759. @table @option
  17760. @item dmode
  17761. Specify how histogram is calculated.
  17762. It accepts the following values:
  17763. @table @samp
  17764. @item single
  17765. Use single histogram for all channels.
  17766. @item separate
  17767. Use separate histogram for each channel.
  17768. @end table
  17769. Default is @code{single}.
  17770. @item rate, r
  17771. Set frame rate, expressed as number of frames per second. Default
  17772. value is "25".
  17773. @item size, s
  17774. Specify the video size for the output. For the syntax of this option, check the
  17775. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17776. Default value is @code{hd720}.
  17777. @item scale
  17778. Set display scale.
  17779. It accepts the following values:
  17780. @table @samp
  17781. @item log
  17782. logarithmic
  17783. @item sqrt
  17784. square root
  17785. @item cbrt
  17786. cubic root
  17787. @item lin
  17788. linear
  17789. @item rlog
  17790. reverse logarithmic
  17791. @end table
  17792. Default is @code{log}.
  17793. @item ascale
  17794. Set amplitude scale.
  17795. It accepts the following values:
  17796. @table @samp
  17797. @item log
  17798. logarithmic
  17799. @item lin
  17800. linear
  17801. @end table
  17802. Default is @code{log}.
  17803. @item acount
  17804. Set how much frames to accumulate in histogram.
  17805. Default is 1. Setting this to -1 accumulates all frames.
  17806. @item rheight
  17807. Set histogram ratio of window height.
  17808. @item slide
  17809. Set sonogram sliding.
  17810. It accepts the following values:
  17811. @table @samp
  17812. @item replace
  17813. replace old rows with new ones.
  17814. @item scroll
  17815. scroll from top to bottom.
  17816. @end table
  17817. Default is @code{replace}.
  17818. @end table
  17819. @section aphasemeter
  17820. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17821. representing mean phase of current audio frame. A video output can also be produced and is
  17822. enabled by default. The audio is passed through as first output.
  17823. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17824. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17825. and @code{1} means channels are in phase.
  17826. The filter accepts the following options, all related to its video output:
  17827. @table @option
  17828. @item rate, r
  17829. Set the output frame rate. Default value is @code{25}.
  17830. @item size, s
  17831. Set the video size for the output. For the syntax of this option, check the
  17832. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17833. Default value is @code{800x400}.
  17834. @item rc
  17835. @item gc
  17836. @item bc
  17837. Specify the red, green, blue contrast. Default values are @code{2},
  17838. @code{7} and @code{1}.
  17839. Allowed range is @code{[0, 255]}.
  17840. @item mpc
  17841. Set color which will be used for drawing median phase. If color is
  17842. @code{none} which is default, no median phase value will be drawn.
  17843. @item video
  17844. Enable video output. Default is enabled.
  17845. @end table
  17846. @subsection phasing detection
  17847. The filter also detects out of phase and mono sequences in stereo streams.
  17848. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  17849. The filter accepts the following options for this detection:
  17850. @table @option
  17851. @item phasing
  17852. Enable mono and out of phase detection. Default is disabled.
  17853. @item tolerance, t
  17854. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  17855. Allowed range is @code{[0, 1]}.
  17856. @item angle, a
  17857. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  17858. Allowed range is @code{[90, 180]}.
  17859. @item duration, d
  17860. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  17861. @end table
  17862. @subsection Examples
  17863. @itemize
  17864. @item
  17865. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  17866. @example
  17867. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  17868. @end example
  17869. @end itemize
  17870. @section avectorscope
  17871. Convert input audio to a video output, representing the audio vector
  17872. scope.
  17873. The filter is used to measure the difference between channels of stereo
  17874. audio stream. A monaural signal, consisting of identical left and right
  17875. signal, results in straight vertical line. Any stereo separation is visible
  17876. as a deviation from this line, creating a Lissajous figure.
  17877. If the straight (or deviation from it) but horizontal line appears this
  17878. indicates that the left and right channels are out of phase.
  17879. The filter accepts the following options:
  17880. @table @option
  17881. @item mode, m
  17882. Set the vectorscope mode.
  17883. Available values are:
  17884. @table @samp
  17885. @item lissajous
  17886. Lissajous rotated by 45 degrees.
  17887. @item lissajous_xy
  17888. Same as above but not rotated.
  17889. @item polar
  17890. Shape resembling half of circle.
  17891. @end table
  17892. Default value is @samp{lissajous}.
  17893. @item size, s
  17894. Set the video size for the output. For the syntax of this option, check the
  17895. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17896. Default value is @code{400x400}.
  17897. @item rate, r
  17898. Set the output frame rate. Default value is @code{25}.
  17899. @item rc
  17900. @item gc
  17901. @item bc
  17902. @item ac
  17903. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17904. @code{160}, @code{80} and @code{255}.
  17905. Allowed range is @code{[0, 255]}.
  17906. @item rf
  17907. @item gf
  17908. @item bf
  17909. @item af
  17910. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17911. @code{10}, @code{5} and @code{5}.
  17912. Allowed range is @code{[0, 255]}.
  17913. @item zoom
  17914. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17915. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17916. @item draw
  17917. Set the vectorscope drawing mode.
  17918. Available values are:
  17919. @table @samp
  17920. @item dot
  17921. Draw dot for each sample.
  17922. @item line
  17923. Draw line between previous and current sample.
  17924. @end table
  17925. Default value is @samp{dot}.
  17926. @item scale
  17927. Specify amplitude scale of audio samples.
  17928. Available values are:
  17929. @table @samp
  17930. @item lin
  17931. Linear.
  17932. @item sqrt
  17933. Square root.
  17934. @item cbrt
  17935. Cubic root.
  17936. @item log
  17937. Logarithmic.
  17938. @end table
  17939. @item swap
  17940. Swap left channel axis with right channel axis.
  17941. @item mirror
  17942. Mirror axis.
  17943. @table @samp
  17944. @item none
  17945. No mirror.
  17946. @item x
  17947. Mirror only x axis.
  17948. @item y
  17949. Mirror only y axis.
  17950. @item xy
  17951. Mirror both axis.
  17952. @end table
  17953. @end table
  17954. @subsection Examples
  17955. @itemize
  17956. @item
  17957. Complete example using @command{ffplay}:
  17958. @example
  17959. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17960. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  17961. @end example
  17962. @end itemize
  17963. @section bench, abench
  17964. Benchmark part of a filtergraph.
  17965. The filter accepts the following options:
  17966. @table @option
  17967. @item action
  17968. Start or stop a timer.
  17969. Available values are:
  17970. @table @samp
  17971. @item start
  17972. Get the current time, set it as frame metadata (using the key
  17973. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  17974. @item stop
  17975. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  17976. the input frame metadata to get the time difference. Time difference, average,
  17977. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  17978. @code{min}) are then printed. The timestamps are expressed in seconds.
  17979. @end table
  17980. @end table
  17981. @subsection Examples
  17982. @itemize
  17983. @item
  17984. Benchmark @ref{selectivecolor} filter:
  17985. @example
  17986. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17987. @end example
  17988. @end itemize
  17989. @section concat
  17990. Concatenate audio and video streams, joining them together one after the
  17991. other.
  17992. The filter works on segments of synchronized video and audio streams. All
  17993. segments must have the same number of streams of each type, and that will
  17994. also be the number of streams at output.
  17995. The filter accepts the following options:
  17996. @table @option
  17997. @item n
  17998. Set the number of segments. Default is 2.
  17999. @item v
  18000. Set the number of output video streams, that is also the number of video
  18001. streams in each segment. Default is 1.
  18002. @item a
  18003. Set the number of output audio streams, that is also the number of audio
  18004. streams in each segment. Default is 0.
  18005. @item unsafe
  18006. Activate unsafe mode: do not fail if segments have a different format.
  18007. @end table
  18008. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  18009. @var{a} audio outputs.
  18010. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  18011. segment, in the same order as the outputs, then the inputs for the second
  18012. segment, etc.
  18013. Related streams do not always have exactly the same duration, for various
  18014. reasons including codec frame size or sloppy authoring. For that reason,
  18015. related synchronized streams (e.g. a video and its audio track) should be
  18016. concatenated at once. The concat filter will use the duration of the longest
  18017. stream in each segment (except the last one), and if necessary pad shorter
  18018. audio streams with silence.
  18019. For this filter to work correctly, all segments must start at timestamp 0.
  18020. All corresponding streams must have the same parameters in all segments; the
  18021. filtering system will automatically select a common pixel format for video
  18022. streams, and a common sample format, sample rate and channel layout for
  18023. audio streams, but other settings, such as resolution, must be converted
  18024. explicitly by the user.
  18025. Different frame rates are acceptable but will result in variable frame rate
  18026. at output; be sure to configure the output file to handle it.
  18027. @subsection Examples
  18028. @itemize
  18029. @item
  18030. Concatenate an opening, an episode and an ending, all in bilingual version
  18031. (video in stream 0, audio in streams 1 and 2):
  18032. @example
  18033. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  18034. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  18035. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  18036. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  18037. @end example
  18038. @item
  18039. Concatenate two parts, handling audio and video separately, using the
  18040. (a)movie sources, and adjusting the resolution:
  18041. @example
  18042. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  18043. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  18044. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  18045. @end example
  18046. Note that a desync will happen at the stitch if the audio and video streams
  18047. do not have exactly the same duration in the first file.
  18048. @end itemize
  18049. @subsection Commands
  18050. This filter supports the following commands:
  18051. @table @option
  18052. @item next
  18053. Close the current segment and step to the next one
  18054. @end table
  18055. @anchor{ebur128}
  18056. @section ebur128
  18057. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  18058. level. By default, it logs a message at a frequency of 10Hz with the
  18059. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  18060. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  18061. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  18062. sample format is double-precision floating point. The input stream will be converted to
  18063. this specification, if needed. Users may need to insert aformat and/or aresample filters
  18064. after this filter to obtain the original parameters.
  18065. The filter also has a video output (see the @var{video} option) with a real
  18066. time graph to observe the loudness evolution. The graphic contains the logged
  18067. message mentioned above, so it is not printed anymore when this option is set,
  18068. unless the verbose logging is set. The main graphing area contains the
  18069. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  18070. the momentary loudness (400 milliseconds), but can optionally be configured
  18071. to instead display short-term loudness (see @var{gauge}).
  18072. The green area marks a +/- 1LU target range around the target loudness
  18073. (-23LUFS by default, unless modified through @var{target}).
  18074. More information about the Loudness Recommendation EBU R128 on
  18075. @url{http://tech.ebu.ch/loudness}.
  18076. The filter accepts the following options:
  18077. @table @option
  18078. @item video
  18079. Activate the video output. The audio stream is passed unchanged whether this
  18080. option is set or no. The video stream will be the first output stream if
  18081. activated. Default is @code{0}.
  18082. @item size
  18083. Set the video size. This option is for video only. For the syntax of this
  18084. option, check the
  18085. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18086. Default and minimum resolution is @code{640x480}.
  18087. @item meter
  18088. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18089. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18090. other integer value between this range is allowed.
  18091. @item metadata
  18092. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18093. into 100ms output frames, each of them containing various loudness information
  18094. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18095. Default is @code{0}.
  18096. @item framelog
  18097. Force the frame logging level.
  18098. Available values are:
  18099. @table @samp
  18100. @item info
  18101. information logging level
  18102. @item verbose
  18103. verbose logging level
  18104. @end table
  18105. By default, the logging level is set to @var{info}. If the @option{video} or
  18106. the @option{metadata} options are set, it switches to @var{verbose}.
  18107. @item peak
  18108. Set peak mode(s).
  18109. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18110. values are:
  18111. @table @samp
  18112. @item none
  18113. Disable any peak mode (default).
  18114. @item sample
  18115. Enable sample-peak mode.
  18116. Simple peak mode looking for the higher sample value. It logs a message
  18117. for sample-peak (identified by @code{SPK}).
  18118. @item true
  18119. Enable true-peak mode.
  18120. If enabled, the peak lookup is done on an over-sampled version of the input
  18121. stream for better peak accuracy. It logs a message for true-peak.
  18122. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18123. This mode requires a build with @code{libswresample}.
  18124. @end table
  18125. @item dualmono
  18126. Treat mono input files as "dual mono". If a mono file is intended for playback
  18127. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18128. If set to @code{true}, this option will compensate for this effect.
  18129. Multi-channel input files are not affected by this option.
  18130. @item panlaw
  18131. Set a specific pan law to be used for the measurement of dual mono files.
  18132. This parameter is optional, and has a default value of -3.01dB.
  18133. @item target
  18134. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18135. This parameter is optional and has a default value of -23LUFS as specified
  18136. by EBU R128. However, material published online may prefer a level of -16LUFS
  18137. (e.g. for use with podcasts or video platforms).
  18138. @item gauge
  18139. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18140. @code{shortterm}. By default the momentary value will be used, but in certain
  18141. scenarios it may be more useful to observe the short term value instead (e.g.
  18142. live mixing).
  18143. @item scale
  18144. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18145. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18146. video output, not the summary or continuous log output.
  18147. @end table
  18148. @subsection Examples
  18149. @itemize
  18150. @item
  18151. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18152. @example
  18153. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18154. @end example
  18155. @item
  18156. Run an analysis with @command{ffmpeg}:
  18157. @example
  18158. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18159. @end example
  18160. @end itemize
  18161. @section interleave, ainterleave
  18162. Temporally interleave frames from several inputs.
  18163. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18164. These filters read frames from several inputs and send the oldest
  18165. queued frame to the output.
  18166. Input streams must have well defined, monotonically increasing frame
  18167. timestamp values.
  18168. In order to submit one frame to output, these filters need to enqueue
  18169. at least one frame for each input, so they cannot work in case one
  18170. input is not yet terminated and will not receive incoming frames.
  18171. For example consider the case when one input is a @code{select} filter
  18172. which always drops input frames. The @code{interleave} filter will keep
  18173. reading from that input, but it will never be able to send new frames
  18174. to output until the input sends an end-of-stream signal.
  18175. Also, depending on inputs synchronization, the filters will drop
  18176. frames in case one input receives more frames than the other ones, and
  18177. the queue is already filled.
  18178. These filters accept the following options:
  18179. @table @option
  18180. @item nb_inputs, n
  18181. Set the number of different inputs, it is 2 by default.
  18182. @item duration
  18183. How to determine the end-of-stream.
  18184. @table @option
  18185. @item longest
  18186. The duration of the longest input. (default)
  18187. @item shortest
  18188. The duration of the shortest input.
  18189. @item first
  18190. The duration of the first input.
  18191. @end table
  18192. @end table
  18193. @subsection Examples
  18194. @itemize
  18195. @item
  18196. Interleave frames belonging to different streams using @command{ffmpeg}:
  18197. @example
  18198. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18199. @end example
  18200. @item
  18201. Add flickering blur effect:
  18202. @example
  18203. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18204. @end example
  18205. @end itemize
  18206. @section metadata, ametadata
  18207. Manipulate frame metadata.
  18208. This filter accepts the following options:
  18209. @table @option
  18210. @item mode
  18211. Set mode of operation of the filter.
  18212. Can be one of the following:
  18213. @table @samp
  18214. @item select
  18215. If both @code{value} and @code{key} is set, select frames
  18216. which have such metadata. If only @code{key} is set, select
  18217. every frame that has such key in metadata.
  18218. @item add
  18219. Add new metadata @code{key} and @code{value}. If key is already available
  18220. do nothing.
  18221. @item modify
  18222. Modify value of already present key.
  18223. @item delete
  18224. If @code{value} is set, delete only keys that have such value.
  18225. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18226. the frame.
  18227. @item print
  18228. Print key and its value if metadata was found. If @code{key} is not set print all
  18229. metadata values available in frame.
  18230. @end table
  18231. @item key
  18232. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18233. @item value
  18234. Set metadata value which will be used. This option is mandatory for
  18235. @code{modify} and @code{add} mode.
  18236. @item function
  18237. Which function to use when comparing metadata value and @code{value}.
  18238. Can be one of following:
  18239. @table @samp
  18240. @item same_str
  18241. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18242. @item starts_with
  18243. Values are interpreted as strings, returns true if metadata value starts with
  18244. the @code{value} option string.
  18245. @item less
  18246. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18247. @item equal
  18248. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18249. @item greater
  18250. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18251. @item expr
  18252. Values are interpreted as floats, returns true if expression from option @code{expr}
  18253. evaluates to true.
  18254. @item ends_with
  18255. Values are interpreted as strings, returns true if metadata value ends with
  18256. the @code{value} option string.
  18257. @end table
  18258. @item expr
  18259. Set expression which is used when @code{function} is set to @code{expr}.
  18260. The expression is evaluated through the eval API and can contain the following
  18261. constants:
  18262. @table @option
  18263. @item VALUE1
  18264. Float representation of @code{value} from metadata key.
  18265. @item VALUE2
  18266. Float representation of @code{value} as supplied by user in @code{value} option.
  18267. @end table
  18268. @item file
  18269. If specified in @code{print} mode, output is written to the named file. Instead of
  18270. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18271. for standard output. If @code{file} option is not set, output is written to the log
  18272. with AV_LOG_INFO loglevel.
  18273. @item direct
  18274. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18275. @end table
  18276. @subsection Examples
  18277. @itemize
  18278. @item
  18279. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18280. between 0 and 1.
  18281. @example
  18282. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18283. @end example
  18284. @item
  18285. Print silencedetect output to file @file{metadata.txt}.
  18286. @example
  18287. silencedetect,ametadata=mode=print:file=metadata.txt
  18288. @end example
  18289. @item
  18290. Direct all metadata to a pipe with file descriptor 4.
  18291. @example
  18292. metadata=mode=print:file='pipe\:4'
  18293. @end example
  18294. @end itemize
  18295. @section perms, aperms
  18296. Set read/write permissions for the output frames.
  18297. These filters are mainly aimed at developers to test direct path in the
  18298. following filter in the filtergraph.
  18299. The filters accept the following options:
  18300. @table @option
  18301. @item mode
  18302. Select the permissions mode.
  18303. It accepts the following values:
  18304. @table @samp
  18305. @item none
  18306. Do nothing. This is the default.
  18307. @item ro
  18308. Set all the output frames read-only.
  18309. @item rw
  18310. Set all the output frames directly writable.
  18311. @item toggle
  18312. Make the frame read-only if writable, and writable if read-only.
  18313. @item random
  18314. Set each output frame read-only or writable randomly.
  18315. @end table
  18316. @item seed
  18317. Set the seed for the @var{random} mode, must be an integer included between
  18318. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18319. @code{-1}, the filter will try to use a good random seed on a best effort
  18320. basis.
  18321. @end table
  18322. Note: in case of auto-inserted filter between the permission filter and the
  18323. following one, the permission might not be received as expected in that
  18324. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18325. perms/aperms filter can avoid this problem.
  18326. @section realtime, arealtime
  18327. Slow down filtering to match real time approximately.
  18328. These filters will pause the filtering for a variable amount of time to
  18329. match the output rate with the input timestamps.
  18330. They are similar to the @option{re} option to @code{ffmpeg}.
  18331. They accept the following options:
  18332. @table @option
  18333. @item limit
  18334. Time limit for the pauses. Any pause longer than that will be considered
  18335. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18336. @item speed
  18337. Speed factor for processing. The value must be a float larger than zero.
  18338. Values larger than 1.0 will result in faster than realtime processing,
  18339. smaller will slow processing down. The @var{limit} is automatically adapted
  18340. accordingly. Default is 1.0.
  18341. A processing speed faster than what is possible without these filters cannot
  18342. be achieved.
  18343. @end table
  18344. @anchor{select}
  18345. @section select, aselect
  18346. Select frames to pass in output.
  18347. This filter accepts the following options:
  18348. @table @option
  18349. @item expr, e
  18350. Set expression, which is evaluated for each input frame.
  18351. If the expression is evaluated to zero, the frame is discarded.
  18352. If the evaluation result is negative or NaN, the frame is sent to the
  18353. first output; otherwise it is sent to the output with index
  18354. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18355. For example a value of @code{1.2} corresponds to the output with index
  18356. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18357. @item outputs, n
  18358. Set the number of outputs. The output to which to send the selected
  18359. frame is based on the result of the evaluation. Default value is 1.
  18360. @end table
  18361. The expression can contain the following constants:
  18362. @table @option
  18363. @item n
  18364. The (sequential) number of the filtered frame, starting from 0.
  18365. @item selected_n
  18366. The (sequential) number of the selected frame, starting from 0.
  18367. @item prev_selected_n
  18368. The sequential number of the last selected frame. It's NAN if undefined.
  18369. @item TB
  18370. The timebase of the input timestamps.
  18371. @item pts
  18372. The PTS (Presentation TimeStamp) of the filtered video frame,
  18373. expressed in @var{TB} units. It's NAN if undefined.
  18374. @item t
  18375. The PTS of the filtered video frame,
  18376. expressed in seconds. It's NAN if undefined.
  18377. @item prev_pts
  18378. The PTS of the previously filtered video frame. It's NAN if undefined.
  18379. @item prev_selected_pts
  18380. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18381. @item prev_selected_t
  18382. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18383. @item start_pts
  18384. The PTS of the first video frame in the video. It's NAN if undefined.
  18385. @item start_t
  18386. The time of the first video frame in the video. It's NAN if undefined.
  18387. @item pict_type @emph{(video only)}
  18388. The type of the filtered frame. It can assume one of the following
  18389. values:
  18390. @table @option
  18391. @item I
  18392. @item P
  18393. @item B
  18394. @item S
  18395. @item SI
  18396. @item SP
  18397. @item BI
  18398. @end table
  18399. @item interlace_type @emph{(video only)}
  18400. The frame interlace type. It can assume one of the following values:
  18401. @table @option
  18402. @item PROGRESSIVE
  18403. The frame is progressive (not interlaced).
  18404. @item TOPFIRST
  18405. The frame is top-field-first.
  18406. @item BOTTOMFIRST
  18407. The frame is bottom-field-first.
  18408. @end table
  18409. @item consumed_sample_n @emph{(audio only)}
  18410. the number of selected samples before the current frame
  18411. @item samples_n @emph{(audio only)}
  18412. the number of samples in the current frame
  18413. @item sample_rate @emph{(audio only)}
  18414. the input sample rate
  18415. @item key
  18416. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18417. @item pos
  18418. the position in the file of the filtered frame, -1 if the information
  18419. is not available (e.g. for synthetic video)
  18420. @item scene @emph{(video only)}
  18421. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18422. probability for the current frame to introduce a new scene, while a higher
  18423. value means the current frame is more likely to be one (see the example below)
  18424. @item concatdec_select
  18425. The concat demuxer can select only part of a concat input file by setting an
  18426. inpoint and an outpoint, but the output packets may not be entirely contained
  18427. in the selected interval. By using this variable, it is possible to skip frames
  18428. generated by the concat demuxer which are not exactly contained in the selected
  18429. interval.
  18430. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18431. and the @var{lavf.concat.duration} packet metadata values which are also
  18432. present in the decoded frames.
  18433. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18434. start_time and either the duration metadata is missing or the frame pts is less
  18435. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18436. missing.
  18437. That basically means that an input frame is selected if its pts is within the
  18438. interval set by the concat demuxer.
  18439. @end table
  18440. The default value of the select expression is "1".
  18441. @subsection Examples
  18442. @itemize
  18443. @item
  18444. Select all frames in input:
  18445. @example
  18446. select
  18447. @end example
  18448. The example above is the same as:
  18449. @example
  18450. select=1
  18451. @end example
  18452. @item
  18453. Skip all frames:
  18454. @example
  18455. select=0
  18456. @end example
  18457. @item
  18458. Select only I-frames:
  18459. @example
  18460. select='eq(pict_type\,I)'
  18461. @end example
  18462. @item
  18463. Select one frame every 100:
  18464. @example
  18465. select='not(mod(n\,100))'
  18466. @end example
  18467. @item
  18468. Select only frames contained in the 10-20 time interval:
  18469. @example
  18470. select=between(t\,10\,20)
  18471. @end example
  18472. @item
  18473. Select only I-frames contained in the 10-20 time interval:
  18474. @example
  18475. select=between(t\,10\,20)*eq(pict_type\,I)
  18476. @end example
  18477. @item
  18478. Select frames with a minimum distance of 10 seconds:
  18479. @example
  18480. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18481. @end example
  18482. @item
  18483. Use aselect to select only audio frames with samples number > 100:
  18484. @example
  18485. aselect='gt(samples_n\,100)'
  18486. @end example
  18487. @item
  18488. Create a mosaic of the first scenes:
  18489. @example
  18490. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18491. @end example
  18492. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18493. choice.
  18494. @item
  18495. Send even and odd frames to separate outputs, and compose them:
  18496. @example
  18497. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18498. @end example
  18499. @item
  18500. Select useful frames from an ffconcat file which is using inpoints and
  18501. outpoints but where the source files are not intra frame only.
  18502. @example
  18503. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18504. @end example
  18505. @end itemize
  18506. @section sendcmd, asendcmd
  18507. Send commands to filters in the filtergraph.
  18508. These filters read commands to be sent to other filters in the
  18509. filtergraph.
  18510. @code{sendcmd} must be inserted between two video filters,
  18511. @code{asendcmd} must be inserted between two audio filters, but apart
  18512. from that they act the same way.
  18513. The specification of commands can be provided in the filter arguments
  18514. with the @var{commands} option, or in a file specified by the
  18515. @var{filename} option.
  18516. These filters accept the following options:
  18517. @table @option
  18518. @item commands, c
  18519. Set the commands to be read and sent to the other filters.
  18520. @item filename, f
  18521. Set the filename of the commands to be read and sent to the other
  18522. filters.
  18523. @end table
  18524. @subsection Commands syntax
  18525. A commands description consists of a sequence of interval
  18526. specifications, comprising a list of commands to be executed when a
  18527. particular event related to that interval occurs. The occurring event
  18528. is typically the current frame time entering or leaving a given time
  18529. interval.
  18530. An interval is specified by the following syntax:
  18531. @example
  18532. @var{START}[-@var{END}] @var{COMMANDS};
  18533. @end example
  18534. The time interval is specified by the @var{START} and @var{END} times.
  18535. @var{END} is optional and defaults to the maximum time.
  18536. The current frame time is considered within the specified interval if
  18537. it is included in the interval [@var{START}, @var{END}), that is when
  18538. the time is greater or equal to @var{START} and is lesser than
  18539. @var{END}.
  18540. @var{COMMANDS} consists of a sequence of one or more command
  18541. specifications, separated by ",", relating to that interval. The
  18542. syntax of a command specification is given by:
  18543. @example
  18544. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18545. @end example
  18546. @var{FLAGS} is optional and specifies the type of events relating to
  18547. the time interval which enable sending the specified command, and must
  18548. be a non-null sequence of identifier flags separated by "+" or "|" and
  18549. enclosed between "[" and "]".
  18550. The following flags are recognized:
  18551. @table @option
  18552. @item enter
  18553. The command is sent when the current frame timestamp enters the
  18554. specified interval. In other words, the command is sent when the
  18555. previous frame timestamp was not in the given interval, and the
  18556. current is.
  18557. @item leave
  18558. The command is sent when the current frame timestamp leaves the
  18559. specified interval. In other words, the command is sent when the
  18560. previous frame timestamp was in the given interval, and the
  18561. current is not.
  18562. @item expr
  18563. The command @var{ARG} is interpreted as expression and result of
  18564. expression is passed as @var{ARG}.
  18565. The expression is evaluated through the eval API and can contain the following
  18566. constants:
  18567. @table @option
  18568. @item POS
  18569. Original position in the file of the frame, or undefined if undefined
  18570. for the current frame.
  18571. @item PTS
  18572. The presentation timestamp in input.
  18573. @item N
  18574. The count of the input frame for video or audio, starting from 0.
  18575. @item T
  18576. The time in seconds of the current frame.
  18577. @item TS
  18578. The start time in seconds of the current command interval.
  18579. @item TE
  18580. The end time in seconds of the current command interval.
  18581. @item TI
  18582. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18583. @end table
  18584. @end table
  18585. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18586. assumed.
  18587. @var{TARGET} specifies the target of the command, usually the name of
  18588. the filter class or a specific filter instance name.
  18589. @var{COMMAND} specifies the name of the command for the target filter.
  18590. @var{ARG} is optional and specifies the optional list of argument for
  18591. the given @var{COMMAND}.
  18592. Between one interval specification and another, whitespaces, or
  18593. sequences of characters starting with @code{#} until the end of line,
  18594. are ignored and can be used to annotate comments.
  18595. A simplified BNF description of the commands specification syntax
  18596. follows:
  18597. @example
  18598. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18599. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18600. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18601. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18602. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18603. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18604. @end example
  18605. @subsection Examples
  18606. @itemize
  18607. @item
  18608. Specify audio tempo change at second 4:
  18609. @example
  18610. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18611. @end example
  18612. @item
  18613. Target a specific filter instance:
  18614. @example
  18615. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18616. @end example
  18617. @item
  18618. Specify a list of drawtext and hue commands in a file.
  18619. @example
  18620. # show text in the interval 5-10
  18621. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18622. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18623. # desaturate the image in the interval 15-20
  18624. 15.0-20.0 [enter] hue s 0,
  18625. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18626. [leave] hue s 1,
  18627. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18628. # apply an exponential saturation fade-out effect, starting from time 25
  18629. 25 [enter] hue s exp(25-t)
  18630. @end example
  18631. A filtergraph allowing to read and process the above command list
  18632. stored in a file @file{test.cmd}, can be specified with:
  18633. @example
  18634. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18635. @end example
  18636. @end itemize
  18637. @anchor{setpts}
  18638. @section setpts, asetpts
  18639. Change the PTS (presentation timestamp) of the input frames.
  18640. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18641. This filter accepts the following options:
  18642. @table @option
  18643. @item expr
  18644. The expression which is evaluated for each frame to construct its timestamp.
  18645. @end table
  18646. The expression is evaluated through the eval API and can contain the following
  18647. constants:
  18648. @table @option
  18649. @item FRAME_RATE, FR
  18650. frame rate, only defined for constant frame-rate video
  18651. @item PTS
  18652. The presentation timestamp in input
  18653. @item N
  18654. The count of the input frame for video or the number of consumed samples,
  18655. not including the current frame for audio, starting from 0.
  18656. @item NB_CONSUMED_SAMPLES
  18657. The number of consumed samples, not including the current frame (only
  18658. audio)
  18659. @item NB_SAMPLES, S
  18660. The number of samples in the current frame (only audio)
  18661. @item SAMPLE_RATE, SR
  18662. The audio sample rate.
  18663. @item STARTPTS
  18664. The PTS of the first frame.
  18665. @item STARTT
  18666. the time in seconds of the first frame
  18667. @item INTERLACED
  18668. State whether the current frame is interlaced.
  18669. @item T
  18670. the time in seconds of the current frame
  18671. @item POS
  18672. original position in the file of the frame, or undefined if undefined
  18673. for the current frame
  18674. @item PREV_INPTS
  18675. The previous input PTS.
  18676. @item PREV_INT
  18677. previous input time in seconds
  18678. @item PREV_OUTPTS
  18679. The previous output PTS.
  18680. @item PREV_OUTT
  18681. previous output time in seconds
  18682. @item RTCTIME
  18683. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18684. instead.
  18685. @item RTCSTART
  18686. The wallclock (RTC) time at the start of the movie in microseconds.
  18687. @item TB
  18688. The timebase of the input timestamps.
  18689. @end table
  18690. @subsection Examples
  18691. @itemize
  18692. @item
  18693. Start counting PTS from zero
  18694. @example
  18695. setpts=PTS-STARTPTS
  18696. @end example
  18697. @item
  18698. Apply fast motion effect:
  18699. @example
  18700. setpts=0.5*PTS
  18701. @end example
  18702. @item
  18703. Apply slow motion effect:
  18704. @example
  18705. setpts=2.0*PTS
  18706. @end example
  18707. @item
  18708. Set fixed rate of 25 frames per second:
  18709. @example
  18710. setpts=N/(25*TB)
  18711. @end example
  18712. @item
  18713. Set fixed rate 25 fps with some jitter:
  18714. @example
  18715. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18716. @end example
  18717. @item
  18718. Apply an offset of 10 seconds to the input PTS:
  18719. @example
  18720. setpts=PTS+10/TB
  18721. @end example
  18722. @item
  18723. Generate timestamps from a "live source" and rebase onto the current timebase:
  18724. @example
  18725. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18726. @end example
  18727. @item
  18728. Generate timestamps by counting samples:
  18729. @example
  18730. asetpts=N/SR/TB
  18731. @end example
  18732. @end itemize
  18733. @section setrange
  18734. Force color range for the output video frame.
  18735. The @code{setrange} filter marks the color range property for the
  18736. output frames. It does not change the input frame, but only sets the
  18737. corresponding property, which affects how the frame is treated by
  18738. following filters.
  18739. The filter accepts the following options:
  18740. @table @option
  18741. @item range
  18742. Available values are:
  18743. @table @samp
  18744. @item auto
  18745. Keep the same color range property.
  18746. @item unspecified, unknown
  18747. Set the color range as unspecified.
  18748. @item limited, tv, mpeg
  18749. Set the color range as limited.
  18750. @item full, pc, jpeg
  18751. Set the color range as full.
  18752. @end table
  18753. @end table
  18754. @section settb, asettb
  18755. Set the timebase to use for the output frames timestamps.
  18756. It is mainly useful for testing timebase configuration.
  18757. It accepts the following parameters:
  18758. @table @option
  18759. @item expr, tb
  18760. The expression which is evaluated into the output timebase.
  18761. @end table
  18762. The value for @option{tb} is an arithmetic expression representing a
  18763. rational. The expression can contain the constants "AVTB" (the default
  18764. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18765. audio only). Default value is "intb".
  18766. @subsection Examples
  18767. @itemize
  18768. @item
  18769. Set the timebase to 1/25:
  18770. @example
  18771. settb=expr=1/25
  18772. @end example
  18773. @item
  18774. Set the timebase to 1/10:
  18775. @example
  18776. settb=expr=0.1
  18777. @end example
  18778. @item
  18779. Set the timebase to 1001/1000:
  18780. @example
  18781. settb=1+0.001
  18782. @end example
  18783. @item
  18784. Set the timebase to 2*intb:
  18785. @example
  18786. settb=2*intb
  18787. @end example
  18788. @item
  18789. Set the default timebase value:
  18790. @example
  18791. settb=AVTB
  18792. @end example
  18793. @end itemize
  18794. @section showcqt
  18795. Convert input audio to a video output representing frequency spectrum
  18796. logarithmically using Brown-Puckette constant Q transform algorithm with
  18797. direct frequency domain coefficient calculation (but the transform itself
  18798. is not really constant Q, instead the Q factor is actually variable/clamped),
  18799. with musical tone scale, from E0 to D#10.
  18800. The filter accepts the following options:
  18801. @table @option
  18802. @item size, s
  18803. Specify the video size for the output. It must be even. For the syntax of this option,
  18804. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18805. Default value is @code{1920x1080}.
  18806. @item fps, rate, r
  18807. Set the output frame rate. Default value is @code{25}.
  18808. @item bar_h
  18809. Set the bargraph height. It must be even. Default value is @code{-1} which
  18810. computes the bargraph height automatically.
  18811. @item axis_h
  18812. Set the axis height. It must be even. Default value is @code{-1} which computes
  18813. the axis height automatically.
  18814. @item sono_h
  18815. Set the sonogram height. It must be even. Default value is @code{-1} which
  18816. computes the sonogram height automatically.
  18817. @item fullhd
  18818. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18819. instead. Default value is @code{1}.
  18820. @item sono_v, volume
  18821. Specify the sonogram volume expression. It can contain variables:
  18822. @table @option
  18823. @item bar_v
  18824. the @var{bar_v} evaluated expression
  18825. @item frequency, freq, f
  18826. the frequency where it is evaluated
  18827. @item timeclamp, tc
  18828. the value of @var{timeclamp} option
  18829. @end table
  18830. and functions:
  18831. @table @option
  18832. @item a_weighting(f)
  18833. A-weighting of equal loudness
  18834. @item b_weighting(f)
  18835. B-weighting of equal loudness
  18836. @item c_weighting(f)
  18837. C-weighting of equal loudness.
  18838. @end table
  18839. Default value is @code{16}.
  18840. @item bar_v, volume2
  18841. Specify the bargraph volume expression. It can contain variables:
  18842. @table @option
  18843. @item sono_v
  18844. the @var{sono_v} evaluated expression
  18845. @item frequency, freq, f
  18846. the frequency where it is evaluated
  18847. @item timeclamp, tc
  18848. the value of @var{timeclamp} option
  18849. @end table
  18850. and functions:
  18851. @table @option
  18852. @item a_weighting(f)
  18853. A-weighting of equal loudness
  18854. @item b_weighting(f)
  18855. B-weighting of equal loudness
  18856. @item c_weighting(f)
  18857. C-weighting of equal loudness.
  18858. @end table
  18859. Default value is @code{sono_v}.
  18860. @item sono_g, gamma
  18861. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18862. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18863. Acceptable range is @code{[1, 7]}.
  18864. @item bar_g, gamma2
  18865. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18866. @code{[1, 7]}.
  18867. @item bar_t
  18868. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18869. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18870. @item timeclamp, tc
  18871. Specify the transform timeclamp. At low frequency, there is trade-off between
  18872. accuracy in time domain and frequency domain. If timeclamp is lower,
  18873. event in time domain is represented more accurately (such as fast bass drum),
  18874. otherwise event in frequency domain is represented more accurately
  18875. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18876. @item attack
  18877. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18878. limits future samples by applying asymmetric windowing in time domain, useful
  18879. when low latency is required. Accepted range is @code{[0, 1]}.
  18880. @item basefreq
  18881. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18882. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18883. @item endfreq
  18884. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18885. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18886. @item coeffclamp
  18887. This option is deprecated and ignored.
  18888. @item tlength
  18889. Specify the transform length in time domain. Use this option to control accuracy
  18890. trade-off between time domain and frequency domain at every frequency sample.
  18891. It can contain variables:
  18892. @table @option
  18893. @item frequency, freq, f
  18894. the frequency where it is evaluated
  18895. @item timeclamp, tc
  18896. the value of @var{timeclamp} option.
  18897. @end table
  18898. Default value is @code{384*tc/(384+tc*f)}.
  18899. @item count
  18900. Specify the transform count for every video frame. Default value is @code{6}.
  18901. Acceptable range is @code{[1, 30]}.
  18902. @item fcount
  18903. Specify the transform count for every single pixel. Default value is @code{0},
  18904. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18905. @item fontfile
  18906. Specify font file for use with freetype to draw the axis. If not specified,
  18907. use embedded font. Note that drawing with font file or embedded font is not
  18908. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18909. option instead.
  18910. @item font
  18911. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18912. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18913. escaping.
  18914. @item fontcolor
  18915. Specify font color expression. This is arithmetic expression that should return
  18916. integer value 0xRRGGBB. It can contain variables:
  18917. @table @option
  18918. @item frequency, freq, f
  18919. the frequency where it is evaluated
  18920. @item timeclamp, tc
  18921. the value of @var{timeclamp} option
  18922. @end table
  18923. and functions:
  18924. @table @option
  18925. @item midi(f)
  18926. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  18927. @item r(x), g(x), b(x)
  18928. red, green, and blue value of intensity x.
  18929. @end table
  18930. Default value is @code{st(0, (midi(f)-59.5)/12);
  18931. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  18932. r(1-ld(1)) + b(ld(1))}.
  18933. @item axisfile
  18934. Specify image file to draw the axis. This option override @var{fontfile} and
  18935. @var{fontcolor} option.
  18936. @item axis, text
  18937. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  18938. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  18939. Default value is @code{1}.
  18940. @item csp
  18941. Set colorspace. The accepted values are:
  18942. @table @samp
  18943. @item unspecified
  18944. Unspecified (default)
  18945. @item bt709
  18946. BT.709
  18947. @item fcc
  18948. FCC
  18949. @item bt470bg
  18950. BT.470BG or BT.601-6 625
  18951. @item smpte170m
  18952. SMPTE-170M or BT.601-6 525
  18953. @item smpte240m
  18954. SMPTE-240M
  18955. @item bt2020ncl
  18956. BT.2020 with non-constant luminance
  18957. @end table
  18958. @item cscheme
  18959. Set spectrogram color scheme. This is list of floating point values with format
  18960. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  18961. The default is @code{1|0.5|0|0|0.5|1}.
  18962. @end table
  18963. @subsection Examples
  18964. @itemize
  18965. @item
  18966. Playing audio while showing the spectrum:
  18967. @example
  18968. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  18969. @end example
  18970. @item
  18971. Same as above, but with frame rate 30 fps:
  18972. @example
  18973. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  18974. @end example
  18975. @item
  18976. Playing at 1280x720:
  18977. @example
  18978. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  18979. @end example
  18980. @item
  18981. Disable sonogram display:
  18982. @example
  18983. sono_h=0
  18984. @end example
  18985. @item
  18986. A1 and its harmonics: A1, A2, (near)E3, A3:
  18987. @example
  18988. 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),
  18989. asplit[a][out1]; [a] showcqt [out0]'
  18990. @end example
  18991. @item
  18992. Same as above, but with more accuracy in frequency domain:
  18993. @example
  18994. 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),
  18995. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  18996. @end example
  18997. @item
  18998. Custom volume:
  18999. @example
  19000. bar_v=10:sono_v=bar_v*a_weighting(f)
  19001. @end example
  19002. @item
  19003. Custom gamma, now spectrum is linear to the amplitude.
  19004. @example
  19005. bar_g=2:sono_g=2
  19006. @end example
  19007. @item
  19008. Custom tlength equation:
  19009. @example
  19010. 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)))'
  19011. @end example
  19012. @item
  19013. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  19014. @example
  19015. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  19016. @end example
  19017. @item
  19018. Custom font using fontconfig:
  19019. @example
  19020. font='Courier New,Monospace,mono|bold'
  19021. @end example
  19022. @item
  19023. Custom frequency range with custom axis using image file:
  19024. @example
  19025. axisfile=myaxis.png:basefreq=40:endfreq=10000
  19026. @end example
  19027. @end itemize
  19028. @section showfreqs
  19029. Convert input audio to video output representing the audio power spectrum.
  19030. Audio amplitude is on Y-axis while frequency is on X-axis.
  19031. The filter accepts the following options:
  19032. @table @option
  19033. @item size, s
  19034. Specify size of video. For the syntax of this option, check the
  19035. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19036. Default is @code{1024x512}.
  19037. @item mode
  19038. Set display mode.
  19039. This set how each frequency bin will be represented.
  19040. It accepts the following values:
  19041. @table @samp
  19042. @item line
  19043. @item bar
  19044. @item dot
  19045. @end table
  19046. Default is @code{bar}.
  19047. @item ascale
  19048. Set amplitude scale.
  19049. It accepts the following values:
  19050. @table @samp
  19051. @item lin
  19052. Linear scale.
  19053. @item sqrt
  19054. Square root scale.
  19055. @item cbrt
  19056. Cubic root scale.
  19057. @item log
  19058. Logarithmic scale.
  19059. @end table
  19060. Default is @code{log}.
  19061. @item fscale
  19062. Set frequency scale.
  19063. It accepts the following values:
  19064. @table @samp
  19065. @item lin
  19066. Linear scale.
  19067. @item log
  19068. Logarithmic scale.
  19069. @item rlog
  19070. Reverse logarithmic scale.
  19071. @end table
  19072. Default is @code{lin}.
  19073. @item win_size
  19074. Set window size. Allowed range is from 16 to 65536.
  19075. Default is @code{2048}
  19076. @item win_func
  19077. Set windowing function.
  19078. It accepts the following values:
  19079. @table @samp
  19080. @item rect
  19081. @item bartlett
  19082. @item hanning
  19083. @item hamming
  19084. @item blackman
  19085. @item welch
  19086. @item flattop
  19087. @item bharris
  19088. @item bnuttall
  19089. @item bhann
  19090. @item sine
  19091. @item nuttall
  19092. @item lanczos
  19093. @item gauss
  19094. @item tukey
  19095. @item dolph
  19096. @item cauchy
  19097. @item parzen
  19098. @item poisson
  19099. @item bohman
  19100. @end table
  19101. Default is @code{hanning}.
  19102. @item overlap
  19103. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19104. which means optimal overlap for selected window function will be picked.
  19105. @item averaging
  19106. Set time averaging. Setting this to 0 will display current maximal peaks.
  19107. Default is @code{1}, which means time averaging is disabled.
  19108. @item colors
  19109. Specify list of colors separated by space or by '|' which will be used to
  19110. draw channel frequencies. Unrecognized or missing colors will be replaced
  19111. by white color.
  19112. @item cmode
  19113. Set channel display mode.
  19114. It accepts the following values:
  19115. @table @samp
  19116. @item combined
  19117. @item separate
  19118. @end table
  19119. Default is @code{combined}.
  19120. @item minamp
  19121. Set minimum amplitude used in @code{log} amplitude scaler.
  19122. @end table
  19123. @section showspatial
  19124. Convert stereo input audio to a video output, representing the spatial relationship
  19125. between two channels.
  19126. The filter accepts the following options:
  19127. @table @option
  19128. @item size, s
  19129. Specify the video size for the output. For the syntax of this option, check the
  19130. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19131. Default value is @code{512x512}.
  19132. @item win_size
  19133. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19134. @item win_func
  19135. Set window function.
  19136. It accepts the following values:
  19137. @table @samp
  19138. @item rect
  19139. @item bartlett
  19140. @item hann
  19141. @item hanning
  19142. @item hamming
  19143. @item blackman
  19144. @item welch
  19145. @item flattop
  19146. @item bharris
  19147. @item bnuttall
  19148. @item bhann
  19149. @item sine
  19150. @item nuttall
  19151. @item lanczos
  19152. @item gauss
  19153. @item tukey
  19154. @item dolph
  19155. @item cauchy
  19156. @item parzen
  19157. @item poisson
  19158. @item bohman
  19159. @end table
  19160. Default value is @code{hann}.
  19161. @item overlap
  19162. Set ratio of overlap window. Default value is @code{0.5}.
  19163. When value is @code{1} overlap is set to recommended size for specific
  19164. window function currently used.
  19165. @end table
  19166. @anchor{showspectrum}
  19167. @section showspectrum
  19168. Convert input audio to a video output, representing the audio frequency
  19169. spectrum.
  19170. The filter accepts the following options:
  19171. @table @option
  19172. @item size, s
  19173. Specify the video size for the output. For the syntax of this option, check the
  19174. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19175. Default value is @code{640x512}.
  19176. @item slide
  19177. Specify how the spectrum should slide along the window.
  19178. It accepts the following values:
  19179. @table @samp
  19180. @item replace
  19181. the samples start again on the left when they reach the right
  19182. @item scroll
  19183. the samples scroll from right to left
  19184. @item fullframe
  19185. frames are only produced when the samples reach the right
  19186. @item rscroll
  19187. the samples scroll from left to right
  19188. @end table
  19189. Default value is @code{replace}.
  19190. @item mode
  19191. Specify display mode.
  19192. It accepts the following values:
  19193. @table @samp
  19194. @item combined
  19195. all channels are displayed in the same row
  19196. @item separate
  19197. all channels are displayed in separate rows
  19198. @end table
  19199. Default value is @samp{combined}.
  19200. @item color
  19201. Specify display color mode.
  19202. It accepts the following values:
  19203. @table @samp
  19204. @item channel
  19205. each channel is displayed in a separate color
  19206. @item intensity
  19207. each channel is displayed using the same color scheme
  19208. @item rainbow
  19209. each channel is displayed using the rainbow color scheme
  19210. @item moreland
  19211. each channel is displayed using the moreland color scheme
  19212. @item nebulae
  19213. each channel is displayed using the nebulae color scheme
  19214. @item fire
  19215. each channel is displayed using the fire color scheme
  19216. @item fiery
  19217. each channel is displayed using the fiery color scheme
  19218. @item fruit
  19219. each channel is displayed using the fruit color scheme
  19220. @item cool
  19221. each channel is displayed using the cool color scheme
  19222. @item magma
  19223. each channel is displayed using the magma color scheme
  19224. @item green
  19225. each channel is displayed using the green color scheme
  19226. @item viridis
  19227. each channel is displayed using the viridis color scheme
  19228. @item plasma
  19229. each channel is displayed using the plasma color scheme
  19230. @item cividis
  19231. each channel is displayed using the cividis color scheme
  19232. @item terrain
  19233. each channel is displayed using the terrain color scheme
  19234. @end table
  19235. Default value is @samp{channel}.
  19236. @item scale
  19237. Specify scale used for calculating intensity color values.
  19238. It accepts the following values:
  19239. @table @samp
  19240. @item lin
  19241. linear
  19242. @item sqrt
  19243. square root, default
  19244. @item cbrt
  19245. cubic root
  19246. @item log
  19247. logarithmic
  19248. @item 4thrt
  19249. 4th root
  19250. @item 5thrt
  19251. 5th root
  19252. @end table
  19253. Default value is @samp{sqrt}.
  19254. @item fscale
  19255. Specify frequency scale.
  19256. It accepts the following values:
  19257. @table @samp
  19258. @item lin
  19259. linear
  19260. @item log
  19261. logarithmic
  19262. @end table
  19263. Default value is @samp{lin}.
  19264. @item saturation
  19265. Set saturation modifier for displayed colors. Negative values provide
  19266. alternative color scheme. @code{0} is no saturation at all.
  19267. Saturation must be in [-10.0, 10.0] range.
  19268. Default value is @code{1}.
  19269. @item win_func
  19270. Set window function.
  19271. It accepts the following values:
  19272. @table @samp
  19273. @item rect
  19274. @item bartlett
  19275. @item hann
  19276. @item hanning
  19277. @item hamming
  19278. @item blackman
  19279. @item welch
  19280. @item flattop
  19281. @item bharris
  19282. @item bnuttall
  19283. @item bhann
  19284. @item sine
  19285. @item nuttall
  19286. @item lanczos
  19287. @item gauss
  19288. @item tukey
  19289. @item dolph
  19290. @item cauchy
  19291. @item parzen
  19292. @item poisson
  19293. @item bohman
  19294. @end table
  19295. Default value is @code{hann}.
  19296. @item orientation
  19297. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19298. @code{horizontal}. Default is @code{vertical}.
  19299. @item overlap
  19300. Set ratio of overlap window. Default value is @code{0}.
  19301. When value is @code{1} overlap is set to recommended size for specific
  19302. window function currently used.
  19303. @item gain
  19304. Set scale gain for calculating intensity color values.
  19305. Default value is @code{1}.
  19306. @item data
  19307. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19308. @item rotation
  19309. Set color rotation, must be in [-1.0, 1.0] range.
  19310. Default value is @code{0}.
  19311. @item start
  19312. Set start frequency from which to display spectrogram. Default is @code{0}.
  19313. @item stop
  19314. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19315. @item fps
  19316. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19317. @item legend
  19318. Draw time and frequency axes and legends. Default is disabled.
  19319. @end table
  19320. The usage is very similar to the showwaves filter; see the examples in that
  19321. section.
  19322. @subsection Examples
  19323. @itemize
  19324. @item
  19325. Large window with logarithmic color scaling:
  19326. @example
  19327. showspectrum=s=1280x480:scale=log
  19328. @end example
  19329. @item
  19330. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19331. @example
  19332. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19333. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19334. @end example
  19335. @end itemize
  19336. @section showspectrumpic
  19337. Convert input audio to a single video frame, representing the audio frequency
  19338. spectrum.
  19339. The filter accepts the following options:
  19340. @table @option
  19341. @item size, s
  19342. Specify the video size for the output. For the syntax of this option, check the
  19343. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19344. Default value is @code{4096x2048}.
  19345. @item mode
  19346. Specify display mode.
  19347. It accepts the following values:
  19348. @table @samp
  19349. @item combined
  19350. all channels are displayed in the same row
  19351. @item separate
  19352. all channels are displayed in separate rows
  19353. @end table
  19354. Default value is @samp{combined}.
  19355. @item color
  19356. Specify display color mode.
  19357. It accepts the following values:
  19358. @table @samp
  19359. @item channel
  19360. each channel is displayed in a separate color
  19361. @item intensity
  19362. each channel is displayed using the same color scheme
  19363. @item rainbow
  19364. each channel is displayed using the rainbow color scheme
  19365. @item moreland
  19366. each channel is displayed using the moreland color scheme
  19367. @item nebulae
  19368. each channel is displayed using the nebulae color scheme
  19369. @item fire
  19370. each channel is displayed using the fire color scheme
  19371. @item fiery
  19372. each channel is displayed using the fiery color scheme
  19373. @item fruit
  19374. each channel is displayed using the fruit color scheme
  19375. @item cool
  19376. each channel is displayed using the cool color scheme
  19377. @item magma
  19378. each channel is displayed using the magma color scheme
  19379. @item green
  19380. each channel is displayed using the green color scheme
  19381. @item viridis
  19382. each channel is displayed using the viridis color scheme
  19383. @item plasma
  19384. each channel is displayed using the plasma color scheme
  19385. @item cividis
  19386. each channel is displayed using the cividis color scheme
  19387. @item terrain
  19388. each channel is displayed using the terrain color scheme
  19389. @end table
  19390. Default value is @samp{intensity}.
  19391. @item scale
  19392. Specify scale used for calculating intensity color values.
  19393. It accepts the following values:
  19394. @table @samp
  19395. @item lin
  19396. linear
  19397. @item sqrt
  19398. square root, default
  19399. @item cbrt
  19400. cubic root
  19401. @item log
  19402. logarithmic
  19403. @item 4thrt
  19404. 4th root
  19405. @item 5thrt
  19406. 5th root
  19407. @end table
  19408. Default value is @samp{log}.
  19409. @item fscale
  19410. Specify frequency scale.
  19411. It accepts the following values:
  19412. @table @samp
  19413. @item lin
  19414. linear
  19415. @item log
  19416. logarithmic
  19417. @end table
  19418. Default value is @samp{lin}.
  19419. @item saturation
  19420. Set saturation modifier for displayed colors. Negative values provide
  19421. alternative color scheme. @code{0} is no saturation at all.
  19422. Saturation must be in [-10.0, 10.0] range.
  19423. Default value is @code{1}.
  19424. @item win_func
  19425. Set window function.
  19426. It accepts the following values:
  19427. @table @samp
  19428. @item rect
  19429. @item bartlett
  19430. @item hann
  19431. @item hanning
  19432. @item hamming
  19433. @item blackman
  19434. @item welch
  19435. @item flattop
  19436. @item bharris
  19437. @item bnuttall
  19438. @item bhann
  19439. @item sine
  19440. @item nuttall
  19441. @item lanczos
  19442. @item gauss
  19443. @item tukey
  19444. @item dolph
  19445. @item cauchy
  19446. @item parzen
  19447. @item poisson
  19448. @item bohman
  19449. @end table
  19450. Default value is @code{hann}.
  19451. @item orientation
  19452. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19453. @code{horizontal}. Default is @code{vertical}.
  19454. @item gain
  19455. Set scale gain for calculating intensity color values.
  19456. Default value is @code{1}.
  19457. @item legend
  19458. Draw time and frequency axes and legends. Default is enabled.
  19459. @item rotation
  19460. Set color rotation, must be in [-1.0, 1.0] range.
  19461. Default value is @code{0}.
  19462. @item start
  19463. Set start frequency from which to display spectrogram. Default is @code{0}.
  19464. @item stop
  19465. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19466. @end table
  19467. @subsection Examples
  19468. @itemize
  19469. @item
  19470. Extract an audio spectrogram of a whole audio track
  19471. in a 1024x1024 picture using @command{ffmpeg}:
  19472. @example
  19473. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19474. @end example
  19475. @end itemize
  19476. @section showvolume
  19477. Convert input audio volume to a video output.
  19478. The filter accepts the following options:
  19479. @table @option
  19480. @item rate, r
  19481. Set video rate.
  19482. @item b
  19483. Set border width, allowed range is [0, 5]. Default is 1.
  19484. @item w
  19485. Set channel width, allowed range is [80, 8192]. Default is 400.
  19486. @item h
  19487. Set channel height, allowed range is [1, 900]. Default is 20.
  19488. @item f
  19489. Set fade, allowed range is [0, 1]. Default is 0.95.
  19490. @item c
  19491. Set volume color expression.
  19492. The expression can use the following variables:
  19493. @table @option
  19494. @item VOLUME
  19495. Current max volume of channel in dB.
  19496. @item PEAK
  19497. Current peak.
  19498. @item CHANNEL
  19499. Current channel number, starting from 0.
  19500. @end table
  19501. @item t
  19502. If set, displays channel names. Default is enabled.
  19503. @item v
  19504. If set, displays volume values. Default is enabled.
  19505. @item o
  19506. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19507. default is @code{h}.
  19508. @item s
  19509. Set step size, allowed range is [0, 5]. Default is 0, which means
  19510. step is disabled.
  19511. @item p
  19512. Set background opacity, allowed range is [0, 1]. Default is 0.
  19513. @item m
  19514. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19515. default is @code{p}.
  19516. @item ds
  19517. Set display scale, can be linear: @code{lin} or log: @code{log},
  19518. default is @code{lin}.
  19519. @item dm
  19520. In second.
  19521. If set to > 0., display a line for the max level
  19522. in the previous seconds.
  19523. default is disabled: @code{0.}
  19524. @item dmc
  19525. The color of the max line. Use when @code{dm} option is set to > 0.
  19526. default is: @code{orange}
  19527. @end table
  19528. @section showwaves
  19529. Convert input audio to a video output, representing the samples waves.
  19530. The filter accepts the following options:
  19531. @table @option
  19532. @item size, s
  19533. Specify the video size for the output. For the syntax of this option, check the
  19534. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19535. Default value is @code{600x240}.
  19536. @item mode
  19537. Set display mode.
  19538. Available values are:
  19539. @table @samp
  19540. @item point
  19541. Draw a point for each sample.
  19542. @item line
  19543. Draw a vertical line for each sample.
  19544. @item p2p
  19545. Draw a point for each sample and a line between them.
  19546. @item cline
  19547. Draw a centered vertical line for each sample.
  19548. @end table
  19549. Default value is @code{point}.
  19550. @item n
  19551. Set the number of samples which are printed on the same column. A
  19552. larger value will decrease the frame rate. Must be a positive
  19553. integer. This option can be set only if the value for @var{rate}
  19554. is not explicitly specified.
  19555. @item rate, r
  19556. Set the (approximate) output frame rate. This is done by setting the
  19557. option @var{n}. Default value is "25".
  19558. @item split_channels
  19559. Set if channels should be drawn separately or overlap. Default value is 0.
  19560. @item colors
  19561. Set colors separated by '|' which are going to be used for drawing of each channel.
  19562. @item scale
  19563. Set amplitude scale.
  19564. Available values are:
  19565. @table @samp
  19566. @item lin
  19567. Linear.
  19568. @item log
  19569. Logarithmic.
  19570. @item sqrt
  19571. Square root.
  19572. @item cbrt
  19573. Cubic root.
  19574. @end table
  19575. Default is linear.
  19576. @item draw
  19577. Set the draw mode. This is mostly useful to set for high @var{n}.
  19578. Available values are:
  19579. @table @samp
  19580. @item scale
  19581. Scale pixel values for each drawn sample.
  19582. @item full
  19583. Draw every sample directly.
  19584. @end table
  19585. Default value is @code{scale}.
  19586. @end table
  19587. @subsection Examples
  19588. @itemize
  19589. @item
  19590. Output the input file audio and the corresponding video representation
  19591. at the same time:
  19592. @example
  19593. amovie=a.mp3,asplit[out0],showwaves[out1]
  19594. @end example
  19595. @item
  19596. Create a synthetic signal and show it with showwaves, forcing a
  19597. frame rate of 30 frames per second:
  19598. @example
  19599. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19600. @end example
  19601. @end itemize
  19602. @section showwavespic
  19603. Convert input audio to a single video frame, representing the samples waves.
  19604. The filter accepts the following options:
  19605. @table @option
  19606. @item size, s
  19607. Specify the video size for the output. For the syntax of this option, check the
  19608. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19609. Default value is @code{600x240}.
  19610. @item split_channels
  19611. Set if channels should be drawn separately or overlap. Default value is 0.
  19612. @item colors
  19613. Set colors separated by '|' which are going to be used for drawing of each channel.
  19614. @item scale
  19615. Set amplitude scale.
  19616. Available values are:
  19617. @table @samp
  19618. @item lin
  19619. Linear.
  19620. @item log
  19621. Logarithmic.
  19622. @item sqrt
  19623. Square root.
  19624. @item cbrt
  19625. Cubic root.
  19626. @end table
  19627. Default is linear.
  19628. @item draw
  19629. Set the draw mode.
  19630. Available values are:
  19631. @table @samp
  19632. @item scale
  19633. Scale pixel values for each drawn sample.
  19634. @item full
  19635. Draw every sample directly.
  19636. @end table
  19637. Default value is @code{scale}.
  19638. @item filter
  19639. Set the filter mode.
  19640. Available values are:
  19641. @table @samp
  19642. @item average
  19643. Use average samples values for each drawn sample.
  19644. @item peak
  19645. Use peak samples values for each drawn sample.
  19646. @end table
  19647. Default value is @code{average}.
  19648. @end table
  19649. @subsection Examples
  19650. @itemize
  19651. @item
  19652. Extract a channel split representation of the wave form of a whole audio track
  19653. in a 1024x800 picture using @command{ffmpeg}:
  19654. @example
  19655. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19656. @end example
  19657. @end itemize
  19658. @section sidedata, asidedata
  19659. Delete frame side data, or select frames based on it.
  19660. This filter accepts the following options:
  19661. @table @option
  19662. @item mode
  19663. Set mode of operation of the filter.
  19664. Can be one of the following:
  19665. @table @samp
  19666. @item select
  19667. Select every frame with side data of @code{type}.
  19668. @item delete
  19669. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19670. data in the frame.
  19671. @end table
  19672. @item type
  19673. Set side data type used with all modes. Must be set for @code{select} mode. For
  19674. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19675. in @file{libavutil/frame.h}. For example, to choose
  19676. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19677. @end table
  19678. @section spectrumsynth
  19679. Synthesize audio from 2 input video spectrums, first input stream represents
  19680. magnitude across time and second represents phase across time.
  19681. The filter will transform from frequency domain as displayed in videos back
  19682. to time domain as presented in audio output.
  19683. This filter is primarily created for reversing processed @ref{showspectrum}
  19684. filter outputs, but can synthesize sound from other spectrograms too.
  19685. But in such case results are going to be poor if the phase data is not
  19686. available, because in such cases phase data need to be recreated, usually
  19687. it's just recreated from random noise.
  19688. For best results use gray only output (@code{channel} color mode in
  19689. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19690. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19691. @code{data} option. Inputs videos should generally use @code{fullframe}
  19692. slide mode as that saves resources needed for decoding video.
  19693. The filter accepts the following options:
  19694. @table @option
  19695. @item sample_rate
  19696. Specify sample rate of output audio, the sample rate of audio from which
  19697. spectrum was generated may differ.
  19698. @item channels
  19699. Set number of channels represented in input video spectrums.
  19700. @item scale
  19701. Set scale which was used when generating magnitude input spectrum.
  19702. Can be @code{lin} or @code{log}. Default is @code{log}.
  19703. @item slide
  19704. Set slide which was used when generating inputs spectrums.
  19705. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19706. Default is @code{fullframe}.
  19707. @item win_func
  19708. Set window function used for resynthesis.
  19709. @item overlap
  19710. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19711. which means optimal overlap for selected window function will be picked.
  19712. @item orientation
  19713. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19714. Default is @code{vertical}.
  19715. @end table
  19716. @subsection Examples
  19717. @itemize
  19718. @item
  19719. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19720. then resynthesize videos back to audio with spectrumsynth:
  19721. @example
  19722. 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
  19723. 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
  19724. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19725. @end example
  19726. @end itemize
  19727. @section split, asplit
  19728. Split input into several identical outputs.
  19729. @code{asplit} works with audio input, @code{split} with video.
  19730. The filter accepts a single parameter which specifies the number of outputs. If
  19731. unspecified, it defaults to 2.
  19732. @subsection Examples
  19733. @itemize
  19734. @item
  19735. Create two separate outputs from the same input:
  19736. @example
  19737. [in] split [out0][out1]
  19738. @end example
  19739. @item
  19740. To create 3 or more outputs, you need to specify the number of
  19741. outputs, like in:
  19742. @example
  19743. [in] asplit=3 [out0][out1][out2]
  19744. @end example
  19745. @item
  19746. Create two separate outputs from the same input, one cropped and
  19747. one padded:
  19748. @example
  19749. [in] split [splitout1][splitout2];
  19750. [splitout1] crop=100:100:0:0 [cropout];
  19751. [splitout2] pad=200:200:100:100 [padout];
  19752. @end example
  19753. @item
  19754. Create 5 copies of the input audio with @command{ffmpeg}:
  19755. @example
  19756. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19757. @end example
  19758. @end itemize
  19759. @section zmq, azmq
  19760. Receive commands sent through a libzmq client, and forward them to
  19761. filters in the filtergraph.
  19762. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19763. must be inserted between two video filters, @code{azmq} between two
  19764. audio filters. Both are capable to send messages to any filter type.
  19765. To enable these filters you need to install the libzmq library and
  19766. headers and configure FFmpeg with @code{--enable-libzmq}.
  19767. For more information about libzmq see:
  19768. @url{http://www.zeromq.org/}
  19769. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19770. receives messages sent through a network interface defined by the
  19771. @option{bind_address} (or the abbreviation "@option{b}") option.
  19772. Default value of this option is @file{tcp://localhost:5555}. You may
  19773. want to alter this value to your needs, but do not forget to escape any
  19774. ':' signs (see @ref{filtergraph escaping}).
  19775. The received message must be in the form:
  19776. @example
  19777. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19778. @end example
  19779. @var{TARGET} specifies the target of the command, usually the name of
  19780. the filter class or a specific filter instance name. The default
  19781. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19782. but you can override this by using the @samp{filter_name@@id} syntax
  19783. (see @ref{Filtergraph syntax}).
  19784. @var{COMMAND} specifies the name of the command for the target filter.
  19785. @var{ARG} is optional and specifies the optional argument list for the
  19786. given @var{COMMAND}.
  19787. Upon reception, the message is processed and the corresponding command
  19788. is injected into the filtergraph. Depending on the result, the filter
  19789. will send a reply to the client, adopting the format:
  19790. @example
  19791. @var{ERROR_CODE} @var{ERROR_REASON}
  19792. @var{MESSAGE}
  19793. @end example
  19794. @var{MESSAGE} is optional.
  19795. @subsection Examples
  19796. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19797. be used to send commands processed by these filters.
  19798. Consider the following filtergraph generated by @command{ffplay}.
  19799. In this example the last overlay filter has an instance name. All other
  19800. filters will have default instance names.
  19801. @example
  19802. ffplay -dumpgraph 1 -f lavfi "
  19803. color=s=100x100:c=red [l];
  19804. color=s=100x100:c=blue [r];
  19805. nullsrc=s=200x100, zmq [bg];
  19806. [bg][l] overlay [bg+l];
  19807. [bg+l][r] overlay@@my=x=100 "
  19808. @end example
  19809. To change the color of the left side of the video, the following
  19810. command can be used:
  19811. @example
  19812. echo Parsed_color_0 c yellow | tools/zmqsend
  19813. @end example
  19814. To change the right side:
  19815. @example
  19816. echo Parsed_color_1 c pink | tools/zmqsend
  19817. @end example
  19818. To change the position of the right side:
  19819. @example
  19820. echo overlay@@my x 150 | tools/zmqsend
  19821. @end example
  19822. @c man end MULTIMEDIA FILTERS
  19823. @chapter Multimedia Sources
  19824. @c man begin MULTIMEDIA SOURCES
  19825. Below is a description of the currently available multimedia sources.
  19826. @section amovie
  19827. This is the same as @ref{movie} source, except it selects an audio
  19828. stream by default.
  19829. @anchor{movie}
  19830. @section movie
  19831. Read audio and/or video stream(s) from a movie container.
  19832. It accepts the following parameters:
  19833. @table @option
  19834. @item filename
  19835. The name of the resource to read (not necessarily a file; it can also be a
  19836. device or a stream accessed through some protocol).
  19837. @item format_name, f
  19838. Specifies the format assumed for the movie to read, and can be either
  19839. the name of a container or an input device. If not specified, the
  19840. format is guessed from @var{movie_name} or by probing.
  19841. @item seek_point, sp
  19842. Specifies the seek point in seconds. The frames will be output
  19843. starting from this seek point. The parameter is evaluated with
  19844. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19845. postfix. The default value is "0".
  19846. @item streams, s
  19847. Specifies the streams to read. Several streams can be specified,
  19848. separated by "+". The source will then have as many outputs, in the
  19849. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19850. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19851. respectively the default (best suited) video and audio stream. Default
  19852. is "dv", or "da" if the filter is called as "amovie".
  19853. @item stream_index, si
  19854. Specifies the index of the video stream to read. If the value is -1,
  19855. the most suitable video stream will be automatically selected. The default
  19856. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19857. audio instead of video.
  19858. @item loop
  19859. Specifies how many times to read the stream in sequence.
  19860. If the value is 0, the stream will be looped infinitely.
  19861. Default value is "1".
  19862. Note that when the movie is looped the source timestamps are not
  19863. changed, so it will generate non monotonically increasing timestamps.
  19864. @item discontinuity
  19865. Specifies the time difference between frames above which the point is
  19866. considered a timestamp discontinuity which is removed by adjusting the later
  19867. timestamps.
  19868. @end table
  19869. It allows overlaying a second video on top of the main input of
  19870. a filtergraph, as shown in this graph:
  19871. @example
  19872. input -----------> deltapts0 --> overlay --> output
  19873. ^
  19874. |
  19875. movie --> scale--> deltapts1 -------+
  19876. @end example
  19877. @subsection Examples
  19878. @itemize
  19879. @item
  19880. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19881. on top of the input labelled "in":
  19882. @example
  19883. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19884. [in] setpts=PTS-STARTPTS [main];
  19885. [main][over] overlay=16:16 [out]
  19886. @end example
  19887. @item
  19888. Read from a video4linux2 device, and overlay it on top of the input
  19889. labelled "in":
  19890. @example
  19891. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19892. [in] setpts=PTS-STARTPTS [main];
  19893. [main][over] overlay=16:16 [out]
  19894. @end example
  19895. @item
  19896. Read the first video stream and the audio stream with id 0x81 from
  19897. dvd.vob; the video is connected to the pad named "video" and the audio is
  19898. connected to the pad named "audio":
  19899. @example
  19900. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19901. @end example
  19902. @end itemize
  19903. @subsection Commands
  19904. Both movie and amovie support the following commands:
  19905. @table @option
  19906. @item seek
  19907. Perform seek using "av_seek_frame".
  19908. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19909. @itemize
  19910. @item
  19911. @var{stream_index}: If stream_index is -1, a default
  19912. stream is selected, and @var{timestamp} is automatically converted
  19913. from AV_TIME_BASE units to the stream specific time_base.
  19914. @item
  19915. @var{timestamp}: Timestamp in AVStream.time_base units
  19916. or, if no stream is specified, in AV_TIME_BASE units.
  19917. @item
  19918. @var{flags}: Flags which select direction and seeking mode.
  19919. @end itemize
  19920. @item get_duration
  19921. Get movie duration in AV_TIME_BASE units.
  19922. @end table
  19923. @c man end MULTIMEDIA SOURCES