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.

25986 lines
690KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  413. Default is @var{4th}.
  414. @end table
  415. @section acrusher
  416. Reduce audio bit resolution.
  417. This filter is bit crusher with enhanced functionality. A bit crusher
  418. is used to audibly reduce number of bits an audio signal is sampled
  419. with. This doesn't change the bit depth at all, it just produces the
  420. effect. Material reduced in bit depth sounds more harsh and "digital".
  421. This filter is able to even round to continuous values instead of discrete
  422. bit depths.
  423. Additionally it has a D/C offset which results in different crushing of
  424. the lower and the upper half of the signal.
  425. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  426. Another feature of this filter is the logarithmic mode.
  427. This setting switches from linear distances between bits to logarithmic ones.
  428. The result is a much more "natural" sounding crusher which doesn't gate low
  429. signals for example. The human ear has a logarithmic perception,
  430. so this kind of crushing is much more pleasant.
  431. Logarithmic crushing is also able to get anti-aliased.
  432. The filter accepts the following options:
  433. @table @option
  434. @item level_in
  435. Set level in.
  436. @item level_out
  437. Set level out.
  438. @item bits
  439. Set bit reduction.
  440. @item mix
  441. Set mixing amount.
  442. @item mode
  443. Can be linear: @code{lin} or logarithmic: @code{log}.
  444. @item dc
  445. Set DC.
  446. @item aa
  447. Set anti-aliasing.
  448. @item samples
  449. Set sample reduction.
  450. @item lfo
  451. Enable LFO. By default disabled.
  452. @item lforange
  453. Set LFO range.
  454. @item lforate
  455. Set LFO rate.
  456. @end table
  457. @section acue
  458. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  459. filter.
  460. @section adeclick
  461. Remove impulsive noise from input audio.
  462. Samples detected as impulsive noise are replaced by interpolated samples using
  463. autoregressive modelling.
  464. @table @option
  465. @item w
  466. Set window size, in milliseconds. Allowed range is from @code{10} to
  467. @code{100}. Default value is @code{55} milliseconds.
  468. This sets size of window which will be processed at once.
  469. @item o
  470. Set window overlap, in percentage of window size. Allowed range is from
  471. @code{50} to @code{95}. Default value is @code{75} percent.
  472. Setting this to a very high value increases impulsive noise removal but makes
  473. whole process much slower.
  474. @item a
  475. Set autoregression order, in percentage of window size. Allowed range is from
  476. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  477. controls quality of interpolated samples using neighbour good samples.
  478. @item t
  479. Set threshold value. Allowed range is from @code{1} to @code{100}.
  480. Default value is @code{2}.
  481. This controls the strength of impulsive noise which is going to be removed.
  482. The lower value, the more samples will be detected as impulsive noise.
  483. @item b
  484. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  485. @code{10}. Default value is @code{2}.
  486. If any two samples detected as noise are spaced less than this value then any
  487. sample between those two samples will be also detected as noise.
  488. @item m
  489. Set overlap method.
  490. It accepts the following values:
  491. @table @option
  492. @item a
  493. Select overlap-add method. Even not interpolated samples are slightly
  494. changed with this method.
  495. @item s
  496. Select overlap-save method. Not interpolated samples remain unchanged.
  497. @end table
  498. Default value is @code{a}.
  499. @end table
  500. @section adeclip
  501. Remove clipped samples from input audio.
  502. Samples detected as clipped are replaced by interpolated samples using
  503. autoregressive modelling.
  504. @table @option
  505. @item w
  506. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  507. Default value is @code{55} milliseconds.
  508. This sets size of window which will be processed at once.
  509. @item o
  510. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  511. to @code{95}. Default value is @code{75} percent.
  512. @item a
  513. Set autoregression order, in percentage of window size. Allowed range is from
  514. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  515. quality of interpolated samples using neighbour good samples.
  516. @item t
  517. Set threshold value. Allowed range is from @code{1} to @code{100}.
  518. Default value is @code{10}. Higher values make clip detection less aggressive.
  519. @item n
  520. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  521. Default value is @code{1000}. Higher values make clip detection less aggressive.
  522. @item m
  523. Set overlap method.
  524. It accepts the following values:
  525. @table @option
  526. @item a
  527. Select overlap-add method. Even not interpolated samples are slightly changed
  528. with this method.
  529. @item s
  530. Select overlap-save method. Not interpolated samples remain unchanged.
  531. @end table
  532. Default value is @code{a}.
  533. @end table
  534. @section adelay
  535. Delay one or more audio channels.
  536. Samples in delayed channel are filled with silence.
  537. The filter accepts the following option:
  538. @table @option
  539. @item delays
  540. Set list of delays in milliseconds for each channel separated by '|'.
  541. Unused delays will be silently ignored. If number of given delays is
  542. smaller than number of channels all remaining channels will not be delayed.
  543. If you want to delay exact number of samples, append 'S' to number.
  544. If you want instead to delay in seconds, append 's' to number.
  545. @item all
  546. Use last set delay for all remaining channels. By default is disabled.
  547. This option if enabled changes how option @code{delays} is interpreted.
  548. @end table
  549. @subsection Examples
  550. @itemize
  551. @item
  552. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  553. the second channel (and any other channels that may be present) unchanged.
  554. @example
  555. adelay=1500|0|500
  556. @end example
  557. @item
  558. Delay second channel by 500 samples, the third channel by 700 samples and leave
  559. the first channel (and any other channels that may be present) unchanged.
  560. @example
  561. adelay=0|500S|700S
  562. @end example
  563. @item
  564. Delay all channels by same number of samples:
  565. @example
  566. adelay=delays=64S:all=1
  567. @end example
  568. @end itemize
  569. @section aderivative, aintegral
  570. Compute derivative/integral of audio stream.
  571. Applying both filters one after another produces original audio.
  572. @section aecho
  573. Apply echoing to the input audio.
  574. Echoes are reflected sound and can occur naturally amongst mountains
  575. (and sometimes large buildings) when talking or shouting; digital echo
  576. effects emulate this behaviour and are often used to help fill out the
  577. sound of a single instrument or vocal. The time difference between the
  578. original signal and the reflection is the @code{delay}, and the
  579. loudness of the reflected signal is the @code{decay}.
  580. Multiple echoes can have different delays and decays.
  581. A description of the accepted parameters follows.
  582. @table @option
  583. @item in_gain
  584. Set input gain of reflected signal. Default is @code{0.6}.
  585. @item out_gain
  586. Set output gain of reflected signal. Default is @code{0.3}.
  587. @item delays
  588. Set list of time intervals in milliseconds between original signal and reflections
  589. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  590. Default is @code{1000}.
  591. @item decays
  592. Set list of loudness of reflected signals separated by '|'.
  593. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  594. Default is @code{0.5}.
  595. @end table
  596. @subsection Examples
  597. @itemize
  598. @item
  599. Make it sound as if there are twice as many instruments as are actually playing:
  600. @example
  601. aecho=0.8:0.88:60:0.4
  602. @end example
  603. @item
  604. If delay is very short, then it sounds like a (metallic) robot playing music:
  605. @example
  606. aecho=0.8:0.88:6:0.4
  607. @end example
  608. @item
  609. A longer delay will sound like an open air concert in the mountains:
  610. @example
  611. aecho=0.8:0.9:1000:0.3
  612. @end example
  613. @item
  614. Same as above but with one more mountain:
  615. @example
  616. aecho=0.8:0.9:1000|1800:0.3|0.25
  617. @end example
  618. @end itemize
  619. @section aemphasis
  620. Audio emphasis filter creates or restores material directly taken from LPs or
  621. emphased CDs with different filter curves. E.g. to store music on vinyl the
  622. signal has to be altered by a filter first to even out the disadvantages of
  623. this recording medium.
  624. Once the material is played back the inverse filter has to be applied to
  625. restore the distortion of the frequency response.
  626. The filter accepts the following options:
  627. @table @option
  628. @item level_in
  629. Set input gain.
  630. @item level_out
  631. Set output gain.
  632. @item mode
  633. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  634. use @code{production} mode. Default is @code{reproduction} mode.
  635. @item type
  636. Set filter type. Selects medium. Can be one of the following:
  637. @table @option
  638. @item col
  639. select Columbia.
  640. @item emi
  641. select EMI.
  642. @item bsi
  643. select BSI (78RPM).
  644. @item riaa
  645. select RIAA.
  646. @item cd
  647. select Compact Disc (CD).
  648. @item 50fm
  649. select 50µs (FM).
  650. @item 75fm
  651. select 75µs (FM).
  652. @item 50kf
  653. select 50µs (FM-KF).
  654. @item 75kf
  655. select 75µs (FM-KF).
  656. @end table
  657. @end table
  658. @section aeval
  659. Modify an audio signal according to the specified expressions.
  660. This filter accepts one or more expressions (one for each channel),
  661. which are evaluated and used to modify a corresponding audio signal.
  662. It accepts the following parameters:
  663. @table @option
  664. @item exprs
  665. Set the '|'-separated expressions list for each separate channel. If
  666. the number of input channels is greater than the number of
  667. expressions, the last specified expression is used for the remaining
  668. output channels.
  669. @item channel_layout, c
  670. Set output channel layout. If not specified, the channel layout is
  671. specified by the number of expressions. If set to @samp{same}, it will
  672. use by default the same input channel layout.
  673. @end table
  674. Each expression in @var{exprs} can contain the following constants and functions:
  675. @table @option
  676. @item ch
  677. channel number of the current expression
  678. @item n
  679. number of the evaluated sample, starting from 0
  680. @item s
  681. sample rate
  682. @item t
  683. time of the evaluated sample expressed in seconds
  684. @item nb_in_channels
  685. @item nb_out_channels
  686. input and output number of channels
  687. @item val(CH)
  688. the value of input channel with number @var{CH}
  689. @end table
  690. Note: this filter is slow. For faster processing you should use a
  691. dedicated filter.
  692. @subsection Examples
  693. @itemize
  694. @item
  695. Half volume:
  696. @example
  697. aeval=val(ch)/2:c=same
  698. @end example
  699. @item
  700. Invert phase of the second channel:
  701. @example
  702. aeval=val(0)|-val(1)
  703. @end example
  704. @end itemize
  705. @anchor{afade}
  706. @section afade
  707. Apply fade-in/out effect to input audio.
  708. A description of the accepted parameters follows.
  709. @table @option
  710. @item type, t
  711. Specify the effect type, can be either @code{in} for fade-in, or
  712. @code{out} for a fade-out effect. Default is @code{in}.
  713. @item start_sample, ss
  714. Specify the number of the start sample for starting to apply the fade
  715. effect. Default is 0.
  716. @item nb_samples, ns
  717. Specify the number of samples for which the fade effect has to last. At
  718. the end of the fade-in effect the output audio will have the same
  719. volume as the input audio, at the end of the fade-out transition
  720. the output audio will be silence. Default is 44100.
  721. @item start_time, st
  722. Specify the start time of the fade effect. Default is 0.
  723. The value must be specified as a time duration; see
  724. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  725. for the accepted syntax.
  726. If set this option is used instead of @var{start_sample}.
  727. @item duration, d
  728. Specify the duration of the fade effect. See
  729. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  730. for the accepted syntax.
  731. At the end of the fade-in effect the output audio will have the same
  732. volume as the input audio, at the end of the fade-out transition
  733. the output audio will be silence.
  734. By default the duration is determined by @var{nb_samples}.
  735. If set this option is used instead of @var{nb_samples}.
  736. @item curve
  737. Set curve for fade transition.
  738. It accepts the following values:
  739. @table @option
  740. @item tri
  741. select triangular, linear slope (default)
  742. @item qsin
  743. select quarter of sine wave
  744. @item hsin
  745. select half of sine wave
  746. @item esin
  747. select exponential sine wave
  748. @item log
  749. select logarithmic
  750. @item ipar
  751. select inverted parabola
  752. @item qua
  753. select quadratic
  754. @item cub
  755. select cubic
  756. @item squ
  757. select square root
  758. @item cbr
  759. select cubic root
  760. @item par
  761. select parabola
  762. @item exp
  763. select exponential
  764. @item iqsin
  765. select inverted quarter of sine wave
  766. @item ihsin
  767. select inverted half of sine wave
  768. @item dese
  769. select double-exponential seat
  770. @item desi
  771. select double-exponential sigmoid
  772. @item losi
  773. select logistic sigmoid
  774. @item nofade
  775. no fade applied
  776. @end table
  777. @end table
  778. @subsection Examples
  779. @itemize
  780. @item
  781. Fade in first 15 seconds of audio:
  782. @example
  783. afade=t=in:ss=0:d=15
  784. @end example
  785. @item
  786. Fade out last 25 seconds of a 900 seconds audio:
  787. @example
  788. afade=t=out:st=875:d=25
  789. @end example
  790. @end itemize
  791. @section afftdn
  792. Denoise audio samples with FFT.
  793. A description of the accepted parameters follows.
  794. @table @option
  795. @item nr
  796. Set the noise reduction in dB, allowed range is 0.01 to 97.
  797. Default value is 12 dB.
  798. @item nf
  799. Set the noise floor in dB, allowed range is -80 to -20.
  800. Default value is -50 dB.
  801. @item nt
  802. Set the noise type.
  803. It accepts the following values:
  804. @table @option
  805. @item w
  806. Select white noise.
  807. @item v
  808. Select vinyl noise.
  809. @item s
  810. Select shellac noise.
  811. @item c
  812. Select custom noise, defined in @code{bn} option.
  813. Default value is white noise.
  814. @end table
  815. @item bn
  816. Set custom band noise for every one of 15 bands.
  817. Bands are separated by ' ' or '|'.
  818. @item rf
  819. Set the residual floor in dB, allowed range is -80 to -20.
  820. Default value is -38 dB.
  821. @item tn
  822. Enable noise tracking. By default is disabled.
  823. With this enabled, noise floor is automatically adjusted.
  824. @item tr
  825. Enable residual tracking. By default is disabled.
  826. @item om
  827. Set the output mode.
  828. It accepts the following values:
  829. @table @option
  830. @item i
  831. Pass input unchanged.
  832. @item o
  833. Pass noise filtered out.
  834. @item n
  835. Pass only noise.
  836. Default value is @var{o}.
  837. @end table
  838. @end table
  839. @subsection Commands
  840. This filter supports the following commands:
  841. @table @option
  842. @item sample_noise, sn
  843. Start or stop measuring noise profile.
  844. Syntax for the command is : "start" or "stop" string.
  845. After measuring noise profile is stopped it will be
  846. automatically applied in filtering.
  847. @item noise_reduction, nr
  848. Change noise reduction. Argument is single float number.
  849. Syntax for the command is : "@var{noise_reduction}"
  850. @item noise_floor, nf
  851. Change noise floor. Argument is single float number.
  852. Syntax for the command is : "@var{noise_floor}"
  853. @item output_mode, om
  854. Change output mode operation.
  855. Syntax for the command is : "i", "o" or "n" string.
  856. @end table
  857. @section afftfilt
  858. Apply arbitrary expressions to samples in frequency domain.
  859. @table @option
  860. @item real
  861. Set frequency domain real expression for each separate channel separated
  862. by '|'. Default is "re".
  863. If the number of input channels is greater than the number of
  864. expressions, the last specified expression is used for the remaining
  865. output channels.
  866. @item imag
  867. Set frequency domain imaginary expression for each separate channel
  868. separated by '|'. Default is "im".
  869. Each expression in @var{real} and @var{imag} can contain the following
  870. constants and functions:
  871. @table @option
  872. @item sr
  873. sample rate
  874. @item b
  875. current frequency bin number
  876. @item nb
  877. number of available bins
  878. @item ch
  879. channel number of the current expression
  880. @item chs
  881. number of channels
  882. @item pts
  883. current frame pts
  884. @item re
  885. current real part of frequency bin of current channel
  886. @item im
  887. current imaginary part of frequency bin of current channel
  888. @item real(b, ch)
  889. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  890. @item imag(b, ch)
  891. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  892. @end table
  893. @item win_size
  894. Set window size. Allowed range is from 16 to 131072.
  895. Default is @code{4096}
  896. @item win_func
  897. Set window function. Default is @code{hann}.
  898. @item overlap
  899. Set window overlap. If set to 1, the recommended overlap for selected
  900. window function will be picked. Default is @code{0.75}.
  901. @end table
  902. @subsection Examples
  903. @itemize
  904. @item
  905. Leave almost only low frequencies in audio:
  906. @example
  907. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  908. @end example
  909. @item
  910. Apply robotize effect:
  911. @example
  912. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  913. @end example
  914. @item
  915. Apply whisper effect:
  916. @example
  917. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  918. @end example
  919. @end itemize
  920. @anchor{afir}
  921. @section afir
  922. Apply an arbitrary Finite Impulse Response filter.
  923. This filter is designed for applying long FIR filters,
  924. up to 60 seconds long.
  925. It can be used as component for digital crossover filters,
  926. room equalization, cross talk cancellation, wavefield synthesis,
  927. auralization, ambiophonics, ambisonics and spatialization.
  928. This filter uses the streams higher than first one as FIR coefficients.
  929. If the non-first stream holds a single channel, it will be used
  930. for all input channels in the first stream, otherwise
  931. the number of channels in the non-first stream must be same as
  932. the number of channels in the first stream.
  933. It accepts the following parameters:
  934. @table @option
  935. @item dry
  936. Set dry gain. This sets input gain.
  937. @item wet
  938. Set wet gain. This sets final output gain.
  939. @item length
  940. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  941. @item gtype
  942. Enable applying gain measured from power of IR.
  943. Set which approach to use for auto gain measurement.
  944. @table @option
  945. @item none
  946. Do not apply any gain.
  947. @item peak
  948. select peak gain, very conservative approach. This is default value.
  949. @item dc
  950. select DC gain, limited application.
  951. @item gn
  952. select gain to noise approach, this is most popular one.
  953. @end table
  954. @item irgain
  955. Set gain to be applied to IR coefficients before filtering.
  956. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  957. @item irfmt
  958. Set format of IR stream. Can be @code{mono} or @code{input}.
  959. Default is @code{input}.
  960. @item maxir
  961. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  962. Allowed range is 0.1 to 60 seconds.
  963. @item response
  964. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  965. By default it is disabled.
  966. @item channel
  967. Set for which IR channel to display frequency response. By default is first channel
  968. displayed. This option is used only when @var{response} is enabled.
  969. @item size
  970. Set video stream size. This option is used only when @var{response} is enabled.
  971. @item rate
  972. Set video stream frame rate. This option is used only when @var{response} is enabled.
  973. @item minp
  974. Set minimal partition size used for convolution. Default is @var{8192}.
  975. Allowed range is from @var{1} to @var{32768}.
  976. Lower values decreases latency at cost of higher CPU usage.
  977. @item maxp
  978. Set maximal partition size used for convolution. Default is @var{8192}.
  979. Allowed range is from @var{8} to @var{32768}.
  980. Lower values may increase CPU usage.
  981. @item nbirs
  982. Set number of input impulse responses streams which will be switchable at runtime.
  983. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  984. @item ir
  985. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  986. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  987. This option can be changed at runtime via @ref{commands}.
  988. @end table
  989. @subsection Examples
  990. @itemize
  991. @item
  992. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  993. @example
  994. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  995. @end example
  996. @end itemize
  997. @anchor{aformat}
  998. @section aformat
  999. Set output format constraints for the input audio. The framework will
  1000. negotiate the most appropriate format to minimize conversions.
  1001. It accepts the following parameters:
  1002. @table @option
  1003. @item sample_fmts, f
  1004. A '|'-separated list of requested sample formats.
  1005. @item sample_rates, r
  1006. A '|'-separated list of requested sample rates.
  1007. @item channel_layouts, cl
  1008. A '|'-separated list of requested channel layouts.
  1009. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1010. for the required syntax.
  1011. @end table
  1012. If a parameter is omitted, all values are allowed.
  1013. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1014. @example
  1015. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1016. @end example
  1017. @section agate
  1018. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1019. processing reduces disturbing noise between useful signals.
  1020. Gating is done by detecting the volume below a chosen level @var{threshold}
  1021. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1022. floor is set via @var{range}. Because an exact manipulation of the signal
  1023. would cause distortion of the waveform the reduction can be levelled over
  1024. time. This is done by setting @var{attack} and @var{release}.
  1025. @var{attack} determines how long the signal has to fall below the threshold
  1026. before any reduction will occur and @var{release} sets the time the signal
  1027. has to rise above the threshold to reduce the reduction again.
  1028. Shorter signals than the chosen attack time will be left untouched.
  1029. @table @option
  1030. @item level_in
  1031. Set input level before filtering.
  1032. Default is 1. Allowed range is from 0.015625 to 64.
  1033. @item mode
  1034. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1035. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1036. will be amplified, expanding dynamic range in upward direction.
  1037. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1038. @item range
  1039. Set the level of gain reduction when the signal is below the threshold.
  1040. Default is 0.06125. Allowed range is from 0 to 1.
  1041. Setting this to 0 disables reduction and then filter behaves like expander.
  1042. @item threshold
  1043. If a signal rises above this level the gain reduction is released.
  1044. Default is 0.125. Allowed range is from 0 to 1.
  1045. @item ratio
  1046. Set a ratio by which the signal is reduced.
  1047. Default is 2. Allowed range is from 1 to 9000.
  1048. @item attack
  1049. Amount of milliseconds the signal has to rise above the threshold before gain
  1050. reduction stops.
  1051. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1052. @item release
  1053. Amount of milliseconds the signal has to fall below the threshold before the
  1054. reduction is increased again. Default is 250 milliseconds.
  1055. Allowed range is from 0.01 to 9000.
  1056. @item makeup
  1057. Set amount of amplification of signal after processing.
  1058. Default is 1. Allowed range is from 1 to 64.
  1059. @item knee
  1060. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1061. Default is 2.828427125. Allowed range is from 1 to 8.
  1062. @item detection
  1063. Choose if exact signal should be taken for detection or an RMS like one.
  1064. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1065. @item link
  1066. Choose if the average level between all channels or the louder channel affects
  1067. the reduction.
  1068. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1069. @end table
  1070. @section aiir
  1071. Apply an arbitrary Infinite Impulse Response filter.
  1072. It accepts the following parameters:
  1073. @table @option
  1074. @item zeros, z
  1075. Set numerator/zeros coefficients.
  1076. @item poles, p
  1077. Set denominator/poles coefficients.
  1078. @item gains, k
  1079. Set channels gains.
  1080. @item dry_gain
  1081. Set input gain.
  1082. @item wet_gain
  1083. Set output gain.
  1084. @item format, f
  1085. Set coefficients format.
  1086. @table @samp
  1087. @item tf
  1088. digital transfer function
  1089. @item zp
  1090. Z-plane zeros/poles, cartesian (default)
  1091. @item pr
  1092. Z-plane zeros/poles, polar radians
  1093. @item pd
  1094. Z-plane zeros/poles, polar degrees
  1095. @item sp
  1096. S-plane zeros/poles
  1097. @end table
  1098. @item process, r
  1099. Set kind of processing.
  1100. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1101. @item precision, e
  1102. Set filtering precision.
  1103. @table @samp
  1104. @item dbl
  1105. double-precision floating-point (default)
  1106. @item flt
  1107. single-precision floating-point
  1108. @item i32
  1109. 32-bit integers
  1110. @item i16
  1111. 16-bit integers
  1112. @end table
  1113. @item normalize, n
  1114. Normalize filter coefficients, by default is enabled.
  1115. Enabling it will normalize magnitude response at DC to 0dB.
  1116. @item mix
  1117. How much to use filtered signal in output. Default is 1.
  1118. Range is between 0 and 1.
  1119. @item response
  1120. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1121. By default it is disabled.
  1122. @item channel
  1123. Set for which IR channel to display frequency response. By default is first channel
  1124. displayed. This option is used only when @var{response} is enabled.
  1125. @item size
  1126. Set video stream size. This option is used only when @var{response} is enabled.
  1127. @end table
  1128. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1129. order.
  1130. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1131. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1132. imaginary unit.
  1133. Different coefficients and gains can be provided for every channel, in such case
  1134. use '|' to separate coefficients or gains. Last provided coefficients will be
  1135. used for all remaining channels.
  1136. @subsection Examples
  1137. @itemize
  1138. @item
  1139. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1140. @example
  1141. 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
  1142. @end example
  1143. @item
  1144. Same as above but in @code{zp} format:
  1145. @example
  1146. 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
  1147. @end example
  1148. @end itemize
  1149. @section alimiter
  1150. The limiter prevents an input signal from rising over a desired threshold.
  1151. This limiter uses lookahead technology to prevent your signal from distorting.
  1152. It means that there is a small delay after the signal is processed. Keep in mind
  1153. that the delay it produces is the attack time you set.
  1154. The filter accepts the following options:
  1155. @table @option
  1156. @item level_in
  1157. Set input gain. Default is 1.
  1158. @item level_out
  1159. Set output gain. Default is 1.
  1160. @item limit
  1161. Don't let signals above this level pass the limiter. Default is 1.
  1162. @item attack
  1163. The limiter will reach its attenuation level in this amount of time in
  1164. milliseconds. Default is 5 milliseconds.
  1165. @item release
  1166. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1167. Default is 50 milliseconds.
  1168. @item asc
  1169. When gain reduction is always needed ASC takes care of releasing to an
  1170. average reduction level rather than reaching a reduction of 0 in the release
  1171. time.
  1172. @item asc_level
  1173. Select how much the release time is affected by ASC, 0 means nearly no changes
  1174. in release time while 1 produces higher release times.
  1175. @item level
  1176. Auto level output signal. Default is enabled.
  1177. This normalizes audio back to 0dB if enabled.
  1178. @end table
  1179. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1180. with @ref{aresample} before applying this filter.
  1181. @section allpass
  1182. Apply a two-pole all-pass filter with central frequency (in Hz)
  1183. @var{frequency}, and filter-width @var{width}.
  1184. An all-pass filter changes the audio's frequency to phase relationship
  1185. without changing its frequency to amplitude relationship.
  1186. The filter accepts the following options:
  1187. @table @option
  1188. @item frequency, f
  1189. Set frequency in Hz.
  1190. @item width_type, t
  1191. Set method to specify band-width of filter.
  1192. @table @option
  1193. @item h
  1194. Hz
  1195. @item q
  1196. Q-Factor
  1197. @item o
  1198. octave
  1199. @item s
  1200. slope
  1201. @item k
  1202. kHz
  1203. @end table
  1204. @item width, w
  1205. Specify the band-width of a filter in width_type units.
  1206. @item mix, m
  1207. How much to use filtered signal in output. Default is 1.
  1208. Range is between 0 and 1.
  1209. @item channels, c
  1210. Specify which channels to filter, by default all available are filtered.
  1211. @item normalize, n
  1212. Normalize biquad coefficients, by default is disabled.
  1213. Enabling it will normalize magnitude response at DC to 0dB.
  1214. @item order, o
  1215. Set the filter order, can be 1 or 2. Default is 2.
  1216. @item transform, a
  1217. Set transform type of IIR filter.
  1218. @table @option
  1219. @item di
  1220. @item dii
  1221. @item tdii
  1222. @end table
  1223. @end table
  1224. @subsection Commands
  1225. This filter supports the following commands:
  1226. @table @option
  1227. @item frequency, f
  1228. Change allpass frequency.
  1229. Syntax for the command is : "@var{frequency}"
  1230. @item width_type, t
  1231. Change allpass width_type.
  1232. Syntax for the command is : "@var{width_type}"
  1233. @item width, w
  1234. Change allpass width.
  1235. Syntax for the command is : "@var{width}"
  1236. @item mix, m
  1237. Change allpass mix.
  1238. Syntax for the command is : "@var{mix}"
  1239. @end table
  1240. @section aloop
  1241. Loop audio samples.
  1242. The filter accepts the following options:
  1243. @table @option
  1244. @item loop
  1245. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1246. Default is 0.
  1247. @item size
  1248. Set maximal number of samples. Default is 0.
  1249. @item start
  1250. Set first sample of loop. Default is 0.
  1251. @end table
  1252. @anchor{amerge}
  1253. @section amerge
  1254. Merge two or more audio streams into a single multi-channel stream.
  1255. The filter accepts the following options:
  1256. @table @option
  1257. @item inputs
  1258. Set the number of inputs. Default is 2.
  1259. @end table
  1260. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1261. the channel layout of the output will be set accordingly and the channels
  1262. will be reordered as necessary. If the channel layouts of the inputs are not
  1263. disjoint, the output will have all the channels of the first input then all
  1264. the channels of the second input, in that order, and the channel layout of
  1265. the output will be the default value corresponding to the total number of
  1266. channels.
  1267. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1268. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1269. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1270. first input, b1 is the first channel of the second input).
  1271. On the other hand, if both input are in stereo, the output channels will be
  1272. in the default order: a1, a2, b1, b2, and the channel layout will be
  1273. arbitrarily set to 4.0, which may or may not be the expected value.
  1274. All inputs must have the same sample rate, and format.
  1275. If inputs do not have the same duration, the output will stop with the
  1276. shortest.
  1277. @subsection Examples
  1278. @itemize
  1279. @item
  1280. Merge two mono files into a stereo stream:
  1281. @example
  1282. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1283. @end example
  1284. @item
  1285. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1286. @example
  1287. 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
  1288. @end example
  1289. @end itemize
  1290. @section amix
  1291. Mixes multiple audio inputs into a single output.
  1292. Note that this filter only supports float samples (the @var{amerge}
  1293. and @var{pan} audio filters support many formats). If the @var{amix}
  1294. input has integer samples then @ref{aresample} will be automatically
  1295. inserted to perform the conversion to float samples.
  1296. For example
  1297. @example
  1298. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1299. @end example
  1300. will mix 3 input audio streams to a single output with the same duration as the
  1301. first input and a dropout transition time of 3 seconds.
  1302. It accepts the following parameters:
  1303. @table @option
  1304. @item inputs
  1305. The number of inputs. If unspecified, it defaults to 2.
  1306. @item duration
  1307. How to determine the end-of-stream.
  1308. @table @option
  1309. @item longest
  1310. The duration of the longest input. (default)
  1311. @item shortest
  1312. The duration of the shortest input.
  1313. @item first
  1314. The duration of the first input.
  1315. @end table
  1316. @item dropout_transition
  1317. The transition time, in seconds, for volume renormalization when an input
  1318. stream ends. The default value is 2 seconds.
  1319. @item weights
  1320. Specify weight of each input audio stream as sequence.
  1321. Each weight is separated by space. By default all inputs have same weight.
  1322. @end table
  1323. @subsection Commands
  1324. This filter supports the following commands:
  1325. @table @option
  1326. @item weights
  1327. Syntax is same as option with same name.
  1328. @end table
  1329. @section amultiply
  1330. Multiply first audio stream with second audio stream and store result
  1331. in output audio stream. Multiplication is done by multiplying each
  1332. sample from first stream with sample at same position from second stream.
  1333. With this element-wise multiplication one can create amplitude fades and
  1334. amplitude modulations.
  1335. @section anequalizer
  1336. High-order parametric multiband equalizer for each channel.
  1337. It accepts the following parameters:
  1338. @table @option
  1339. @item params
  1340. This option string is in format:
  1341. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1342. Each equalizer band is separated by '|'.
  1343. @table @option
  1344. @item chn
  1345. Set channel number to which equalization will be applied.
  1346. If input doesn't have that channel the entry is ignored.
  1347. @item f
  1348. Set central frequency for band.
  1349. If input doesn't have that frequency the entry is ignored.
  1350. @item w
  1351. Set band width in hertz.
  1352. @item g
  1353. Set band gain in dB.
  1354. @item t
  1355. Set filter type for band, optional, can be:
  1356. @table @samp
  1357. @item 0
  1358. Butterworth, this is default.
  1359. @item 1
  1360. Chebyshev type 1.
  1361. @item 2
  1362. Chebyshev type 2.
  1363. @end table
  1364. @end table
  1365. @item curves
  1366. With this option activated frequency response of anequalizer is displayed
  1367. in video stream.
  1368. @item size
  1369. Set video stream size. Only useful if curves option is activated.
  1370. @item mgain
  1371. Set max gain that will be displayed. Only useful if curves option is activated.
  1372. Setting this to a reasonable value makes it possible to display gain which is derived from
  1373. neighbour bands which are too close to each other and thus produce higher gain
  1374. when both are activated.
  1375. @item fscale
  1376. Set frequency scale used to draw frequency response in video output.
  1377. Can be linear or logarithmic. Default is logarithmic.
  1378. @item colors
  1379. Set color for each channel curve which is going to be displayed in video stream.
  1380. This is list of color names separated by space or by '|'.
  1381. Unrecognised or missing colors will be replaced by white color.
  1382. @end table
  1383. @subsection Examples
  1384. @itemize
  1385. @item
  1386. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1387. for first 2 channels using Chebyshev type 1 filter:
  1388. @example
  1389. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1390. @end example
  1391. @end itemize
  1392. @subsection Commands
  1393. This filter supports the following commands:
  1394. @table @option
  1395. @item change
  1396. Alter existing filter parameters.
  1397. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1398. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1399. error is returned.
  1400. @var{freq} set new frequency parameter.
  1401. @var{width} set new width parameter in herz.
  1402. @var{gain} set new gain parameter in dB.
  1403. Full filter invocation with asendcmd may look like this:
  1404. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1405. @end table
  1406. @section anlmdn
  1407. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1408. Each sample is adjusted by looking for other samples with similar contexts. This
  1409. context similarity is defined by comparing their surrounding patches of size
  1410. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1411. The filter accepts the following options:
  1412. @table @option
  1413. @item s
  1414. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1415. @item p
  1416. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1417. Default value is 2 milliseconds.
  1418. @item r
  1419. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1420. Default value is 6 milliseconds.
  1421. @item o
  1422. Set the output mode.
  1423. It accepts the following values:
  1424. @table @option
  1425. @item i
  1426. Pass input unchanged.
  1427. @item o
  1428. Pass noise filtered out.
  1429. @item n
  1430. Pass only noise.
  1431. Default value is @var{o}.
  1432. @end table
  1433. @item m
  1434. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1435. @end table
  1436. @subsection Commands
  1437. This filter supports the following commands:
  1438. @table @option
  1439. @item s
  1440. Change denoise strength. Argument is single float number.
  1441. Syntax for the command is : "@var{s}"
  1442. @item o
  1443. Change output mode.
  1444. Syntax for the command is : "i", "o" or "n" string.
  1445. @end table
  1446. @section anlms
  1447. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1448. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1449. relate to producing the least mean square of the error signal (difference between the desired,
  1450. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1451. A description of the accepted options follows.
  1452. @table @option
  1453. @item order
  1454. Set filter order.
  1455. @item mu
  1456. Set filter mu.
  1457. @item eps
  1458. Set the filter eps.
  1459. @item leakage
  1460. Set the filter leakage.
  1461. @item out_mode
  1462. It accepts the following values:
  1463. @table @option
  1464. @item i
  1465. Pass the 1st input.
  1466. @item d
  1467. Pass the 2nd input.
  1468. @item o
  1469. Pass filtered samples.
  1470. @item n
  1471. Pass difference between desired and filtered samples.
  1472. Default value is @var{o}.
  1473. @end table
  1474. @end table
  1475. @subsection Examples
  1476. @itemize
  1477. @item
  1478. One of many usages of this filter is noise reduction, input audio is filtered
  1479. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1480. @example
  1481. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1482. @end example
  1483. @end itemize
  1484. @subsection Commands
  1485. This filter supports the same commands as options, excluding option @code{order}.
  1486. @section anull
  1487. Pass the audio source unchanged to the output.
  1488. @section apad
  1489. Pad the end of an audio stream with silence.
  1490. This can be used together with @command{ffmpeg} @option{-shortest} to
  1491. extend audio streams to the same length as the video stream.
  1492. A description of the accepted options follows.
  1493. @table @option
  1494. @item packet_size
  1495. Set silence packet size. Default value is 4096.
  1496. @item pad_len
  1497. Set the number of samples of silence to add to the end. After the
  1498. value is reached, the stream is terminated. This option is mutually
  1499. exclusive with @option{whole_len}.
  1500. @item whole_len
  1501. Set the minimum total number of samples in the output audio stream. If
  1502. the value is longer than the input audio length, silence is added to
  1503. the end, until the value is reached. This option is mutually exclusive
  1504. with @option{pad_len}.
  1505. @item pad_dur
  1506. Specify the duration of samples of silence to add. See
  1507. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1508. for the accepted syntax. Used only if set to non-zero value.
  1509. @item whole_dur
  1510. Specify the minimum total duration in the output audio stream. See
  1511. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1512. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1513. the input audio length, silence is added to the end, until the value is reached.
  1514. This option is mutually exclusive with @option{pad_dur}
  1515. @end table
  1516. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1517. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1518. the input stream indefinitely.
  1519. @subsection Examples
  1520. @itemize
  1521. @item
  1522. Add 1024 samples of silence to the end of the input:
  1523. @example
  1524. apad=pad_len=1024
  1525. @end example
  1526. @item
  1527. Make sure the audio output will contain at least 10000 samples, pad
  1528. the input with silence if required:
  1529. @example
  1530. apad=whole_len=10000
  1531. @end example
  1532. @item
  1533. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1534. video stream will always result the shortest and will be converted
  1535. until the end in the output file when using the @option{shortest}
  1536. option:
  1537. @example
  1538. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1539. @end example
  1540. @end itemize
  1541. @section aphaser
  1542. Add a phasing effect to the input audio.
  1543. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1544. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1545. A description of the accepted parameters follows.
  1546. @table @option
  1547. @item in_gain
  1548. Set input gain. Default is 0.4.
  1549. @item out_gain
  1550. Set output gain. Default is 0.74
  1551. @item delay
  1552. Set delay in milliseconds. Default is 3.0.
  1553. @item decay
  1554. Set decay. Default is 0.4.
  1555. @item speed
  1556. Set modulation speed in Hz. Default is 0.5.
  1557. @item type
  1558. Set modulation type. Default is triangular.
  1559. It accepts the following values:
  1560. @table @samp
  1561. @item triangular, t
  1562. @item sinusoidal, s
  1563. @end table
  1564. @end table
  1565. @section apulsator
  1566. Audio pulsator is something between an autopanner and a tremolo.
  1567. But it can produce funny stereo effects as well. Pulsator changes the volume
  1568. of the left and right channel based on a LFO (low frequency oscillator) with
  1569. different waveforms and shifted phases.
  1570. This filter have the ability to define an offset between left and right
  1571. channel. An offset of 0 means that both LFO shapes match each other.
  1572. The left and right channel are altered equally - a conventional tremolo.
  1573. An offset of 50% means that the shape of the right channel is exactly shifted
  1574. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1575. an autopanner. At 1 both curves match again. Every setting in between moves the
  1576. phase shift gapless between all stages and produces some "bypassing" sounds with
  1577. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1578. the 0.5) the faster the signal passes from the left to the right speaker.
  1579. The filter accepts the following options:
  1580. @table @option
  1581. @item level_in
  1582. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1583. @item level_out
  1584. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1585. @item mode
  1586. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1587. sawup or sawdown. Default is sine.
  1588. @item amount
  1589. Set modulation. Define how much of original signal is affected by the LFO.
  1590. @item offset_l
  1591. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1592. @item offset_r
  1593. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1594. @item width
  1595. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1596. @item timing
  1597. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1598. @item bpm
  1599. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1600. is set to bpm.
  1601. @item ms
  1602. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1603. is set to ms.
  1604. @item hz
  1605. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1606. if timing is set to hz.
  1607. @end table
  1608. @anchor{aresample}
  1609. @section aresample
  1610. Resample the input audio to the specified parameters, using the
  1611. libswresample library. If none are specified then the filter will
  1612. automatically convert between its input and output.
  1613. This filter is also able to stretch/squeeze the audio data to make it match
  1614. the timestamps or to inject silence / cut out audio to make it match the
  1615. timestamps, do a combination of both or do neither.
  1616. The filter accepts the syntax
  1617. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1618. expresses a sample rate and @var{resampler_options} is a list of
  1619. @var{key}=@var{value} pairs, separated by ":". See the
  1620. @ref{Resampler Options,,"Resampler Options" section in the
  1621. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1622. for the complete list of supported options.
  1623. @subsection Examples
  1624. @itemize
  1625. @item
  1626. Resample the input audio to 44100Hz:
  1627. @example
  1628. aresample=44100
  1629. @end example
  1630. @item
  1631. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1632. samples per second compensation:
  1633. @example
  1634. aresample=async=1000
  1635. @end example
  1636. @end itemize
  1637. @section areverse
  1638. Reverse an audio clip.
  1639. Warning: This filter requires memory to buffer the entire clip, so trimming
  1640. is suggested.
  1641. @subsection Examples
  1642. @itemize
  1643. @item
  1644. Take the first 5 seconds of a clip, and reverse it.
  1645. @example
  1646. atrim=end=5,areverse
  1647. @end example
  1648. @end itemize
  1649. @section arnndn
  1650. Reduce noise from speech using Recurrent Neural Networks.
  1651. This filter accepts the following options:
  1652. @table @option
  1653. @item model, m
  1654. Set train model file to load. This option is always required.
  1655. @end table
  1656. @section asetnsamples
  1657. Set the number of samples per each output audio frame.
  1658. The last output packet may contain a different number of samples, as
  1659. the filter will flush all the remaining samples when the input audio
  1660. signals its end.
  1661. The filter accepts the following options:
  1662. @table @option
  1663. @item nb_out_samples, n
  1664. Set the number of frames per each output audio frame. The number is
  1665. intended as the number of samples @emph{per each channel}.
  1666. Default value is 1024.
  1667. @item pad, p
  1668. If set to 1, the filter will pad the last audio frame with zeroes, so
  1669. that the last frame will contain the same number of samples as the
  1670. previous ones. Default value is 1.
  1671. @end table
  1672. For example, to set the number of per-frame samples to 1234 and
  1673. disable padding for the last frame, use:
  1674. @example
  1675. asetnsamples=n=1234:p=0
  1676. @end example
  1677. @section asetrate
  1678. Set the sample rate without altering the PCM data.
  1679. This will result in a change of speed and pitch.
  1680. The filter accepts the following options:
  1681. @table @option
  1682. @item sample_rate, r
  1683. Set the output sample rate. Default is 44100 Hz.
  1684. @end table
  1685. @section ashowinfo
  1686. Show a line containing various information for each input audio frame.
  1687. The input audio is not modified.
  1688. The shown line contains a sequence of key/value pairs of the form
  1689. @var{key}:@var{value}.
  1690. The following values are shown in the output:
  1691. @table @option
  1692. @item n
  1693. The (sequential) number of the input frame, starting from 0.
  1694. @item pts
  1695. The presentation timestamp of the input frame, in time base units; the time base
  1696. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1697. @item pts_time
  1698. The presentation timestamp of the input frame in seconds.
  1699. @item pos
  1700. position of the frame in the input stream, -1 if this information in
  1701. unavailable and/or meaningless (for example in case of synthetic audio)
  1702. @item fmt
  1703. The sample format.
  1704. @item chlayout
  1705. The channel layout.
  1706. @item rate
  1707. The sample rate for the audio frame.
  1708. @item nb_samples
  1709. The number of samples (per channel) in the frame.
  1710. @item checksum
  1711. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1712. audio, the data is treated as if all the planes were concatenated.
  1713. @item plane_checksums
  1714. A list of Adler-32 checksums for each data plane.
  1715. @end table
  1716. @section asoftclip
  1717. Apply audio soft clipping.
  1718. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1719. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1720. This filter accepts the following options:
  1721. @table @option
  1722. @item type
  1723. Set type of soft-clipping.
  1724. It accepts the following values:
  1725. @table @option
  1726. @item tanh
  1727. @item atan
  1728. @item cubic
  1729. @item exp
  1730. @item alg
  1731. @item quintic
  1732. @item sin
  1733. @end table
  1734. @item param
  1735. Set additional parameter which controls sigmoid function.
  1736. @end table
  1737. @subsection Commands
  1738. This filter supports the all above options as @ref{commands}.
  1739. @section asr
  1740. Automatic Speech Recognition
  1741. This filter uses PocketSphinx for speech recognition. To enable
  1742. compilation of this filter, you need to configure FFmpeg with
  1743. @code{--enable-pocketsphinx}.
  1744. It accepts the following options:
  1745. @table @option
  1746. @item rate
  1747. Set sampling rate of input audio. Defaults is @code{16000}.
  1748. This need to match speech models, otherwise one will get poor results.
  1749. @item hmm
  1750. Set dictionary containing acoustic model files.
  1751. @item dict
  1752. Set pronunciation dictionary.
  1753. @item lm
  1754. Set language model file.
  1755. @item lmctl
  1756. Set language model set.
  1757. @item lmname
  1758. Set which language model to use.
  1759. @item logfn
  1760. Set output for log messages.
  1761. @end table
  1762. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1763. @anchor{astats}
  1764. @section astats
  1765. Display time domain statistical information about the audio channels.
  1766. Statistics are calculated and displayed for each audio channel and,
  1767. where applicable, an overall figure is also given.
  1768. It accepts the following option:
  1769. @table @option
  1770. @item length
  1771. Short window length in seconds, used for peak and trough RMS measurement.
  1772. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1773. @item metadata
  1774. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1775. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1776. disabled.
  1777. Available keys for each channel are:
  1778. DC_offset
  1779. Min_level
  1780. Max_level
  1781. Min_difference
  1782. Max_difference
  1783. Mean_difference
  1784. RMS_difference
  1785. Peak_level
  1786. RMS_peak
  1787. RMS_trough
  1788. Crest_factor
  1789. Flat_factor
  1790. Peak_count
  1791. Noise_floor
  1792. Noise_floor_count
  1793. Bit_depth
  1794. Dynamic_range
  1795. Zero_crossings
  1796. Zero_crossings_rate
  1797. Number_of_NaNs
  1798. Number_of_Infs
  1799. Number_of_denormals
  1800. and for Overall:
  1801. DC_offset
  1802. Min_level
  1803. Max_level
  1804. Min_difference
  1805. Max_difference
  1806. Mean_difference
  1807. RMS_difference
  1808. Peak_level
  1809. RMS_level
  1810. RMS_peak
  1811. RMS_trough
  1812. Flat_factor
  1813. Peak_count
  1814. Noise_floor
  1815. Noise_floor_count
  1816. Bit_depth
  1817. Number_of_samples
  1818. Number_of_NaNs
  1819. Number_of_Infs
  1820. Number_of_denormals
  1821. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1822. this @code{lavfi.astats.Overall.Peak_count}.
  1823. For description what each key means read below.
  1824. @item reset
  1825. Set number of frame after which stats are going to be recalculated.
  1826. Default is disabled.
  1827. @item measure_perchannel
  1828. Select the entries which need to be measured per channel. The metadata keys can
  1829. be used as flags, default is @option{all} which measures everything.
  1830. @option{none} disables all per channel measurement.
  1831. @item measure_overall
  1832. Select the entries which need to be measured overall. The metadata keys can
  1833. be used as flags, default is @option{all} which measures everything.
  1834. @option{none} disables all overall measurement.
  1835. @end table
  1836. A description of each shown parameter follows:
  1837. @table @option
  1838. @item DC offset
  1839. Mean amplitude displacement from zero.
  1840. @item Min level
  1841. Minimal sample level.
  1842. @item Max level
  1843. Maximal sample level.
  1844. @item Min difference
  1845. Minimal difference between two consecutive samples.
  1846. @item Max difference
  1847. Maximal difference between two consecutive samples.
  1848. @item Mean difference
  1849. Mean difference between two consecutive samples.
  1850. The average of each difference between two consecutive samples.
  1851. @item RMS difference
  1852. Root Mean Square difference between two consecutive samples.
  1853. @item Peak level dB
  1854. @item RMS level dB
  1855. Standard peak and RMS level measured in dBFS.
  1856. @item RMS peak dB
  1857. @item RMS trough dB
  1858. Peak and trough values for RMS level measured over a short window.
  1859. @item Crest factor
  1860. Standard ratio of peak to RMS level (note: not in dB).
  1861. @item Flat factor
  1862. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1863. (i.e. either @var{Min level} or @var{Max level}).
  1864. @item Peak count
  1865. Number of occasions (not the number of samples) that the signal attained either
  1866. @var{Min level} or @var{Max level}.
  1867. @item Noise floor dB
  1868. Minimum local peak measured in dBFS over a short window.
  1869. @item Noise floor count
  1870. Number of occasions (not the number of samples) that the signal attained
  1871. @var{Noise floor}.
  1872. @item Bit depth
  1873. Overall bit depth of audio. Number of bits used for each sample.
  1874. @item Dynamic range
  1875. Measured dynamic range of audio in dB.
  1876. @item Zero crossings
  1877. Number of points where the waveform crosses the zero level axis.
  1878. @item Zero crossings rate
  1879. Rate of Zero crossings and number of audio samples.
  1880. @end table
  1881. @section asubboost
  1882. Boost subwoofer frequencies.
  1883. The filter accepts the following options:
  1884. @table @option
  1885. @item dry
  1886. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  1887. Default value is 0.5.
  1888. @item wet
  1889. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  1890. Default value is 0.8.
  1891. @item decay
  1892. Set delay line decay gain value. Allowed range is from 0 to 1.
  1893. Default value is 0.7.
  1894. @item feedback
  1895. Set delay line feedback gain value. Allowed range is from 0 to 1.
  1896. Default value is 0.5.
  1897. @item cutoff
  1898. Set cutoff frequency in herz. Allowed range is 50 to 900.
  1899. Default value is 100.
  1900. @item slope
  1901. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  1902. Default value is 0.5.
  1903. @item delay
  1904. Set delay. Allowed range is from 1 to 100.
  1905. Default value is 20.
  1906. @end table
  1907. @subsection Commands
  1908. This filter supports the all above options as @ref{commands}.
  1909. @section atempo
  1910. Adjust audio tempo.
  1911. The filter accepts exactly one parameter, the audio tempo. If not
  1912. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1913. be in the [0.5, 100.0] range.
  1914. Note that tempo greater than 2 will skip some samples rather than
  1915. blend them in. If for any reason this is a concern it is always
  1916. possible to daisy-chain several instances of atempo to achieve the
  1917. desired product tempo.
  1918. @subsection Examples
  1919. @itemize
  1920. @item
  1921. Slow down audio to 80% tempo:
  1922. @example
  1923. atempo=0.8
  1924. @end example
  1925. @item
  1926. To speed up audio to 300% tempo:
  1927. @example
  1928. atempo=3
  1929. @end example
  1930. @item
  1931. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1932. @example
  1933. atempo=sqrt(3),atempo=sqrt(3)
  1934. @end example
  1935. @end itemize
  1936. @subsection Commands
  1937. This filter supports the following commands:
  1938. @table @option
  1939. @item tempo
  1940. Change filter tempo scale factor.
  1941. Syntax for the command is : "@var{tempo}"
  1942. @end table
  1943. @section atrim
  1944. Trim the input so that the output contains one continuous subpart of the input.
  1945. It accepts the following parameters:
  1946. @table @option
  1947. @item start
  1948. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1949. sample with the timestamp @var{start} will be the first sample in the output.
  1950. @item end
  1951. Specify time of the first audio sample that will be dropped, i.e. the
  1952. audio sample immediately preceding the one with the timestamp @var{end} will be
  1953. the last sample in the output.
  1954. @item start_pts
  1955. Same as @var{start}, except this option sets the start timestamp in samples
  1956. instead of seconds.
  1957. @item end_pts
  1958. Same as @var{end}, except this option sets the end timestamp in samples instead
  1959. of seconds.
  1960. @item duration
  1961. The maximum duration of the output in seconds.
  1962. @item start_sample
  1963. The number of the first sample that should be output.
  1964. @item end_sample
  1965. The number of the first sample that should be dropped.
  1966. @end table
  1967. @option{start}, @option{end}, and @option{duration} are expressed as time
  1968. duration specifications; see
  1969. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1970. Note that the first two sets of the start/end options and the @option{duration}
  1971. option look at the frame timestamp, while the _sample options simply count the
  1972. samples that pass through the filter. So start/end_pts and start/end_sample will
  1973. give different results when the timestamps are wrong, inexact or do not start at
  1974. zero. Also note that this filter does not modify the timestamps. If you wish
  1975. to have the output timestamps start at zero, insert the asetpts filter after the
  1976. atrim filter.
  1977. If multiple start or end options are set, this filter tries to be greedy and
  1978. keep all samples that match at least one of the specified constraints. To keep
  1979. only the part that matches all the constraints at once, chain multiple atrim
  1980. filters.
  1981. The defaults are such that all the input is kept. So it is possible to set e.g.
  1982. just the end values to keep everything before the specified time.
  1983. Examples:
  1984. @itemize
  1985. @item
  1986. Drop everything except the second minute of input:
  1987. @example
  1988. ffmpeg -i INPUT -af atrim=60:120
  1989. @end example
  1990. @item
  1991. Keep only the first 1000 samples:
  1992. @example
  1993. ffmpeg -i INPUT -af atrim=end_sample=1000
  1994. @end example
  1995. @end itemize
  1996. @section axcorrelate
  1997. Calculate normalized cross-correlation between two input audio streams.
  1998. Resulted samples are always between -1 and 1 inclusive.
  1999. If result is 1 it means two input samples are highly correlated in that selected segment.
  2000. Result 0 means they are not correlated at all.
  2001. If result is -1 it means two input samples are out of phase, which means they cancel each
  2002. other.
  2003. The filter accepts the following options:
  2004. @table @option
  2005. @item size
  2006. Set size of segment over which cross-correlation is calculated.
  2007. Default is 256. Allowed range is from 2 to 131072.
  2008. @item algo
  2009. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2010. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2011. are always zero and thus need much less calculations to make.
  2012. This is generally not true, but is valid for typical audio streams.
  2013. @end table
  2014. @subsection Examples
  2015. @itemize
  2016. @item
  2017. Calculate correlation between channels in stereo audio stream:
  2018. @example
  2019. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2020. @end example
  2021. @end itemize
  2022. @section bandpass
  2023. Apply a two-pole Butterworth band-pass filter with central
  2024. frequency @var{frequency}, and (3dB-point) band-width width.
  2025. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2026. instead of the default: constant 0dB peak gain.
  2027. The filter roll off at 6dB per octave (20dB per decade).
  2028. The filter accepts the following options:
  2029. @table @option
  2030. @item frequency, f
  2031. Set the filter's central frequency. Default is @code{3000}.
  2032. @item csg
  2033. Constant skirt gain if set to 1. Defaults to 0.
  2034. @item width_type, t
  2035. Set method to specify band-width of filter.
  2036. @table @option
  2037. @item h
  2038. Hz
  2039. @item q
  2040. Q-Factor
  2041. @item o
  2042. octave
  2043. @item s
  2044. slope
  2045. @item k
  2046. kHz
  2047. @end table
  2048. @item width, w
  2049. Specify the band-width of a filter in width_type units.
  2050. @item mix, m
  2051. How much to use filtered signal in output. Default is 1.
  2052. Range is between 0 and 1.
  2053. @item channels, c
  2054. Specify which channels to filter, by default all available are filtered.
  2055. @item normalize, n
  2056. Normalize biquad coefficients, by default is disabled.
  2057. Enabling it will normalize magnitude response at DC to 0dB.
  2058. @item transform, a
  2059. Set transform type of IIR filter.
  2060. @table @option
  2061. @item di
  2062. @item dii
  2063. @item tdii
  2064. @end table
  2065. @end table
  2066. @subsection Commands
  2067. This filter supports the following commands:
  2068. @table @option
  2069. @item frequency, f
  2070. Change bandpass frequency.
  2071. Syntax for the command is : "@var{frequency}"
  2072. @item width_type, t
  2073. Change bandpass width_type.
  2074. Syntax for the command is : "@var{width_type}"
  2075. @item width, w
  2076. Change bandpass width.
  2077. Syntax for the command is : "@var{width}"
  2078. @item mix, m
  2079. Change bandpass mix.
  2080. Syntax for the command is : "@var{mix}"
  2081. @end table
  2082. @section bandreject
  2083. Apply a two-pole Butterworth band-reject filter with central
  2084. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2085. The filter roll off at 6dB per octave (20dB per decade).
  2086. The filter accepts the following options:
  2087. @table @option
  2088. @item frequency, f
  2089. Set the filter's central frequency. Default is @code{3000}.
  2090. @item width_type, t
  2091. Set method to specify band-width of filter.
  2092. @table @option
  2093. @item h
  2094. Hz
  2095. @item q
  2096. Q-Factor
  2097. @item o
  2098. octave
  2099. @item s
  2100. slope
  2101. @item k
  2102. kHz
  2103. @end table
  2104. @item width, w
  2105. Specify the band-width of a filter in width_type units.
  2106. @item mix, m
  2107. How much to use filtered signal in output. Default is 1.
  2108. Range is between 0 and 1.
  2109. @item channels, c
  2110. Specify which channels to filter, by default all available are filtered.
  2111. @item normalize, n
  2112. Normalize biquad coefficients, by default is disabled.
  2113. Enabling it will normalize magnitude response at DC to 0dB.
  2114. @item transform, a
  2115. Set transform type of IIR filter.
  2116. @table @option
  2117. @item di
  2118. @item dii
  2119. @item tdii
  2120. @end table
  2121. @end table
  2122. @subsection Commands
  2123. This filter supports the following commands:
  2124. @table @option
  2125. @item frequency, f
  2126. Change bandreject frequency.
  2127. Syntax for the command is : "@var{frequency}"
  2128. @item width_type, t
  2129. Change bandreject width_type.
  2130. Syntax for the command is : "@var{width_type}"
  2131. @item width, w
  2132. Change bandreject width.
  2133. Syntax for the command is : "@var{width}"
  2134. @item mix, m
  2135. Change bandreject mix.
  2136. Syntax for the command is : "@var{mix}"
  2137. @end table
  2138. @section bass, lowshelf
  2139. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2140. shelving filter with a response similar to that of a standard
  2141. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2142. The filter accepts the following options:
  2143. @table @option
  2144. @item gain, g
  2145. Give the gain at 0 Hz. Its useful range is about -20
  2146. (for a large cut) to +20 (for a large boost).
  2147. Beware of clipping when using a positive gain.
  2148. @item frequency, f
  2149. Set the filter's central frequency and so can be used
  2150. to extend or reduce the frequency range to be boosted or cut.
  2151. The default value is @code{100} Hz.
  2152. @item width_type, t
  2153. Set method to specify band-width of filter.
  2154. @table @option
  2155. @item h
  2156. Hz
  2157. @item q
  2158. Q-Factor
  2159. @item o
  2160. octave
  2161. @item s
  2162. slope
  2163. @item k
  2164. kHz
  2165. @end table
  2166. @item width, w
  2167. Determine how steep is the filter's shelf transition.
  2168. @item mix, m
  2169. How much to use filtered signal in output. Default is 1.
  2170. Range is between 0 and 1.
  2171. @item channels, c
  2172. Specify which channels to filter, by default all available are filtered.
  2173. @item normalize, n
  2174. Normalize biquad coefficients, by default is disabled.
  2175. Enabling it will normalize magnitude response at DC to 0dB.
  2176. @item transform, a
  2177. Set transform type of IIR filter.
  2178. @table @option
  2179. @item di
  2180. @item dii
  2181. @item tdii
  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 bass frequency.
  2189. Syntax for the command is : "@var{frequency}"
  2190. @item width_type, t
  2191. Change bass width_type.
  2192. Syntax for the command is : "@var{width_type}"
  2193. @item width, w
  2194. Change bass width.
  2195. Syntax for the command is : "@var{width}"
  2196. @item gain, g
  2197. Change bass gain.
  2198. Syntax for the command is : "@var{gain}"
  2199. @item mix, m
  2200. Change bass mix.
  2201. Syntax for the command is : "@var{mix}"
  2202. @end table
  2203. @section biquad
  2204. Apply a biquad IIR filter with the given coefficients.
  2205. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2206. are the numerator and denominator coefficients respectively.
  2207. and @var{channels}, @var{c} specify which channels to filter, by default all
  2208. available are filtered.
  2209. @subsection Commands
  2210. This filter supports the following commands:
  2211. @table @option
  2212. @item a0
  2213. @item a1
  2214. @item a2
  2215. @item b0
  2216. @item b1
  2217. @item b2
  2218. Change biquad parameter.
  2219. Syntax for the command is : "@var{value}"
  2220. @item mix, m
  2221. How much to use filtered signal in output. Default is 1.
  2222. Range is between 0 and 1.
  2223. @item channels, c
  2224. Specify which channels to filter, by default all available are filtered.
  2225. @item normalize, n
  2226. Normalize biquad coefficients, by default is disabled.
  2227. Enabling it will normalize magnitude response at DC to 0dB.
  2228. @item transform, a
  2229. Set transform type of IIR filter.
  2230. @table @option
  2231. @item di
  2232. @item dii
  2233. @item tdii
  2234. @end table
  2235. @end table
  2236. @section bs2b
  2237. Bauer stereo to binaural transformation, which improves headphone listening of
  2238. stereo audio records.
  2239. To enable compilation of this filter you need to configure FFmpeg with
  2240. @code{--enable-libbs2b}.
  2241. It accepts the following parameters:
  2242. @table @option
  2243. @item profile
  2244. Pre-defined crossfeed level.
  2245. @table @option
  2246. @item default
  2247. Default level (fcut=700, feed=50).
  2248. @item cmoy
  2249. Chu Moy circuit (fcut=700, feed=60).
  2250. @item jmeier
  2251. Jan Meier circuit (fcut=650, feed=95).
  2252. @end table
  2253. @item fcut
  2254. Cut frequency (in Hz).
  2255. @item feed
  2256. Feed level (in Hz).
  2257. @end table
  2258. @section channelmap
  2259. Remap input channels to new locations.
  2260. It accepts the following parameters:
  2261. @table @option
  2262. @item map
  2263. Map channels from input to output. The argument is a '|'-separated list of
  2264. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2265. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2266. channel (e.g. FL for front left) or its index in the input channel layout.
  2267. @var{out_channel} is the name of the output channel or its index in the output
  2268. channel layout. If @var{out_channel} is not given then it is implicitly an
  2269. index, starting with zero and increasing by one for each mapping.
  2270. @item channel_layout
  2271. The channel layout of the output stream.
  2272. @end table
  2273. If no mapping is present, the filter will implicitly map input channels to
  2274. output channels, preserving indices.
  2275. @subsection Examples
  2276. @itemize
  2277. @item
  2278. For example, assuming a 5.1+downmix input MOV file,
  2279. @example
  2280. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2281. @end example
  2282. will create an output WAV file tagged as stereo from the downmix channels of
  2283. the input.
  2284. @item
  2285. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2286. @example
  2287. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2288. @end example
  2289. @end itemize
  2290. @section channelsplit
  2291. Split each channel from an input audio stream into a separate output stream.
  2292. It accepts the following parameters:
  2293. @table @option
  2294. @item channel_layout
  2295. The channel layout of the input stream. The default is "stereo".
  2296. @item channels
  2297. A channel layout describing the channels to be extracted as separate output streams
  2298. or "all" to extract each input channel as a separate stream. The default is "all".
  2299. Choosing channels not present in channel layout in the input will result in an error.
  2300. @end table
  2301. @subsection Examples
  2302. @itemize
  2303. @item
  2304. For example, assuming a stereo input MP3 file,
  2305. @example
  2306. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2307. @end example
  2308. will create an output Matroska file with two audio streams, one containing only
  2309. the left channel and the other the right channel.
  2310. @item
  2311. Split a 5.1 WAV file into per-channel files:
  2312. @example
  2313. ffmpeg -i in.wav -filter_complex
  2314. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2315. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2316. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2317. side_right.wav
  2318. @end example
  2319. @item
  2320. Extract only LFE from a 5.1 WAV file:
  2321. @example
  2322. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2323. -map '[LFE]' lfe.wav
  2324. @end example
  2325. @end itemize
  2326. @section chorus
  2327. Add a chorus effect to the audio.
  2328. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2329. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2330. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2331. The modulation depth defines the range the modulated delay is played before or after
  2332. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2333. sound tuned around the original one, like in a chorus where some vocals are slightly
  2334. off key.
  2335. It accepts the following parameters:
  2336. @table @option
  2337. @item in_gain
  2338. Set input gain. Default is 0.4.
  2339. @item out_gain
  2340. Set output gain. Default is 0.4.
  2341. @item delays
  2342. Set delays. A typical delay is around 40ms to 60ms.
  2343. @item decays
  2344. Set decays.
  2345. @item speeds
  2346. Set speeds.
  2347. @item depths
  2348. Set depths.
  2349. @end table
  2350. @subsection Examples
  2351. @itemize
  2352. @item
  2353. A single delay:
  2354. @example
  2355. chorus=0.7:0.9:55:0.4:0.25:2
  2356. @end example
  2357. @item
  2358. Two delays:
  2359. @example
  2360. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2361. @end example
  2362. @item
  2363. Fuller sounding chorus with three delays:
  2364. @example
  2365. 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
  2366. @end example
  2367. @end itemize
  2368. @section compand
  2369. Compress or expand the audio's dynamic range.
  2370. It accepts the following parameters:
  2371. @table @option
  2372. @item attacks
  2373. @item decays
  2374. A list of times in seconds for each channel over which the instantaneous level
  2375. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2376. increase of volume and @var{decays} refers to decrease of volume. For most
  2377. situations, the attack time (response to the audio getting louder) should be
  2378. shorter than the decay time, because the human ear is more sensitive to sudden
  2379. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2380. a typical value for decay is 0.8 seconds.
  2381. If specified number of attacks & decays is lower than number of channels, the last
  2382. set attack/decay will be used for all remaining channels.
  2383. @item points
  2384. A list of points for the transfer function, specified in dB relative to the
  2385. maximum possible signal amplitude. Each key points list must be defined using
  2386. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2387. @code{x0/y0 x1/y1 x2/y2 ....}
  2388. The input values must be in strictly increasing order but the transfer function
  2389. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2390. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2391. function are @code{-70/-70|-60/-20|1/0}.
  2392. @item soft-knee
  2393. Set the curve radius in dB for all joints. It defaults to 0.01.
  2394. @item gain
  2395. Set the additional gain in dB to be applied at all points on the transfer
  2396. function. This allows for easy adjustment of the overall gain.
  2397. It defaults to 0.
  2398. @item volume
  2399. Set an initial volume, in dB, to be assumed for each channel when filtering
  2400. starts. This permits the user to supply a nominal level initially, so that, for
  2401. example, a very large gain is not applied to initial signal levels before the
  2402. companding has begun to operate. A typical value for audio which is initially
  2403. quiet is -90 dB. It defaults to 0.
  2404. @item delay
  2405. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2406. delayed before being fed to the volume adjuster. Specifying a delay
  2407. approximately equal to the attack/decay times allows the filter to effectively
  2408. operate in predictive rather than reactive mode. It defaults to 0.
  2409. @end table
  2410. @subsection Examples
  2411. @itemize
  2412. @item
  2413. Make music with both quiet and loud passages suitable for listening to in a
  2414. noisy environment:
  2415. @example
  2416. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2417. @end example
  2418. Another example for audio with whisper and explosion parts:
  2419. @example
  2420. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2421. @end example
  2422. @item
  2423. A noise gate for when the noise is at a lower level than the signal:
  2424. @example
  2425. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2426. @end example
  2427. @item
  2428. Here is another noise gate, this time for when the noise is at a higher level
  2429. than the signal (making it, in some ways, similar to squelch):
  2430. @example
  2431. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2432. @end example
  2433. @item
  2434. 2:1 compression starting at -6dB:
  2435. @example
  2436. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2437. @end example
  2438. @item
  2439. 2:1 compression starting at -9dB:
  2440. @example
  2441. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2442. @end example
  2443. @item
  2444. 2:1 compression starting at -12dB:
  2445. @example
  2446. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2447. @end example
  2448. @item
  2449. 2:1 compression starting at -18dB:
  2450. @example
  2451. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2452. @end example
  2453. @item
  2454. 3:1 compression starting at -15dB:
  2455. @example
  2456. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2457. @end example
  2458. @item
  2459. Compressor/Gate:
  2460. @example
  2461. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2462. @end example
  2463. @item
  2464. Expander:
  2465. @example
  2466. 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
  2467. @end example
  2468. @item
  2469. Hard limiter at -6dB:
  2470. @example
  2471. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2472. @end example
  2473. @item
  2474. Hard limiter at -12dB:
  2475. @example
  2476. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2477. @end example
  2478. @item
  2479. Hard noise gate at -35 dB:
  2480. @example
  2481. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2482. @end example
  2483. @item
  2484. Soft limiter:
  2485. @example
  2486. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2487. @end example
  2488. @end itemize
  2489. @section compensationdelay
  2490. Compensation Delay Line is a metric based delay to compensate differing
  2491. positions of microphones or speakers.
  2492. For example, you have recorded guitar with two microphones placed in
  2493. different locations. Because the front of sound wave has fixed speed in
  2494. normal conditions, the phasing of microphones can vary and depends on
  2495. their location and interposition. The best sound mix can be achieved when
  2496. these microphones are in phase (synchronized). Note that a distance of
  2497. ~30 cm between microphones makes one microphone capture the signal in
  2498. antiphase to the other microphone. That makes the final mix sound moody.
  2499. This filter helps to solve phasing problems by adding different delays
  2500. to each microphone track and make them synchronized.
  2501. The best result can be reached when you take one track as base and
  2502. synchronize other tracks one by one with it.
  2503. Remember that synchronization/delay tolerance depends on sample rate, too.
  2504. Higher sample rates will give more tolerance.
  2505. The filter accepts the following parameters:
  2506. @table @option
  2507. @item mm
  2508. Set millimeters distance. This is compensation distance for fine tuning.
  2509. Default is 0.
  2510. @item cm
  2511. Set cm distance. This is compensation distance for tightening distance setup.
  2512. Default is 0.
  2513. @item m
  2514. Set meters distance. This is compensation distance for hard distance setup.
  2515. Default is 0.
  2516. @item dry
  2517. Set dry amount. Amount of unprocessed (dry) signal.
  2518. Default is 0.
  2519. @item wet
  2520. Set wet amount. Amount of processed (wet) signal.
  2521. Default is 1.
  2522. @item temp
  2523. Set temperature in degrees Celsius. This is the temperature of the environment.
  2524. Default is 20.
  2525. @end table
  2526. @section crossfeed
  2527. Apply headphone crossfeed filter.
  2528. Crossfeed is the process of blending the left and right channels of stereo
  2529. audio recording.
  2530. It is mainly used to reduce extreme stereo separation of low frequencies.
  2531. The intent is to produce more speaker like sound to the listener.
  2532. The filter accepts the following options:
  2533. @table @option
  2534. @item strength
  2535. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2536. This sets gain of low shelf filter for side part of stereo image.
  2537. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2538. @item range
  2539. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2540. This sets cut off frequency of low shelf filter. Default is cut off near
  2541. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2542. @item slope
  2543. Set curve slope of low shelf filter. Default is 0.5.
  2544. Allowed range is from 0.01 to 1.
  2545. @item level_in
  2546. Set input gain. Default is 0.9.
  2547. @item level_out
  2548. Set output gain. Default is 1.
  2549. @end table
  2550. @subsection Commands
  2551. This filter supports the all above options as @ref{commands}.
  2552. @section crystalizer
  2553. Simple algorithm to expand audio dynamic range.
  2554. The filter accepts the following options:
  2555. @table @option
  2556. @item i
  2557. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2558. (unchanged sound) to 10.0 (maximum effect).
  2559. @item c
  2560. Enable clipping. By default is enabled.
  2561. @end table
  2562. @subsection Commands
  2563. This filter supports the all above options as @ref{commands}.
  2564. @section dcshift
  2565. Apply a DC shift to the audio.
  2566. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2567. in the recording chain) from the audio. The effect of a DC offset is reduced
  2568. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2569. a signal has a DC offset.
  2570. @table @option
  2571. @item shift
  2572. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2573. the audio.
  2574. @item limitergain
  2575. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2576. used to prevent clipping.
  2577. @end table
  2578. @section deesser
  2579. Apply de-essing to the audio samples.
  2580. @table @option
  2581. @item i
  2582. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2583. Default is 0.
  2584. @item m
  2585. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2586. Default is 0.5.
  2587. @item f
  2588. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2589. Default is 0.5.
  2590. @item s
  2591. Set the output mode.
  2592. It accepts the following values:
  2593. @table @option
  2594. @item i
  2595. Pass input unchanged.
  2596. @item o
  2597. Pass ess filtered out.
  2598. @item e
  2599. Pass only ess.
  2600. Default value is @var{o}.
  2601. @end table
  2602. @end table
  2603. @section drmeter
  2604. Measure audio dynamic range.
  2605. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2606. is found in transition material. And anything less that 8 have very poor dynamics
  2607. and is very compressed.
  2608. The filter accepts the following options:
  2609. @table @option
  2610. @item length
  2611. Set window length in seconds used to split audio into segments of equal length.
  2612. Default is 3 seconds.
  2613. @end table
  2614. @section dynaudnorm
  2615. Dynamic Audio Normalizer.
  2616. This filter applies a certain amount of gain to the input audio in order
  2617. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2618. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2619. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2620. This allows for applying extra gain to the "quiet" sections of the audio
  2621. while avoiding distortions or clipping the "loud" sections. In other words:
  2622. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2623. sections, in the sense that the volume of each section is brought to the
  2624. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2625. this goal *without* applying "dynamic range compressing". It will retain 100%
  2626. of the dynamic range *within* each section of the audio file.
  2627. @table @option
  2628. @item framelen, f
  2629. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2630. Default is 500 milliseconds.
  2631. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2632. referred to as frames. This is required, because a peak magnitude has no
  2633. meaning for just a single sample value. Instead, we need to determine the
  2634. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2635. normalizer would simply use the peak magnitude of the complete file, the
  2636. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2637. frame. The length of a frame is specified in milliseconds. By default, the
  2638. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2639. been found to give good results with most files.
  2640. Note that the exact frame length, in number of samples, will be determined
  2641. automatically, based on the sampling rate of the individual input audio file.
  2642. @item gausssize, g
  2643. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2644. number. Default is 31.
  2645. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2646. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2647. is specified in frames, centered around the current frame. For the sake of
  2648. simplicity, this must be an odd number. Consequently, the default value of 31
  2649. takes into account the current frame, as well as the 15 preceding frames and
  2650. the 15 subsequent frames. Using a larger window results in a stronger
  2651. smoothing effect and thus in less gain variation, i.e. slower gain
  2652. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2653. effect and thus in more gain variation, i.e. faster gain adaptation.
  2654. In other words, the more you increase this value, the more the Dynamic Audio
  2655. Normalizer will behave like a "traditional" normalization filter. On the
  2656. contrary, the more you decrease this value, the more the Dynamic Audio
  2657. Normalizer will behave like a dynamic range compressor.
  2658. @item peak, p
  2659. Set the target peak value. This specifies the highest permissible magnitude
  2660. level for the normalized audio input. This filter will try to approach the
  2661. target peak magnitude as closely as possible, but at the same time it also
  2662. makes sure that the normalized signal will never exceed the peak magnitude.
  2663. A frame's maximum local gain factor is imposed directly by the target peak
  2664. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2665. It is not recommended to go above this value.
  2666. @item maxgain, m
  2667. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2668. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2669. factor for each input frame, i.e. the maximum gain factor that does not
  2670. result in clipping or distortion. The maximum gain factor is determined by
  2671. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2672. additionally bounds the frame's maximum gain factor by a predetermined
  2673. (global) maximum gain factor. This is done in order to avoid excessive gain
  2674. factors in "silent" or almost silent frames. By default, the maximum gain
  2675. factor is 10.0, For most inputs the default value should be sufficient and
  2676. it usually is not recommended to increase this value. Though, for input
  2677. with an extremely low overall volume level, it may be necessary to allow even
  2678. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2679. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2680. Instead, a "sigmoid" threshold function will be applied. This way, the
  2681. gain factors will smoothly approach the threshold value, but never exceed that
  2682. value.
  2683. @item targetrms, r
  2684. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2685. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2686. This means that the maximum local gain factor for each frame is defined
  2687. (only) by the frame's highest magnitude sample. This way, the samples can
  2688. be amplified as much as possible without exceeding the maximum signal
  2689. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2690. Normalizer can also take into account the frame's root mean square,
  2691. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2692. determine the power of a time-varying signal. It is therefore considered
  2693. that the RMS is a better approximation of the "perceived loudness" than
  2694. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2695. frames to a constant RMS value, a uniform "perceived loudness" can be
  2696. established. If a target RMS value has been specified, a frame's local gain
  2697. factor is defined as the factor that would result in exactly that RMS value.
  2698. Note, however, that the maximum local gain factor is still restricted by the
  2699. frame's highest magnitude sample, in order to prevent clipping.
  2700. @item coupling, n
  2701. Enable channels coupling. By default is enabled.
  2702. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2703. amount. This means the same gain factor will be applied to all channels, i.e.
  2704. the maximum possible gain factor is determined by the "loudest" channel.
  2705. However, in some recordings, it may happen that the volume of the different
  2706. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2707. In this case, this option can be used to disable the channel coupling. This way,
  2708. the gain factor will be determined independently for each channel, depending
  2709. only on the individual channel's highest magnitude sample. This allows for
  2710. harmonizing the volume of the different channels.
  2711. @item correctdc, c
  2712. Enable DC bias correction. By default is disabled.
  2713. An audio signal (in the time domain) is a sequence of sample values.
  2714. In the Dynamic Audio Normalizer these sample values are represented in the
  2715. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2716. audio signal, or "waveform", should be centered around the zero point.
  2717. That means if we calculate the mean value of all samples in a file, or in a
  2718. single frame, then the result should be 0.0 or at least very close to that
  2719. value. If, however, there is a significant deviation of the mean value from
  2720. 0.0, in either positive or negative direction, this is referred to as a
  2721. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2722. Audio Normalizer provides optional DC bias correction.
  2723. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2724. the mean value, or "DC correction" offset, of each input frame and subtract
  2725. that value from all of the frame's sample values which ensures those samples
  2726. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2727. boundaries, the DC correction offset values will be interpolated smoothly
  2728. between neighbouring frames.
  2729. @item altboundary, b
  2730. Enable alternative boundary mode. By default is disabled.
  2731. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2732. around each frame. This includes the preceding frames as well as the
  2733. subsequent frames. However, for the "boundary" frames, located at the very
  2734. beginning and at the very end of the audio file, not all neighbouring
  2735. frames are available. In particular, for the first few frames in the audio
  2736. file, the preceding frames are not known. And, similarly, for the last few
  2737. frames in the audio file, the subsequent frames are not known. Thus, the
  2738. question arises which gain factors should be assumed for the missing frames
  2739. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2740. to deal with this situation. The default boundary mode assumes a gain factor
  2741. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2742. "fade out" at the beginning and at the end of the input, respectively.
  2743. @item compress, s
  2744. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2745. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2746. compression. This means that signal peaks will not be pruned and thus the
  2747. full dynamic range will be retained within each local neighbourhood. However,
  2748. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2749. normalization algorithm with a more "traditional" compression.
  2750. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2751. (thresholding) function. If (and only if) the compression feature is enabled,
  2752. all input frames will be processed by a soft knee thresholding function prior
  2753. to the actual normalization process. Put simply, the thresholding function is
  2754. going to prune all samples whose magnitude exceeds a certain threshold value.
  2755. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2756. value. Instead, the threshold value will be adjusted for each individual
  2757. frame.
  2758. In general, smaller parameters result in stronger compression, and vice versa.
  2759. Values below 3.0 are not recommended, because audible distortion may appear.
  2760. @item threshold, t
  2761. Set the target threshold value. This specifies the lowest permissible
  2762. magnitude level for the audio input which will be normalized.
  2763. If input frame volume is above this value frame will be normalized.
  2764. Otherwise frame may not be normalized at all. The default value is set
  2765. to 0, which means all input frames will be normalized.
  2766. This option is mostly useful if digital noise is not wanted to be amplified.
  2767. @end table
  2768. @subsection Commands
  2769. This filter supports the all above options as @ref{commands}.
  2770. @section earwax
  2771. Make audio easier to listen to on headphones.
  2772. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2773. so that when listened to on headphones the stereo image is moved from
  2774. inside your head (standard for headphones) to outside and in front of
  2775. the listener (standard for speakers).
  2776. Ported from SoX.
  2777. @section equalizer
  2778. Apply a two-pole peaking equalisation (EQ) filter. With this
  2779. filter, the signal-level at and around a selected frequency can
  2780. be increased or decreased, whilst (unlike bandpass and bandreject
  2781. filters) that at all other frequencies is unchanged.
  2782. In order to produce complex equalisation curves, this filter can
  2783. be given several times, each with a different central frequency.
  2784. The filter accepts the following options:
  2785. @table @option
  2786. @item frequency, f
  2787. Set the filter's central frequency in Hz.
  2788. @item width_type, t
  2789. Set method to specify band-width of filter.
  2790. @table @option
  2791. @item h
  2792. Hz
  2793. @item q
  2794. Q-Factor
  2795. @item o
  2796. octave
  2797. @item s
  2798. slope
  2799. @item k
  2800. kHz
  2801. @end table
  2802. @item width, w
  2803. Specify the band-width of a filter in width_type units.
  2804. @item gain, g
  2805. Set the required gain or attenuation in dB.
  2806. Beware of clipping when using a positive gain.
  2807. @item mix, m
  2808. How much to use filtered signal in output. Default is 1.
  2809. Range is between 0 and 1.
  2810. @item channels, c
  2811. Specify which channels to filter, by default all available are filtered.
  2812. @item normalize, n
  2813. Normalize biquad coefficients, by default is disabled.
  2814. Enabling it will normalize magnitude response at DC to 0dB.
  2815. @item transform, a
  2816. Set transform type of IIR filter.
  2817. @table @option
  2818. @item di
  2819. @item dii
  2820. @item tdii
  2821. @end table
  2822. @end table
  2823. @subsection Examples
  2824. @itemize
  2825. @item
  2826. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2827. @example
  2828. equalizer=f=1000:t=h:width=200:g=-10
  2829. @end example
  2830. @item
  2831. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2832. @example
  2833. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2834. @end example
  2835. @end itemize
  2836. @subsection Commands
  2837. This filter supports the following commands:
  2838. @table @option
  2839. @item frequency, f
  2840. Change equalizer frequency.
  2841. Syntax for the command is : "@var{frequency}"
  2842. @item width_type, t
  2843. Change equalizer width_type.
  2844. Syntax for the command is : "@var{width_type}"
  2845. @item width, w
  2846. Change equalizer width.
  2847. Syntax for the command is : "@var{width}"
  2848. @item gain, g
  2849. Change equalizer gain.
  2850. Syntax for the command is : "@var{gain}"
  2851. @item mix, m
  2852. Change equalizer mix.
  2853. Syntax for the command is : "@var{mix}"
  2854. @end table
  2855. @section extrastereo
  2856. Linearly increases the difference between left and right channels which
  2857. adds some sort of "live" effect to playback.
  2858. The filter accepts the following options:
  2859. @table @option
  2860. @item m
  2861. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2862. (average of both channels), with 1.0 sound will be unchanged, with
  2863. -1.0 left and right channels will be swapped.
  2864. @item c
  2865. Enable clipping. By default is enabled.
  2866. @end table
  2867. @subsection Commands
  2868. This filter supports the all above options as @ref{commands}.
  2869. @section firequalizer
  2870. Apply FIR Equalization using arbitrary frequency response.
  2871. The filter accepts the following option:
  2872. @table @option
  2873. @item gain
  2874. Set gain curve equation (in dB). The expression can contain variables:
  2875. @table @option
  2876. @item f
  2877. the evaluated frequency
  2878. @item sr
  2879. sample rate
  2880. @item ch
  2881. channel number, set to 0 when multichannels evaluation is disabled
  2882. @item chid
  2883. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2884. multichannels evaluation is disabled
  2885. @item chs
  2886. number of channels
  2887. @item chlayout
  2888. channel_layout, see libavutil/channel_layout.h
  2889. @end table
  2890. and functions:
  2891. @table @option
  2892. @item gain_interpolate(f)
  2893. interpolate gain on frequency f based on gain_entry
  2894. @item cubic_interpolate(f)
  2895. same as gain_interpolate, but smoother
  2896. @end table
  2897. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2898. @item gain_entry
  2899. Set gain entry for gain_interpolate function. The expression can
  2900. contain functions:
  2901. @table @option
  2902. @item entry(f, g)
  2903. store gain entry at frequency f with value g
  2904. @end table
  2905. This option is also available as command.
  2906. @item delay
  2907. Set filter delay in seconds. Higher value means more accurate.
  2908. Default is @code{0.01}.
  2909. @item accuracy
  2910. Set filter accuracy in Hz. Lower value means more accurate.
  2911. Default is @code{5}.
  2912. @item wfunc
  2913. Set window function. Acceptable values are:
  2914. @table @option
  2915. @item rectangular
  2916. rectangular window, useful when gain curve is already smooth
  2917. @item hann
  2918. hann window (default)
  2919. @item hamming
  2920. hamming window
  2921. @item blackman
  2922. blackman window
  2923. @item nuttall3
  2924. 3-terms continuous 1st derivative nuttall window
  2925. @item mnuttall3
  2926. minimum 3-terms discontinuous nuttall window
  2927. @item nuttall
  2928. 4-terms continuous 1st derivative nuttall window
  2929. @item bnuttall
  2930. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2931. @item bharris
  2932. blackman-harris window
  2933. @item tukey
  2934. tukey window
  2935. @end table
  2936. @item fixed
  2937. If enabled, use fixed number of audio samples. This improves speed when
  2938. filtering with large delay. Default is disabled.
  2939. @item multi
  2940. Enable multichannels evaluation on gain. Default is disabled.
  2941. @item zero_phase
  2942. Enable zero phase mode by subtracting timestamp to compensate delay.
  2943. Default is disabled.
  2944. @item scale
  2945. Set scale used by gain. Acceptable values are:
  2946. @table @option
  2947. @item linlin
  2948. linear frequency, linear gain
  2949. @item linlog
  2950. linear frequency, logarithmic (in dB) gain (default)
  2951. @item loglin
  2952. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2953. @item loglog
  2954. logarithmic frequency, logarithmic gain
  2955. @end table
  2956. @item dumpfile
  2957. Set file for dumping, suitable for gnuplot.
  2958. @item dumpscale
  2959. Set scale for dumpfile. Acceptable values are same with scale option.
  2960. Default is linlog.
  2961. @item fft2
  2962. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2963. Default is disabled.
  2964. @item min_phase
  2965. Enable minimum phase impulse response. Default is disabled.
  2966. @end table
  2967. @subsection Examples
  2968. @itemize
  2969. @item
  2970. lowpass at 1000 Hz:
  2971. @example
  2972. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2973. @end example
  2974. @item
  2975. lowpass at 1000 Hz with gain_entry:
  2976. @example
  2977. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2978. @end example
  2979. @item
  2980. custom equalization:
  2981. @example
  2982. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2983. @end example
  2984. @item
  2985. higher delay with zero phase to compensate delay:
  2986. @example
  2987. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2988. @end example
  2989. @item
  2990. lowpass on left channel, highpass on right channel:
  2991. @example
  2992. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2993. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2994. @end example
  2995. @end itemize
  2996. @section flanger
  2997. Apply a flanging effect to the audio.
  2998. The filter accepts the following options:
  2999. @table @option
  3000. @item delay
  3001. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3002. @item depth
  3003. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3004. @item regen
  3005. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3006. Default value is 0.
  3007. @item width
  3008. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3009. Default value is 71.
  3010. @item speed
  3011. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3012. @item shape
  3013. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3014. Default value is @var{sinusoidal}.
  3015. @item phase
  3016. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3017. Default value is 25.
  3018. @item interp
  3019. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3020. Default is @var{linear}.
  3021. @end table
  3022. @section haas
  3023. Apply Haas effect to audio.
  3024. Note that this makes most sense to apply on mono signals.
  3025. With this filter applied to mono signals it give some directionality and
  3026. stretches its stereo image.
  3027. The filter accepts the following options:
  3028. @table @option
  3029. @item level_in
  3030. Set input level. By default is @var{1}, or 0dB
  3031. @item level_out
  3032. Set output level. By default is @var{1}, or 0dB.
  3033. @item side_gain
  3034. Set gain applied to side part of signal. By default is @var{1}.
  3035. @item middle_source
  3036. Set kind of middle source. Can be one of the following:
  3037. @table @samp
  3038. @item left
  3039. Pick left channel.
  3040. @item right
  3041. Pick right channel.
  3042. @item mid
  3043. Pick middle part signal of stereo image.
  3044. @item side
  3045. Pick side part signal of stereo image.
  3046. @end table
  3047. @item middle_phase
  3048. Change middle phase. By default is disabled.
  3049. @item left_delay
  3050. Set left channel delay. By default is @var{2.05} milliseconds.
  3051. @item left_balance
  3052. Set left channel balance. By default is @var{-1}.
  3053. @item left_gain
  3054. Set left channel gain. By default is @var{1}.
  3055. @item left_phase
  3056. Change left phase. By default is disabled.
  3057. @item right_delay
  3058. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3059. @item right_balance
  3060. Set right channel balance. By default is @var{1}.
  3061. @item right_gain
  3062. Set right channel gain. By default is @var{1}.
  3063. @item right_phase
  3064. Change right phase. By default is enabled.
  3065. @end table
  3066. @section hdcd
  3067. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3068. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3069. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3070. of HDCD, and detects the Transient Filter flag.
  3071. @example
  3072. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3073. @end example
  3074. When using the filter with wav, note the default encoding for wav is 16-bit,
  3075. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3076. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3077. @example
  3078. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3079. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3080. @end example
  3081. The filter accepts the following options:
  3082. @table @option
  3083. @item disable_autoconvert
  3084. Disable any automatic format conversion or resampling in the filter graph.
  3085. @item process_stereo
  3086. Process the stereo channels together. If target_gain does not match between
  3087. channels, consider it invalid and use the last valid target_gain.
  3088. @item cdt_ms
  3089. Set the code detect timer period in ms.
  3090. @item force_pe
  3091. Always extend peaks above -3dBFS even if PE isn't signaled.
  3092. @item analyze_mode
  3093. Replace audio with a solid tone and adjust the amplitude to signal some
  3094. specific aspect of the decoding process. The output file can be loaded in
  3095. an audio editor alongside the original to aid analysis.
  3096. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3097. Modes are:
  3098. @table @samp
  3099. @item 0, off
  3100. Disabled
  3101. @item 1, lle
  3102. Gain adjustment level at each sample
  3103. @item 2, pe
  3104. Samples where peak extend occurs
  3105. @item 3, cdt
  3106. Samples where the code detect timer is active
  3107. @item 4, tgm
  3108. Samples where the target gain does not match between channels
  3109. @end table
  3110. @end table
  3111. @section headphone
  3112. Apply head-related transfer functions (HRTFs) to create virtual
  3113. loudspeakers around the user for binaural listening via headphones.
  3114. The HRIRs are provided via additional streams, for each channel
  3115. one stereo input stream is needed.
  3116. The filter accepts the following options:
  3117. @table @option
  3118. @item map
  3119. Set mapping of input streams for convolution.
  3120. The argument is a '|'-separated list of channel names in order as they
  3121. are given as additional stream inputs for filter.
  3122. This also specify number of input streams. Number of input streams
  3123. must be not less than number of channels in first stream plus one.
  3124. @item gain
  3125. Set gain applied to audio. Value is in dB. Default is 0.
  3126. @item type
  3127. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3128. processing audio in time domain which is slow.
  3129. @var{freq} is processing audio in frequency domain which is fast.
  3130. Default is @var{freq}.
  3131. @item lfe
  3132. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3133. @item size
  3134. Set size of frame in number of samples which will be processed at once.
  3135. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3136. @item hrir
  3137. Set format of hrir stream.
  3138. Default value is @var{stereo}. Alternative value is @var{multich}.
  3139. If value is set to @var{stereo}, number of additional streams should
  3140. be greater or equal to number of input channels in first input stream.
  3141. Also each additional stream should have stereo number of channels.
  3142. If value is set to @var{multich}, number of additional streams should
  3143. be exactly one. Also number of input channels of additional stream
  3144. should be equal or greater than twice number of channels of first input
  3145. stream.
  3146. @end table
  3147. @subsection Examples
  3148. @itemize
  3149. @item
  3150. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3151. each amovie filter use stereo file with IR coefficients as input.
  3152. The files give coefficients for each position of virtual loudspeaker:
  3153. @example
  3154. ffmpeg -i input.wav
  3155. -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"
  3156. output.wav
  3157. @end example
  3158. @item
  3159. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3160. but now in @var{multich} @var{hrir} format.
  3161. @example
  3162. 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"
  3163. output.wav
  3164. @end example
  3165. @end itemize
  3166. @section highpass
  3167. Apply a high-pass filter with 3dB point frequency.
  3168. The filter can be either single-pole, or double-pole (the default).
  3169. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3170. The filter accepts the following options:
  3171. @table @option
  3172. @item frequency, f
  3173. Set frequency in Hz. Default is 3000.
  3174. @item poles, p
  3175. Set number of poles. Default is 2.
  3176. @item width_type, t
  3177. Set method to specify band-width of filter.
  3178. @table @option
  3179. @item h
  3180. Hz
  3181. @item q
  3182. Q-Factor
  3183. @item o
  3184. octave
  3185. @item s
  3186. slope
  3187. @item k
  3188. kHz
  3189. @end table
  3190. @item width, w
  3191. Specify the band-width of a filter in width_type units.
  3192. Applies only to double-pole filter.
  3193. The default is 0.707q and gives a Butterworth response.
  3194. @item mix, m
  3195. How much to use filtered signal in output. Default is 1.
  3196. Range is between 0 and 1.
  3197. @item channels, c
  3198. Specify which channels to filter, by default all available are filtered.
  3199. @item normalize, n
  3200. Normalize biquad coefficients, by default is disabled.
  3201. Enabling it will normalize magnitude response at DC to 0dB.
  3202. @item transform, a
  3203. Set transform type of IIR filter.
  3204. @table @option
  3205. @item di
  3206. @item dii
  3207. @item tdii
  3208. @end table
  3209. @end table
  3210. @subsection Commands
  3211. This filter supports the following commands:
  3212. @table @option
  3213. @item frequency, f
  3214. Change highpass frequency.
  3215. Syntax for the command is : "@var{frequency}"
  3216. @item width_type, t
  3217. Change highpass width_type.
  3218. Syntax for the command is : "@var{width_type}"
  3219. @item width, w
  3220. Change highpass width.
  3221. Syntax for the command is : "@var{width}"
  3222. @item mix, m
  3223. Change highpass mix.
  3224. Syntax for the command is : "@var{mix}"
  3225. @end table
  3226. @section join
  3227. Join multiple input streams into one multi-channel stream.
  3228. It accepts the following parameters:
  3229. @table @option
  3230. @item inputs
  3231. The number of input streams. It defaults to 2.
  3232. @item channel_layout
  3233. The desired output channel layout. It defaults to stereo.
  3234. @item map
  3235. Map channels from inputs to output. The argument is a '|'-separated list of
  3236. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3237. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3238. can be either the name of the input channel (e.g. FL for front left) or its
  3239. index in the specified input stream. @var{out_channel} is the name of the output
  3240. channel.
  3241. @end table
  3242. The filter will attempt to guess the mappings when they are not specified
  3243. explicitly. It does so by first trying to find an unused matching input channel
  3244. and if that fails it picks the first unused input channel.
  3245. Join 3 inputs (with properly set channel layouts):
  3246. @example
  3247. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3248. @end example
  3249. Build a 5.1 output from 6 single-channel streams:
  3250. @example
  3251. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3252. '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'
  3253. out
  3254. @end example
  3255. @section ladspa
  3256. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3257. To enable compilation of this filter you need to configure FFmpeg with
  3258. @code{--enable-ladspa}.
  3259. @table @option
  3260. @item file, f
  3261. Specifies the name of LADSPA plugin library to load. If the environment
  3262. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3263. each one of the directories specified by the colon separated list in
  3264. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3265. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3266. @file{/usr/lib/ladspa/}.
  3267. @item plugin, p
  3268. Specifies the plugin within the library. Some libraries contain only
  3269. one plugin, but others contain many of them. If this is not set filter
  3270. will list all available plugins within the specified library.
  3271. @item controls, c
  3272. Set the '|' separated list of controls which are zero or more floating point
  3273. values that determine the behavior of the loaded plugin (for example delay,
  3274. threshold or gain).
  3275. Controls need to be defined using the following syntax:
  3276. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3277. @var{valuei} is the value set on the @var{i}-th control.
  3278. Alternatively they can be also defined using the following syntax:
  3279. @var{value0}|@var{value1}|@var{value2}|..., where
  3280. @var{valuei} is the value set on the @var{i}-th control.
  3281. If @option{controls} is set to @code{help}, all available controls and
  3282. their valid ranges are printed.
  3283. @item sample_rate, s
  3284. Specify the sample rate, default to 44100. Only used if plugin have
  3285. zero inputs.
  3286. @item nb_samples, n
  3287. Set the number of samples per channel per each output frame, default
  3288. is 1024. Only used if plugin have zero inputs.
  3289. @item duration, d
  3290. Set the minimum duration of the sourced audio. See
  3291. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3292. for the accepted syntax.
  3293. Note that the resulting duration may be greater than the specified duration,
  3294. as the generated audio is always cut at the end of a complete frame.
  3295. If not specified, or the expressed duration is negative, the audio is
  3296. supposed to be generated forever.
  3297. Only used if plugin have zero inputs.
  3298. @item latency, l
  3299. Enable latency compensation, by default is disabled.
  3300. Only used if plugin have inputs.
  3301. @end table
  3302. @subsection Examples
  3303. @itemize
  3304. @item
  3305. List all available plugins within amp (LADSPA example plugin) library:
  3306. @example
  3307. ladspa=file=amp
  3308. @end example
  3309. @item
  3310. List all available controls and their valid ranges for @code{vcf_notch}
  3311. plugin from @code{VCF} library:
  3312. @example
  3313. ladspa=f=vcf:p=vcf_notch:c=help
  3314. @end example
  3315. @item
  3316. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3317. plugin library:
  3318. @example
  3319. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3320. @end example
  3321. @item
  3322. Add reverberation to the audio using TAP-plugins
  3323. (Tom's Audio Processing plugins):
  3324. @example
  3325. ladspa=file=tap_reverb:tap_reverb
  3326. @end example
  3327. @item
  3328. Generate white noise, with 0.2 amplitude:
  3329. @example
  3330. ladspa=file=cmt:noise_source_white:c=c0=.2
  3331. @end example
  3332. @item
  3333. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3334. @code{C* Audio Plugin Suite} (CAPS) library:
  3335. @example
  3336. ladspa=file=caps:Click:c=c1=20'
  3337. @end example
  3338. @item
  3339. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3340. @example
  3341. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3342. @end example
  3343. @item
  3344. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3345. @code{SWH Plugins} collection:
  3346. @example
  3347. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3348. @end example
  3349. @item
  3350. Attenuate low frequencies using Multiband EQ from Steve Harris
  3351. @code{SWH Plugins} collection:
  3352. @example
  3353. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3354. @end example
  3355. @item
  3356. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3357. (CAPS) library:
  3358. @example
  3359. ladspa=caps:Narrower
  3360. @end example
  3361. @item
  3362. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3363. @example
  3364. ladspa=caps:White:.2
  3365. @end example
  3366. @item
  3367. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3368. @example
  3369. ladspa=caps:Fractal:c=c1=1
  3370. @end example
  3371. @item
  3372. Dynamic volume normalization using @code{VLevel} plugin:
  3373. @example
  3374. ladspa=vlevel-ladspa:vlevel_mono
  3375. @end example
  3376. @end itemize
  3377. @subsection Commands
  3378. This filter supports the following commands:
  3379. @table @option
  3380. @item cN
  3381. Modify the @var{N}-th control value.
  3382. If the specified value is not valid, it is ignored and prior one is kept.
  3383. @end table
  3384. @section loudnorm
  3385. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3386. Support for both single pass (livestreams, files) and double pass (files) modes.
  3387. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3388. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3389. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3390. The filter accepts the following options:
  3391. @table @option
  3392. @item I, i
  3393. Set integrated loudness target.
  3394. Range is -70.0 - -5.0. Default value is -24.0.
  3395. @item LRA, lra
  3396. Set loudness range target.
  3397. Range is 1.0 - 20.0. Default value is 7.0.
  3398. @item TP, tp
  3399. Set maximum true peak.
  3400. Range is -9.0 - +0.0. Default value is -2.0.
  3401. @item measured_I, measured_i
  3402. Measured IL of input file.
  3403. Range is -99.0 - +0.0.
  3404. @item measured_LRA, measured_lra
  3405. Measured LRA of input file.
  3406. Range is 0.0 - 99.0.
  3407. @item measured_TP, measured_tp
  3408. Measured true peak of input file.
  3409. Range is -99.0 - +99.0.
  3410. @item measured_thresh
  3411. Measured threshold of input file.
  3412. Range is -99.0 - +0.0.
  3413. @item offset
  3414. Set offset gain. Gain is applied before the true-peak limiter.
  3415. Range is -99.0 - +99.0. Default is +0.0.
  3416. @item linear
  3417. Normalize by linearly scaling the source audio.
  3418. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3419. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3420. be lower than source LRA and the change in integrated loudness shouldn't
  3421. result in a true peak which exceeds the target TP. If any of these
  3422. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3423. Options are @code{true} or @code{false}. Default is @code{true}.
  3424. @item dual_mono
  3425. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3426. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3427. If set to @code{true}, this option will compensate for this effect.
  3428. Multi-channel input files are not affected by this option.
  3429. Options are true or false. Default is false.
  3430. @item print_format
  3431. Set print format for stats. Options are summary, json, or none.
  3432. Default value is none.
  3433. @end table
  3434. @section lowpass
  3435. Apply a low-pass filter with 3dB point frequency.
  3436. The filter can be either single-pole or double-pole (the default).
  3437. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3438. The filter accepts the following options:
  3439. @table @option
  3440. @item frequency, f
  3441. Set frequency in Hz. Default is 500.
  3442. @item poles, p
  3443. Set number of poles. Default is 2.
  3444. @item width_type, t
  3445. Set method to specify band-width of filter.
  3446. @table @option
  3447. @item h
  3448. Hz
  3449. @item q
  3450. Q-Factor
  3451. @item o
  3452. octave
  3453. @item s
  3454. slope
  3455. @item k
  3456. kHz
  3457. @end table
  3458. @item width, w
  3459. Specify the band-width of a filter in width_type units.
  3460. Applies only to double-pole filter.
  3461. The default is 0.707q and gives a Butterworth response.
  3462. @item mix, m
  3463. How much to use filtered signal in output. Default is 1.
  3464. Range is between 0 and 1.
  3465. @item channels, c
  3466. Specify which channels to filter, by default all available are filtered.
  3467. @item normalize, n
  3468. Normalize biquad coefficients, by default is disabled.
  3469. Enabling it will normalize magnitude response at DC to 0dB.
  3470. @item transform, a
  3471. Set transform type of IIR filter.
  3472. @table @option
  3473. @item di
  3474. @item dii
  3475. @item tdii
  3476. @end table
  3477. @end table
  3478. @subsection Examples
  3479. @itemize
  3480. @item
  3481. Lowpass only LFE channel, it LFE is not present it does nothing:
  3482. @example
  3483. lowpass=c=LFE
  3484. @end example
  3485. @end itemize
  3486. @subsection Commands
  3487. This filter supports the following commands:
  3488. @table @option
  3489. @item frequency, f
  3490. Change lowpass frequency.
  3491. Syntax for the command is : "@var{frequency}"
  3492. @item width_type, t
  3493. Change lowpass width_type.
  3494. Syntax for the command is : "@var{width_type}"
  3495. @item width, w
  3496. Change lowpass width.
  3497. Syntax for the command is : "@var{width}"
  3498. @item mix, m
  3499. Change lowpass mix.
  3500. Syntax for the command is : "@var{mix}"
  3501. @end table
  3502. @section lv2
  3503. Load a LV2 (LADSPA Version 2) plugin.
  3504. To enable compilation of this filter you need to configure FFmpeg with
  3505. @code{--enable-lv2}.
  3506. @table @option
  3507. @item plugin, p
  3508. Specifies the plugin URI. You may need to escape ':'.
  3509. @item controls, c
  3510. Set the '|' separated list of controls which are zero or more floating point
  3511. values that determine the behavior of the loaded plugin (for example delay,
  3512. threshold or gain).
  3513. If @option{controls} is set to @code{help}, all available controls and
  3514. their valid ranges are printed.
  3515. @item sample_rate, s
  3516. Specify the sample rate, default to 44100. Only used if plugin have
  3517. zero inputs.
  3518. @item nb_samples, n
  3519. Set the number of samples per channel per each output frame, default
  3520. is 1024. Only used if plugin have zero inputs.
  3521. @item duration, d
  3522. Set the minimum duration of the sourced audio. See
  3523. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3524. for the accepted syntax.
  3525. Note that the resulting duration may be greater than the specified duration,
  3526. as the generated audio is always cut at the end of a complete frame.
  3527. If not specified, or the expressed duration is negative, the audio is
  3528. supposed to be generated forever.
  3529. Only used if plugin have zero inputs.
  3530. @end table
  3531. @subsection Examples
  3532. @itemize
  3533. @item
  3534. Apply bass enhancer plugin from Calf:
  3535. @example
  3536. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3537. @end example
  3538. @item
  3539. Apply vinyl plugin from Calf:
  3540. @example
  3541. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3542. @end example
  3543. @item
  3544. Apply bit crusher plugin from ArtyFX:
  3545. @example
  3546. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3547. @end example
  3548. @end itemize
  3549. @section mcompand
  3550. Multiband Compress or expand the audio's dynamic range.
  3551. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3552. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3553. response when absent compander action.
  3554. It accepts the following parameters:
  3555. @table @option
  3556. @item args
  3557. This option syntax is:
  3558. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3559. For explanation of each item refer to compand filter documentation.
  3560. @end table
  3561. @anchor{pan}
  3562. @section pan
  3563. Mix channels with specific gain levels. The filter accepts the output
  3564. channel layout followed by a set of channels definitions.
  3565. This filter is also designed to efficiently remap the channels of an audio
  3566. stream.
  3567. The filter accepts parameters of the form:
  3568. "@var{l}|@var{outdef}|@var{outdef}|..."
  3569. @table @option
  3570. @item l
  3571. output channel layout or number of channels
  3572. @item outdef
  3573. output channel specification, of the form:
  3574. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3575. @item out_name
  3576. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3577. number (c0, c1, etc.)
  3578. @item gain
  3579. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3580. @item in_name
  3581. input channel to use, see out_name for details; it is not possible to mix
  3582. named and numbered input channels
  3583. @end table
  3584. If the `=' in a channel specification is replaced by `<', then the gains for
  3585. that specification will be renormalized so that the total is 1, thus
  3586. avoiding clipping noise.
  3587. @subsection Mixing examples
  3588. For example, if you want to down-mix from stereo to mono, but with a bigger
  3589. factor for the left channel:
  3590. @example
  3591. pan=1c|c0=0.9*c0+0.1*c1
  3592. @end example
  3593. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3594. 7-channels surround:
  3595. @example
  3596. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3597. @end example
  3598. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3599. that should be preferred (see "-ac" option) unless you have very specific
  3600. needs.
  3601. @subsection Remapping examples
  3602. The channel remapping will be effective if, and only if:
  3603. @itemize
  3604. @item gain coefficients are zeroes or ones,
  3605. @item only one input per channel output,
  3606. @end itemize
  3607. If all these conditions are satisfied, the filter will notify the user ("Pure
  3608. channel mapping detected"), and use an optimized and lossless method to do the
  3609. remapping.
  3610. For example, if you have a 5.1 source and want a stereo audio stream by
  3611. dropping the extra channels:
  3612. @example
  3613. pan="stereo| c0=FL | c1=FR"
  3614. @end example
  3615. Given the same source, you can also switch front left and front right channels
  3616. and keep the input channel layout:
  3617. @example
  3618. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3619. @end example
  3620. If the input is a stereo audio stream, you can mute the front left channel (and
  3621. still keep the stereo channel layout) with:
  3622. @example
  3623. pan="stereo|c1=c1"
  3624. @end example
  3625. Still with a stereo audio stream input, you can copy the right channel in both
  3626. front left and right:
  3627. @example
  3628. pan="stereo| c0=FR | c1=FR"
  3629. @end example
  3630. @section replaygain
  3631. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3632. outputs it unchanged.
  3633. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3634. @section resample
  3635. Convert the audio sample format, sample rate and channel layout. It is
  3636. not meant to be used directly.
  3637. @section rubberband
  3638. Apply time-stretching and pitch-shifting with librubberband.
  3639. To enable compilation of this filter, you need to configure FFmpeg with
  3640. @code{--enable-librubberband}.
  3641. The filter accepts the following options:
  3642. @table @option
  3643. @item tempo
  3644. Set tempo scale factor.
  3645. @item pitch
  3646. Set pitch scale factor.
  3647. @item transients
  3648. Set transients detector.
  3649. Possible values are:
  3650. @table @var
  3651. @item crisp
  3652. @item mixed
  3653. @item smooth
  3654. @end table
  3655. @item detector
  3656. Set detector.
  3657. Possible values are:
  3658. @table @var
  3659. @item compound
  3660. @item percussive
  3661. @item soft
  3662. @end table
  3663. @item phase
  3664. Set phase.
  3665. Possible values are:
  3666. @table @var
  3667. @item laminar
  3668. @item independent
  3669. @end table
  3670. @item window
  3671. Set processing window size.
  3672. Possible values are:
  3673. @table @var
  3674. @item standard
  3675. @item short
  3676. @item long
  3677. @end table
  3678. @item smoothing
  3679. Set smoothing.
  3680. Possible values are:
  3681. @table @var
  3682. @item off
  3683. @item on
  3684. @end table
  3685. @item formant
  3686. Enable formant preservation when shift pitching.
  3687. Possible values are:
  3688. @table @var
  3689. @item shifted
  3690. @item preserved
  3691. @end table
  3692. @item pitchq
  3693. Set pitch quality.
  3694. Possible values are:
  3695. @table @var
  3696. @item quality
  3697. @item speed
  3698. @item consistency
  3699. @end table
  3700. @item channels
  3701. Set channels.
  3702. Possible values are:
  3703. @table @var
  3704. @item apart
  3705. @item together
  3706. @end table
  3707. @end table
  3708. @subsection Commands
  3709. This filter supports the following commands:
  3710. @table @option
  3711. @item tempo
  3712. Change filter tempo scale factor.
  3713. Syntax for the command is : "@var{tempo}"
  3714. @item pitch
  3715. Change filter pitch scale factor.
  3716. Syntax for the command is : "@var{pitch}"
  3717. @end table
  3718. @section sidechaincompress
  3719. This filter acts like normal compressor but has the ability to compress
  3720. detected signal using second input signal.
  3721. It needs two input streams and returns one output stream.
  3722. First input stream will be processed depending on second stream signal.
  3723. The filtered signal then can be filtered with other filters in later stages of
  3724. processing. See @ref{pan} and @ref{amerge} filter.
  3725. The filter accepts the following options:
  3726. @table @option
  3727. @item level_in
  3728. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3729. @item mode
  3730. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3731. Default is @code{downward}.
  3732. @item threshold
  3733. If a signal of second stream raises above this level it will affect the gain
  3734. reduction of first stream.
  3735. By default is 0.125. Range is between 0.00097563 and 1.
  3736. @item ratio
  3737. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3738. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3739. Default is 2. Range is between 1 and 20.
  3740. @item attack
  3741. Amount of milliseconds the signal has to rise above the threshold before gain
  3742. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3743. @item release
  3744. Amount of milliseconds the signal has to fall below the threshold before
  3745. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3746. @item makeup
  3747. Set the amount by how much signal will be amplified after processing.
  3748. Default is 1. Range is from 1 to 64.
  3749. @item knee
  3750. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3751. Default is 2.82843. Range is between 1 and 8.
  3752. @item link
  3753. Choose if the @code{average} level between all channels of side-chain stream
  3754. or the louder(@code{maximum}) channel of side-chain stream affects the
  3755. reduction. Default is @code{average}.
  3756. @item detection
  3757. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3758. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3759. @item level_sc
  3760. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3761. @item mix
  3762. How much to use compressed signal in output. Default is 1.
  3763. Range is between 0 and 1.
  3764. @end table
  3765. @subsection Commands
  3766. This filter supports the all above options as @ref{commands}.
  3767. @subsection Examples
  3768. @itemize
  3769. @item
  3770. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3771. depending on the signal of 2nd input and later compressed signal to be
  3772. merged with 2nd input:
  3773. @example
  3774. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3775. @end example
  3776. @end itemize
  3777. @section sidechaingate
  3778. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3779. filter the detected signal before sending it to the gain reduction stage.
  3780. Normally a gate uses the full range signal to detect a level above the
  3781. threshold.
  3782. For example: If you cut all lower frequencies from your sidechain signal
  3783. the gate will decrease the volume of your track only if not enough highs
  3784. appear. With this technique you are able to reduce the resonation of a
  3785. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3786. guitar.
  3787. It needs two input streams and returns one output stream.
  3788. First input stream will be processed depending on second stream signal.
  3789. The filter accepts the following options:
  3790. @table @option
  3791. @item level_in
  3792. Set input level before filtering.
  3793. Default is 1. Allowed range is from 0.015625 to 64.
  3794. @item mode
  3795. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3796. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3797. will be amplified, expanding dynamic range in upward direction.
  3798. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3799. @item range
  3800. Set the level of gain reduction when the signal is below the threshold.
  3801. Default is 0.06125. Allowed range is from 0 to 1.
  3802. Setting this to 0 disables reduction and then filter behaves like expander.
  3803. @item threshold
  3804. If a signal rises above this level the gain reduction is released.
  3805. Default is 0.125. Allowed range is from 0 to 1.
  3806. @item ratio
  3807. Set a ratio about which the signal is reduced.
  3808. Default is 2. Allowed range is from 1 to 9000.
  3809. @item attack
  3810. Amount of milliseconds the signal has to rise above the threshold before gain
  3811. reduction stops.
  3812. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3813. @item release
  3814. Amount of milliseconds the signal has to fall below the threshold before the
  3815. reduction is increased again. Default is 250 milliseconds.
  3816. Allowed range is from 0.01 to 9000.
  3817. @item makeup
  3818. Set amount of amplification of signal after processing.
  3819. Default is 1. Allowed range is from 1 to 64.
  3820. @item knee
  3821. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3822. Default is 2.828427125. Allowed range is from 1 to 8.
  3823. @item detection
  3824. Choose if exact signal should be taken for detection or an RMS like one.
  3825. Default is rms. Can be peak or rms.
  3826. @item link
  3827. Choose if the average level between all channels or the louder channel affects
  3828. the reduction.
  3829. Default is average. Can be average or maximum.
  3830. @item level_sc
  3831. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3832. @end table
  3833. @section silencedetect
  3834. Detect silence in an audio stream.
  3835. This filter logs a message when it detects that the input audio volume is less
  3836. or equal to a noise tolerance value for a duration greater or equal to the
  3837. minimum detected noise duration.
  3838. The printed times and duration are expressed in seconds. The
  3839. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3840. is set on the first frame whose timestamp equals or exceeds the detection
  3841. duration and it contains the timestamp of the first frame of the silence.
  3842. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3843. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3844. keys are set on the first frame after the silence. If @option{mono} is
  3845. enabled, and each channel is evaluated separately, the @code{.X}
  3846. suffixed keys are used, and @code{X} corresponds to the channel number.
  3847. The filter accepts the following options:
  3848. @table @option
  3849. @item noise, n
  3850. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3851. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3852. @item duration, d
  3853. Set silence duration until notification (default is 2 seconds). See
  3854. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3855. for the accepted syntax.
  3856. @item mono, m
  3857. Process each channel separately, instead of combined. By default is disabled.
  3858. @end table
  3859. @subsection Examples
  3860. @itemize
  3861. @item
  3862. Detect 5 seconds of silence with -50dB noise tolerance:
  3863. @example
  3864. silencedetect=n=-50dB:d=5
  3865. @end example
  3866. @item
  3867. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3868. tolerance in @file{silence.mp3}:
  3869. @example
  3870. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3871. @end example
  3872. @end itemize
  3873. @section silenceremove
  3874. Remove silence from the beginning, middle or end of the audio.
  3875. The filter accepts the following options:
  3876. @table @option
  3877. @item start_periods
  3878. This value is used to indicate if audio should be trimmed at beginning of
  3879. the audio. A value of zero indicates no silence should be trimmed from the
  3880. beginning. When specifying a non-zero value, it trims audio up until it
  3881. finds non-silence. Normally, when trimming silence from beginning of audio
  3882. the @var{start_periods} will be @code{1} but it can be increased to higher
  3883. values to trim all audio up to specific count of non-silence periods.
  3884. Default value is @code{0}.
  3885. @item start_duration
  3886. Specify the amount of time that non-silence must be detected before it stops
  3887. trimming audio. By increasing the duration, bursts of noises can be treated
  3888. as silence and trimmed off. Default value is @code{0}.
  3889. @item start_threshold
  3890. This indicates what sample value should be treated as silence. For digital
  3891. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3892. you may wish to increase the value to account for background noise.
  3893. Can be specified in dB (in case "dB" is appended to the specified value)
  3894. or amplitude ratio. Default value is @code{0}.
  3895. @item start_silence
  3896. Specify max duration of silence at beginning that will be kept after
  3897. trimming. Default is 0, which is equal to trimming all samples detected
  3898. as silence.
  3899. @item start_mode
  3900. Specify mode of detection of silence end in start of multi-channel audio.
  3901. Can be @var{any} or @var{all}. Default is @var{any}.
  3902. With @var{any}, any sample that is detected as non-silence will cause
  3903. stopped trimming of silence.
  3904. With @var{all}, only if all channels are detected as non-silence will cause
  3905. stopped trimming of silence.
  3906. @item stop_periods
  3907. Set the count for trimming silence from the end of audio.
  3908. To remove silence from the middle of a file, specify a @var{stop_periods}
  3909. that is negative. This value is then treated as a positive value and is
  3910. used to indicate the effect should restart processing as specified by
  3911. @var{start_periods}, making it suitable for removing periods of silence
  3912. in the middle of the audio.
  3913. Default value is @code{0}.
  3914. @item stop_duration
  3915. Specify a duration of silence that must exist before audio is not copied any
  3916. more. By specifying a higher duration, silence that is wanted can be left in
  3917. the audio.
  3918. Default value is @code{0}.
  3919. @item stop_threshold
  3920. This is the same as @option{start_threshold} but for trimming silence from
  3921. the end of audio.
  3922. Can be specified in dB (in case "dB" is appended to the specified value)
  3923. or amplitude ratio. Default value is @code{0}.
  3924. @item stop_silence
  3925. Specify max duration of silence at end that will be kept after
  3926. trimming. Default is 0, which is equal to trimming all samples detected
  3927. as silence.
  3928. @item stop_mode
  3929. Specify mode of detection of silence start in end of multi-channel audio.
  3930. Can be @var{any} or @var{all}. Default is @var{any}.
  3931. With @var{any}, any sample that is detected as non-silence will cause
  3932. stopped trimming of silence.
  3933. With @var{all}, only if all channels are detected as non-silence will cause
  3934. stopped trimming of silence.
  3935. @item detection
  3936. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3937. and works better with digital silence which is exactly 0.
  3938. Default value is @code{rms}.
  3939. @item window
  3940. Set duration in number of seconds used to calculate size of window in number
  3941. of samples for detecting silence.
  3942. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3943. @end table
  3944. @subsection Examples
  3945. @itemize
  3946. @item
  3947. The following example shows how this filter can be used to start a recording
  3948. that does not contain the delay at the start which usually occurs between
  3949. pressing the record button and the start of the performance:
  3950. @example
  3951. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3952. @end example
  3953. @item
  3954. Trim all silence encountered from beginning to end where there is more than 1
  3955. second of silence in audio:
  3956. @example
  3957. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3958. @end example
  3959. @item
  3960. Trim all digital silence samples, using peak detection, from beginning to end
  3961. where there is more than 0 samples of digital silence in audio and digital
  3962. silence is detected in all channels at same positions in stream:
  3963. @example
  3964. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3965. @end example
  3966. @end itemize
  3967. @section sofalizer
  3968. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3969. loudspeakers around the user for binaural listening via headphones (audio
  3970. formats up to 9 channels supported).
  3971. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3972. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3973. Austrian Academy of Sciences.
  3974. To enable compilation of this filter you need to configure FFmpeg with
  3975. @code{--enable-libmysofa}.
  3976. The filter accepts the following options:
  3977. @table @option
  3978. @item sofa
  3979. Set the SOFA file used for rendering.
  3980. @item gain
  3981. Set gain applied to audio. Value is in dB. Default is 0.
  3982. @item rotation
  3983. Set rotation of virtual loudspeakers in deg. Default is 0.
  3984. @item elevation
  3985. Set elevation of virtual speakers in deg. Default is 0.
  3986. @item radius
  3987. Set distance in meters between loudspeakers and the listener with near-field
  3988. HRTFs. Default is 1.
  3989. @item type
  3990. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3991. processing audio in time domain which is slow.
  3992. @var{freq} is processing audio in frequency domain which is fast.
  3993. Default is @var{freq}.
  3994. @item speakers
  3995. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3996. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3997. Each virtual loudspeaker is described with short channel name following with
  3998. azimuth and elevation in degrees.
  3999. Each virtual loudspeaker description is separated by '|'.
  4000. For example to override front left and front right channel positions use:
  4001. 'speakers=FL 45 15|FR 345 15'.
  4002. Descriptions with unrecognised channel names are ignored.
  4003. @item lfegain
  4004. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4005. @item framesize
  4006. Set custom frame size in number of samples. Default is 1024.
  4007. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4008. is set to @var{freq}.
  4009. @item normalize
  4010. Should all IRs be normalized upon importing SOFA file.
  4011. By default is enabled.
  4012. @item interpolate
  4013. Should nearest IRs be interpolated with neighbor IRs if exact position
  4014. does not match. By default is disabled.
  4015. @item minphase
  4016. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4017. @item anglestep
  4018. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4019. @item radstep
  4020. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4021. @end table
  4022. @subsection Examples
  4023. @itemize
  4024. @item
  4025. Using ClubFritz6 sofa file:
  4026. @example
  4027. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4028. @end example
  4029. @item
  4030. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4031. @example
  4032. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4033. @end example
  4034. @item
  4035. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4036. and also with custom gain:
  4037. @example
  4038. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4039. @end example
  4040. @end itemize
  4041. @section stereotools
  4042. This filter has some handy utilities to manage stereo signals, for converting
  4043. M/S stereo recordings to L/R signal while having control over the parameters
  4044. or spreading the stereo image of master track.
  4045. The filter accepts the following options:
  4046. @table @option
  4047. @item level_in
  4048. Set input level before filtering for both channels. Defaults is 1.
  4049. Allowed range is from 0.015625 to 64.
  4050. @item level_out
  4051. Set output level after filtering for both channels. Defaults is 1.
  4052. Allowed range is from 0.015625 to 64.
  4053. @item balance_in
  4054. Set input balance between both channels. Default is 0.
  4055. Allowed range is from -1 to 1.
  4056. @item balance_out
  4057. Set output balance between both channels. Default is 0.
  4058. Allowed range is from -1 to 1.
  4059. @item softclip
  4060. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4061. clipping. Disabled by default.
  4062. @item mutel
  4063. Mute the left channel. Disabled by default.
  4064. @item muter
  4065. Mute the right channel. Disabled by default.
  4066. @item phasel
  4067. Change the phase of the left channel. Disabled by default.
  4068. @item phaser
  4069. Change the phase of the right channel. Disabled by default.
  4070. @item mode
  4071. Set stereo mode. Available values are:
  4072. @table @samp
  4073. @item lr>lr
  4074. Left/Right to Left/Right, this is default.
  4075. @item lr>ms
  4076. Left/Right to Mid/Side.
  4077. @item ms>lr
  4078. Mid/Side to Left/Right.
  4079. @item lr>ll
  4080. Left/Right to Left/Left.
  4081. @item lr>rr
  4082. Left/Right to Right/Right.
  4083. @item lr>l+r
  4084. Left/Right to Left + Right.
  4085. @item lr>rl
  4086. Left/Right to Right/Left.
  4087. @item ms>ll
  4088. Mid/Side to Left/Left.
  4089. @item ms>rr
  4090. Mid/Side to Right/Right.
  4091. @end table
  4092. @item slev
  4093. Set level of side signal. Default is 1.
  4094. Allowed range is from 0.015625 to 64.
  4095. @item sbal
  4096. Set balance of side signal. Default is 0.
  4097. Allowed range is from -1 to 1.
  4098. @item mlev
  4099. Set level of the middle signal. Default is 1.
  4100. Allowed range is from 0.015625 to 64.
  4101. @item mpan
  4102. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4103. @item base
  4104. Set stereo base between mono and inversed channels. Default is 0.
  4105. Allowed range is from -1 to 1.
  4106. @item delay
  4107. Set delay in milliseconds how much to delay left from right channel and
  4108. vice versa. Default is 0. Allowed range is from -20 to 20.
  4109. @item sclevel
  4110. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4111. @item phase
  4112. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4113. @item bmode_in, bmode_out
  4114. Set balance mode for balance_in/balance_out option.
  4115. Can be one of the following:
  4116. @table @samp
  4117. @item balance
  4118. Classic balance mode. Attenuate one channel at time.
  4119. Gain is raised up to 1.
  4120. @item amplitude
  4121. Similar as classic mode above but gain is raised up to 2.
  4122. @item power
  4123. Equal power distribution, from -6dB to +6dB range.
  4124. @end table
  4125. @end table
  4126. @subsection Examples
  4127. @itemize
  4128. @item
  4129. Apply karaoke like effect:
  4130. @example
  4131. stereotools=mlev=0.015625
  4132. @end example
  4133. @item
  4134. Convert M/S signal to L/R:
  4135. @example
  4136. "stereotools=mode=ms>lr"
  4137. @end example
  4138. @end itemize
  4139. @section stereowiden
  4140. This filter enhance the stereo effect by suppressing signal common to both
  4141. channels and by delaying the signal of left into right and vice versa,
  4142. thereby widening the stereo effect.
  4143. The filter accepts the following options:
  4144. @table @option
  4145. @item delay
  4146. Time in milliseconds of the delay of left signal into right and vice versa.
  4147. Default is 20 milliseconds.
  4148. @item feedback
  4149. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4150. effect of left signal in right output and vice versa which gives widening
  4151. effect. Default is 0.3.
  4152. @item crossfeed
  4153. Cross feed of left into right with inverted phase. This helps in suppressing
  4154. the mono. If the value is 1 it will cancel all the signal common to both
  4155. channels. Default is 0.3.
  4156. @item drymix
  4157. Set level of input signal of original channel. Default is 0.8.
  4158. @end table
  4159. @subsection Commands
  4160. This filter supports the all above options except @code{delay} as @ref{commands}.
  4161. @section superequalizer
  4162. Apply 18 band equalizer.
  4163. The filter accepts the following options:
  4164. @table @option
  4165. @item 1b
  4166. Set 65Hz band gain.
  4167. @item 2b
  4168. Set 92Hz band gain.
  4169. @item 3b
  4170. Set 131Hz band gain.
  4171. @item 4b
  4172. Set 185Hz band gain.
  4173. @item 5b
  4174. Set 262Hz band gain.
  4175. @item 6b
  4176. Set 370Hz band gain.
  4177. @item 7b
  4178. Set 523Hz band gain.
  4179. @item 8b
  4180. Set 740Hz band gain.
  4181. @item 9b
  4182. Set 1047Hz band gain.
  4183. @item 10b
  4184. Set 1480Hz band gain.
  4185. @item 11b
  4186. Set 2093Hz band gain.
  4187. @item 12b
  4188. Set 2960Hz band gain.
  4189. @item 13b
  4190. Set 4186Hz band gain.
  4191. @item 14b
  4192. Set 5920Hz band gain.
  4193. @item 15b
  4194. Set 8372Hz band gain.
  4195. @item 16b
  4196. Set 11840Hz band gain.
  4197. @item 17b
  4198. Set 16744Hz band gain.
  4199. @item 18b
  4200. Set 20000Hz band gain.
  4201. @end table
  4202. @section surround
  4203. Apply audio surround upmix filter.
  4204. This filter allows to produce multichannel output from audio stream.
  4205. The filter accepts the following options:
  4206. @table @option
  4207. @item chl_out
  4208. Set output channel layout. By default, this is @var{5.1}.
  4209. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4210. for the required syntax.
  4211. @item chl_in
  4212. Set input channel layout. By default, this is @var{stereo}.
  4213. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4214. for the required syntax.
  4215. @item level_in
  4216. Set input volume level. By default, this is @var{1}.
  4217. @item level_out
  4218. Set output volume level. By default, this is @var{1}.
  4219. @item lfe
  4220. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4221. @item lfe_low
  4222. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4223. @item lfe_high
  4224. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4225. @item lfe_mode
  4226. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4227. In @var{add} mode, LFE channel is created from input audio and added to output.
  4228. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4229. also all non-LFE output channels are subtracted with output LFE channel.
  4230. @item angle
  4231. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4232. Default is @var{90}.
  4233. @item fc_in
  4234. Set front center input volume. By default, this is @var{1}.
  4235. @item fc_out
  4236. Set front center output volume. By default, this is @var{1}.
  4237. @item fl_in
  4238. Set front left input volume. By default, this is @var{1}.
  4239. @item fl_out
  4240. Set front left output volume. By default, this is @var{1}.
  4241. @item fr_in
  4242. Set front right input volume. By default, this is @var{1}.
  4243. @item fr_out
  4244. Set front right output volume. By default, this is @var{1}.
  4245. @item sl_in
  4246. Set side left input volume. By default, this is @var{1}.
  4247. @item sl_out
  4248. Set side left output volume. By default, this is @var{1}.
  4249. @item sr_in
  4250. Set side right input volume. By default, this is @var{1}.
  4251. @item sr_out
  4252. Set side right output volume. By default, this is @var{1}.
  4253. @item bl_in
  4254. Set back left input volume. By default, this is @var{1}.
  4255. @item bl_out
  4256. Set back left output volume. By default, this is @var{1}.
  4257. @item br_in
  4258. Set back right input volume. By default, this is @var{1}.
  4259. @item br_out
  4260. Set back right output volume. By default, this is @var{1}.
  4261. @item bc_in
  4262. Set back center input volume. By default, this is @var{1}.
  4263. @item bc_out
  4264. Set back center output volume. By default, this is @var{1}.
  4265. @item lfe_in
  4266. Set LFE input volume. By default, this is @var{1}.
  4267. @item lfe_out
  4268. Set LFE output volume. By default, this is @var{1}.
  4269. @item allx
  4270. Set spread usage of stereo image across X axis for all channels.
  4271. @item ally
  4272. Set spread usage of stereo image across Y axis for all channels.
  4273. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4274. Set spread usage of stereo image across X axis for each channel.
  4275. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4276. Set spread usage of stereo image across Y axis for each channel.
  4277. @item win_size
  4278. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4279. @item win_func
  4280. Set window function.
  4281. It accepts the following values:
  4282. @table @samp
  4283. @item rect
  4284. @item bartlett
  4285. @item hann, hanning
  4286. @item hamming
  4287. @item blackman
  4288. @item welch
  4289. @item flattop
  4290. @item bharris
  4291. @item bnuttall
  4292. @item bhann
  4293. @item sine
  4294. @item nuttall
  4295. @item lanczos
  4296. @item gauss
  4297. @item tukey
  4298. @item dolph
  4299. @item cauchy
  4300. @item parzen
  4301. @item poisson
  4302. @item bohman
  4303. @end table
  4304. Default is @code{hann}.
  4305. @item overlap
  4306. Set window overlap. If set to 1, the recommended overlap for selected
  4307. window function will be picked. Default is @code{0.5}.
  4308. @end table
  4309. @section treble, highshelf
  4310. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4311. shelving filter with a response similar to that of a standard
  4312. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4313. The filter accepts the following options:
  4314. @table @option
  4315. @item gain, g
  4316. Give the gain at whichever is the lower of ~22 kHz and the
  4317. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4318. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4319. @item frequency, f
  4320. Set the filter's central frequency and so can be used
  4321. to extend or reduce the frequency range to be boosted or cut.
  4322. The default value is @code{3000} Hz.
  4323. @item width_type, t
  4324. Set method to specify band-width of filter.
  4325. @table @option
  4326. @item h
  4327. Hz
  4328. @item q
  4329. Q-Factor
  4330. @item o
  4331. octave
  4332. @item s
  4333. slope
  4334. @item k
  4335. kHz
  4336. @end table
  4337. @item width, w
  4338. Determine how steep is the filter's shelf transition.
  4339. @item mix, m
  4340. How much to use filtered signal in output. Default is 1.
  4341. Range is between 0 and 1.
  4342. @item channels, c
  4343. Specify which channels to filter, by default all available are filtered.
  4344. @item normalize, n
  4345. Normalize biquad coefficients, by default is disabled.
  4346. Enabling it will normalize magnitude response at DC to 0dB.
  4347. @item transform, a
  4348. Set transform type of IIR filter.
  4349. @table @option
  4350. @item di
  4351. @item dii
  4352. @item tdii
  4353. @end table
  4354. @end table
  4355. @subsection Commands
  4356. This filter supports the following commands:
  4357. @table @option
  4358. @item frequency, f
  4359. Change treble frequency.
  4360. Syntax for the command is : "@var{frequency}"
  4361. @item width_type, t
  4362. Change treble width_type.
  4363. Syntax for the command is : "@var{width_type}"
  4364. @item width, w
  4365. Change treble width.
  4366. Syntax for the command is : "@var{width}"
  4367. @item gain, g
  4368. Change treble gain.
  4369. Syntax for the command is : "@var{gain}"
  4370. @item mix, m
  4371. Change treble mix.
  4372. Syntax for the command is : "@var{mix}"
  4373. @end table
  4374. @section tremolo
  4375. Sinusoidal amplitude modulation.
  4376. The filter accepts the following options:
  4377. @table @option
  4378. @item f
  4379. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4380. (20 Hz or lower) will result in a tremolo effect.
  4381. This filter may also be used as a ring modulator by specifying
  4382. a modulation frequency higher than 20 Hz.
  4383. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4384. @item d
  4385. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4386. Default value is 0.5.
  4387. @end table
  4388. @section vibrato
  4389. Sinusoidal phase modulation.
  4390. The filter accepts the following options:
  4391. @table @option
  4392. @item f
  4393. Modulation frequency in Hertz.
  4394. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4395. @item d
  4396. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4397. Default value is 0.5.
  4398. @end table
  4399. @section volume
  4400. Adjust the input audio volume.
  4401. It accepts the following parameters:
  4402. @table @option
  4403. @item volume
  4404. Set audio volume expression.
  4405. Output values are clipped to the maximum value.
  4406. The output audio volume is given by the relation:
  4407. @example
  4408. @var{output_volume} = @var{volume} * @var{input_volume}
  4409. @end example
  4410. The default value for @var{volume} is "1.0".
  4411. @item precision
  4412. This parameter represents the mathematical precision.
  4413. It determines which input sample formats will be allowed, which affects the
  4414. precision of the volume scaling.
  4415. @table @option
  4416. @item fixed
  4417. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4418. @item float
  4419. 32-bit floating-point; this limits input sample format to FLT. (default)
  4420. @item double
  4421. 64-bit floating-point; this limits input sample format to DBL.
  4422. @end table
  4423. @item replaygain
  4424. Choose the behaviour on encountering ReplayGain side data in input frames.
  4425. @table @option
  4426. @item drop
  4427. Remove ReplayGain side data, ignoring its contents (the default).
  4428. @item ignore
  4429. Ignore ReplayGain side data, but leave it in the frame.
  4430. @item track
  4431. Prefer the track gain, if present.
  4432. @item album
  4433. Prefer the album gain, if present.
  4434. @end table
  4435. @item replaygain_preamp
  4436. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4437. Default value for @var{replaygain_preamp} is 0.0.
  4438. @item replaygain_noclip
  4439. Prevent clipping by limiting the gain applied.
  4440. Default value for @var{replaygain_noclip} is 1.
  4441. @item eval
  4442. Set when the volume expression is evaluated.
  4443. It accepts the following values:
  4444. @table @samp
  4445. @item once
  4446. only evaluate expression once during the filter initialization, or
  4447. when the @samp{volume} command is sent
  4448. @item frame
  4449. evaluate expression for each incoming frame
  4450. @end table
  4451. Default value is @samp{once}.
  4452. @end table
  4453. The volume expression can contain the following parameters.
  4454. @table @option
  4455. @item n
  4456. frame number (starting at zero)
  4457. @item nb_channels
  4458. number of channels
  4459. @item nb_consumed_samples
  4460. number of samples consumed by the filter
  4461. @item nb_samples
  4462. number of samples in the current frame
  4463. @item pos
  4464. original frame position in the file
  4465. @item pts
  4466. frame PTS
  4467. @item sample_rate
  4468. sample rate
  4469. @item startpts
  4470. PTS at start of stream
  4471. @item startt
  4472. time at start of stream
  4473. @item t
  4474. frame time
  4475. @item tb
  4476. timestamp timebase
  4477. @item volume
  4478. last set volume value
  4479. @end table
  4480. Note that when @option{eval} is set to @samp{once} only the
  4481. @var{sample_rate} and @var{tb} variables are available, all other
  4482. variables will evaluate to NAN.
  4483. @subsection Commands
  4484. This filter supports the following commands:
  4485. @table @option
  4486. @item volume
  4487. Modify the volume expression.
  4488. The command accepts the same syntax of the corresponding option.
  4489. If the specified expression is not valid, it is kept at its current
  4490. value.
  4491. @end table
  4492. @subsection Examples
  4493. @itemize
  4494. @item
  4495. Halve the input audio volume:
  4496. @example
  4497. volume=volume=0.5
  4498. volume=volume=1/2
  4499. volume=volume=-6.0206dB
  4500. @end example
  4501. In all the above example the named key for @option{volume} can be
  4502. omitted, for example like in:
  4503. @example
  4504. volume=0.5
  4505. @end example
  4506. @item
  4507. Increase input audio power by 6 decibels using fixed-point precision:
  4508. @example
  4509. volume=volume=6dB:precision=fixed
  4510. @end example
  4511. @item
  4512. Fade volume after time 10 with an annihilation period of 5 seconds:
  4513. @example
  4514. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4515. @end example
  4516. @end itemize
  4517. @section volumedetect
  4518. Detect the volume of the input video.
  4519. The filter has no parameters. The input is not modified. Statistics about
  4520. the volume will be printed in the log when the input stream end is reached.
  4521. In particular it will show the mean volume (root mean square), maximum
  4522. volume (on a per-sample basis), and the beginning of a histogram of the
  4523. registered volume values (from the maximum value to a cumulated 1/1000 of
  4524. the samples).
  4525. All volumes are in decibels relative to the maximum PCM value.
  4526. @subsection Examples
  4527. Here is an excerpt of the output:
  4528. @example
  4529. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4530. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4531. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4532. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4533. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4534. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4535. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4536. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4537. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4538. @end example
  4539. It means that:
  4540. @itemize
  4541. @item
  4542. The mean square energy is approximately -27 dB, or 10^-2.7.
  4543. @item
  4544. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4545. @item
  4546. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4547. @end itemize
  4548. In other words, raising the volume by +4 dB does not cause any clipping,
  4549. raising it by +5 dB causes clipping for 6 samples, etc.
  4550. @c man end AUDIO FILTERS
  4551. @chapter Audio Sources
  4552. @c man begin AUDIO SOURCES
  4553. Below is a description of the currently available audio sources.
  4554. @section abuffer
  4555. Buffer audio frames, and make them available to the filter chain.
  4556. This source is mainly intended for a programmatic use, in particular
  4557. through the interface defined in @file{libavfilter/buffersrc.h}.
  4558. It accepts the following parameters:
  4559. @table @option
  4560. @item time_base
  4561. The timebase which will be used for timestamps of submitted frames. It must be
  4562. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4563. @item sample_rate
  4564. The sample rate of the incoming audio buffers.
  4565. @item sample_fmt
  4566. The sample format of the incoming audio buffers.
  4567. Either a sample format name or its corresponding integer representation from
  4568. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4569. @item channel_layout
  4570. The channel layout of the incoming audio buffers.
  4571. Either a channel layout name from channel_layout_map in
  4572. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4573. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4574. @item channels
  4575. The number of channels of the incoming audio buffers.
  4576. If both @var{channels} and @var{channel_layout} are specified, then they
  4577. must be consistent.
  4578. @end table
  4579. @subsection Examples
  4580. @example
  4581. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4582. @end example
  4583. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4584. Since the sample format with name "s16p" corresponds to the number
  4585. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4586. equivalent to:
  4587. @example
  4588. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4589. @end example
  4590. @section aevalsrc
  4591. Generate an audio signal specified by an expression.
  4592. This source accepts in input one or more expressions (one for each
  4593. channel), which are evaluated and used to generate a corresponding
  4594. audio signal.
  4595. This source accepts the following options:
  4596. @table @option
  4597. @item exprs
  4598. Set the '|'-separated expressions list for each separate channel. In case the
  4599. @option{channel_layout} option is not specified, the selected channel layout
  4600. depends on the number of provided expressions. Otherwise the last
  4601. specified expression is applied to the remaining output channels.
  4602. @item channel_layout, c
  4603. Set the channel layout. The number of channels in the specified layout
  4604. must be equal to the number of specified expressions.
  4605. @item duration, d
  4606. Set the minimum duration of the sourced audio. See
  4607. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4608. for the accepted syntax.
  4609. Note that the resulting duration may be greater than the specified
  4610. duration, as the generated audio is always cut at the end of a
  4611. complete frame.
  4612. If not specified, or the expressed duration is negative, the audio is
  4613. supposed to be generated forever.
  4614. @item nb_samples, n
  4615. Set the number of samples per channel per each output frame,
  4616. default to 1024.
  4617. @item sample_rate, s
  4618. Specify the sample rate, default to 44100.
  4619. @end table
  4620. Each expression in @var{exprs} can contain the following constants:
  4621. @table @option
  4622. @item n
  4623. number of the evaluated sample, starting from 0
  4624. @item t
  4625. time of the evaluated sample expressed in seconds, starting from 0
  4626. @item s
  4627. sample rate
  4628. @end table
  4629. @subsection Examples
  4630. @itemize
  4631. @item
  4632. Generate silence:
  4633. @example
  4634. aevalsrc=0
  4635. @end example
  4636. @item
  4637. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4638. 8000 Hz:
  4639. @example
  4640. aevalsrc="sin(440*2*PI*t):s=8000"
  4641. @end example
  4642. @item
  4643. Generate a two channels signal, specify the channel layout (Front
  4644. Center + Back Center) explicitly:
  4645. @example
  4646. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4647. @end example
  4648. @item
  4649. Generate white noise:
  4650. @example
  4651. aevalsrc="-2+random(0)"
  4652. @end example
  4653. @item
  4654. Generate an amplitude modulated signal:
  4655. @example
  4656. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4657. @end example
  4658. @item
  4659. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4660. @example
  4661. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4662. @end example
  4663. @end itemize
  4664. @section afirsrc
  4665. Generate a FIR coefficients using frequency sampling method.
  4666. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4667. The filter accepts the following options:
  4668. @table @option
  4669. @item taps, t
  4670. Set number of filter coefficents in output audio stream.
  4671. Default value is 1025.
  4672. @item frequency, f
  4673. Set frequency points from where magnitude and phase are set.
  4674. This must be in non decreasing order, and first element must be 0, while last element
  4675. must be 1. Elements are separated by white spaces.
  4676. @item magnitude, m
  4677. Set magnitude value for every frequency point set by @option{frequency}.
  4678. Number of values must be same as number of frequency points.
  4679. Values are separated by white spaces.
  4680. @item phase, p
  4681. Set phase value for every frequency point set by @option{frequency}.
  4682. Number of values must be same as number of frequency points.
  4683. Values are separated by white spaces.
  4684. @item sample_rate, r
  4685. Set sample rate, default is 44100.
  4686. @item nb_samples, n
  4687. Set number of samples per each frame. Default is 1024.
  4688. @item win_func, w
  4689. Set window function. Default is blackman.
  4690. @end table
  4691. @section anullsrc
  4692. The null audio source, return unprocessed audio frames. It is mainly useful
  4693. as a template and to be employed in analysis / debugging tools, or as
  4694. the source for filters which ignore the input data (for example the sox
  4695. synth filter).
  4696. This source accepts the following options:
  4697. @table @option
  4698. @item channel_layout, cl
  4699. Specifies the channel layout, and can be either an integer or a string
  4700. representing a channel layout. The default value of @var{channel_layout}
  4701. is "stereo".
  4702. Check the channel_layout_map definition in
  4703. @file{libavutil/channel_layout.c} for the mapping between strings and
  4704. channel layout values.
  4705. @item sample_rate, r
  4706. Specifies the sample rate, and defaults to 44100.
  4707. @item nb_samples, n
  4708. Set the number of samples per requested frames.
  4709. @item duration, d
  4710. Set the duration of the sourced audio. See
  4711. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4712. for the accepted syntax.
  4713. If not specified, or the expressed duration is negative, the audio is
  4714. supposed to be generated forever.
  4715. @end table
  4716. @subsection Examples
  4717. @itemize
  4718. @item
  4719. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4720. @example
  4721. anullsrc=r=48000:cl=4
  4722. @end example
  4723. @item
  4724. Do the same operation with a more obvious syntax:
  4725. @example
  4726. anullsrc=r=48000:cl=mono
  4727. @end example
  4728. @end itemize
  4729. All the parameters need to be explicitly defined.
  4730. @section flite
  4731. Synthesize a voice utterance using the libflite library.
  4732. To enable compilation of this filter you need to configure FFmpeg with
  4733. @code{--enable-libflite}.
  4734. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4735. The filter accepts the following options:
  4736. @table @option
  4737. @item list_voices
  4738. If set to 1, list the names of the available voices and exit
  4739. immediately. Default value is 0.
  4740. @item nb_samples, n
  4741. Set the maximum number of samples per frame. Default value is 512.
  4742. @item textfile
  4743. Set the filename containing the text to speak.
  4744. @item text
  4745. Set the text to speak.
  4746. @item voice, v
  4747. Set the voice to use for the speech synthesis. Default value is
  4748. @code{kal}. See also the @var{list_voices} option.
  4749. @end table
  4750. @subsection Examples
  4751. @itemize
  4752. @item
  4753. Read from file @file{speech.txt}, and synthesize the text using the
  4754. standard flite voice:
  4755. @example
  4756. flite=textfile=speech.txt
  4757. @end example
  4758. @item
  4759. Read the specified text selecting the @code{slt} voice:
  4760. @example
  4761. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4762. @end example
  4763. @item
  4764. Input text to ffmpeg:
  4765. @example
  4766. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4767. @end example
  4768. @item
  4769. Make @file{ffplay} speak the specified text, using @code{flite} and
  4770. the @code{lavfi} device:
  4771. @example
  4772. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4773. @end example
  4774. @end itemize
  4775. For more information about libflite, check:
  4776. @url{http://www.festvox.org/flite/}
  4777. @section anoisesrc
  4778. Generate a noise audio signal.
  4779. The filter accepts the following options:
  4780. @table @option
  4781. @item sample_rate, r
  4782. Specify the sample rate. Default value is 48000 Hz.
  4783. @item amplitude, a
  4784. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4785. is 1.0.
  4786. @item duration, d
  4787. Specify the duration of the generated audio stream. Not specifying this option
  4788. results in noise with an infinite length.
  4789. @item color, colour, c
  4790. Specify the color of noise. Available noise colors are white, pink, brown,
  4791. blue, violet and velvet. Default color is white.
  4792. @item seed, s
  4793. Specify a value used to seed the PRNG.
  4794. @item nb_samples, n
  4795. Set the number of samples per each output frame, default is 1024.
  4796. @end table
  4797. @subsection Examples
  4798. @itemize
  4799. @item
  4800. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4801. @example
  4802. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4803. @end example
  4804. @end itemize
  4805. @section hilbert
  4806. Generate odd-tap Hilbert transform FIR coefficients.
  4807. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4808. the signal by 90 degrees.
  4809. This is used in many matrix coding schemes and for analytic signal generation.
  4810. The process is often written as a multiplication by i (or j), the imaginary unit.
  4811. The filter accepts the following options:
  4812. @table @option
  4813. @item sample_rate, s
  4814. Set sample rate, default is 44100.
  4815. @item taps, t
  4816. Set length of FIR filter, default is 22051.
  4817. @item nb_samples, n
  4818. Set number of samples per each frame.
  4819. @item win_func, w
  4820. Set window function to be used when generating FIR coefficients.
  4821. @end table
  4822. @section sinc
  4823. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4824. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4825. The filter accepts the following options:
  4826. @table @option
  4827. @item sample_rate, r
  4828. Set sample rate, default is 44100.
  4829. @item nb_samples, n
  4830. Set number of samples per each frame. Default is 1024.
  4831. @item hp
  4832. Set high-pass frequency. Default is 0.
  4833. @item lp
  4834. Set low-pass frequency. Default is 0.
  4835. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4836. is higher than 0 then filter will create band-pass filter coefficients,
  4837. otherwise band-reject filter coefficients.
  4838. @item phase
  4839. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4840. @item beta
  4841. Set Kaiser window beta.
  4842. @item att
  4843. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4844. @item round
  4845. Enable rounding, by default is disabled.
  4846. @item hptaps
  4847. Set number of taps for high-pass filter.
  4848. @item lptaps
  4849. Set number of taps for low-pass filter.
  4850. @end table
  4851. @section sine
  4852. Generate an audio signal made of a sine wave with amplitude 1/8.
  4853. The audio signal is bit-exact.
  4854. The filter accepts the following options:
  4855. @table @option
  4856. @item frequency, f
  4857. Set the carrier frequency. Default is 440 Hz.
  4858. @item beep_factor, b
  4859. Enable a periodic beep every second with frequency @var{beep_factor} times
  4860. the carrier frequency. Default is 0, meaning the beep is disabled.
  4861. @item sample_rate, r
  4862. Specify the sample rate, default is 44100.
  4863. @item duration, d
  4864. Specify the duration of the generated audio stream.
  4865. @item samples_per_frame
  4866. Set the number of samples per output frame.
  4867. The expression can contain the following constants:
  4868. @table @option
  4869. @item n
  4870. The (sequential) number of the output audio frame, starting from 0.
  4871. @item pts
  4872. The PTS (Presentation TimeStamp) of the output audio frame,
  4873. expressed in @var{TB} units.
  4874. @item t
  4875. The PTS of the output audio frame, expressed in seconds.
  4876. @item TB
  4877. The timebase of the output audio frames.
  4878. @end table
  4879. Default is @code{1024}.
  4880. @end table
  4881. @subsection Examples
  4882. @itemize
  4883. @item
  4884. Generate a simple 440 Hz sine wave:
  4885. @example
  4886. sine
  4887. @end example
  4888. @item
  4889. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4890. @example
  4891. sine=220:4:d=5
  4892. sine=f=220:b=4:d=5
  4893. sine=frequency=220:beep_factor=4:duration=5
  4894. @end example
  4895. @item
  4896. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4897. pattern:
  4898. @example
  4899. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4900. @end example
  4901. @end itemize
  4902. @c man end AUDIO SOURCES
  4903. @chapter Audio Sinks
  4904. @c man begin AUDIO SINKS
  4905. Below is a description of the currently available audio sinks.
  4906. @section abuffersink
  4907. Buffer audio frames, and make them available to the end of filter chain.
  4908. This sink is mainly intended for programmatic use, in particular
  4909. through the interface defined in @file{libavfilter/buffersink.h}
  4910. or the options system.
  4911. It accepts a pointer to an AVABufferSinkContext structure, which
  4912. defines the incoming buffers' formats, to be passed as the opaque
  4913. parameter to @code{avfilter_init_filter} for initialization.
  4914. @section anullsink
  4915. Null audio sink; do absolutely nothing with the input audio. It is
  4916. mainly useful as a template and for use in analysis / debugging
  4917. tools.
  4918. @c man end AUDIO SINKS
  4919. @chapter Video Filters
  4920. @c man begin VIDEO FILTERS
  4921. When you configure your FFmpeg build, you can disable any of the
  4922. existing filters using @code{--disable-filters}.
  4923. The configure output will show the video filters included in your
  4924. build.
  4925. Below is a description of the currently available video filters.
  4926. @section addroi
  4927. Mark a region of interest in a video frame.
  4928. The frame data is passed through unchanged, but metadata is attached
  4929. to the frame indicating regions of interest which can affect the
  4930. behaviour of later encoding. Multiple regions can be marked by
  4931. applying the filter multiple times.
  4932. @table @option
  4933. @item x
  4934. Region distance in pixels from the left edge of the frame.
  4935. @item y
  4936. Region distance in pixels from the top edge of the frame.
  4937. @item w
  4938. Region width in pixels.
  4939. @item h
  4940. Region height in pixels.
  4941. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4942. and may contain the following variables:
  4943. @table @option
  4944. @item iw
  4945. Width of the input frame.
  4946. @item ih
  4947. Height of the input frame.
  4948. @end table
  4949. @item qoffset
  4950. Quantisation offset to apply within the region.
  4951. This must be a real value in the range -1 to +1. A value of zero
  4952. indicates no quality change. A negative value asks for better quality
  4953. (less quantisation), while a positive value asks for worse quality
  4954. (greater quantisation).
  4955. The range is calibrated so that the extreme values indicate the
  4956. largest possible offset - if the rest of the frame is encoded with the
  4957. worst possible quality, an offset of -1 indicates that this region
  4958. should be encoded with the best possible quality anyway. Intermediate
  4959. values are then interpolated in some codec-dependent way.
  4960. For example, in 10-bit H.264 the quantisation parameter varies between
  4961. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4962. this region should be encoded with a QP around one-tenth of the full
  4963. range better than the rest of the frame. So, if most of the frame
  4964. were to be encoded with a QP of around 30, this region would get a QP
  4965. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4966. An extreme value of -1 would indicate that this region should be
  4967. encoded with the best possible quality regardless of the treatment of
  4968. the rest of the frame - that is, should be encoded at a QP of -12.
  4969. @item clear
  4970. If set to true, remove any existing regions of interest marked on the
  4971. frame before adding the new one.
  4972. @end table
  4973. @subsection Examples
  4974. @itemize
  4975. @item
  4976. Mark the centre quarter of the frame as interesting.
  4977. @example
  4978. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4979. @end example
  4980. @item
  4981. Mark the 100-pixel-wide region on the left edge of the frame as very
  4982. uninteresting (to be encoded at much lower quality than the rest of
  4983. the frame).
  4984. @example
  4985. addroi=0:0:100:ih:+1/5
  4986. @end example
  4987. @end itemize
  4988. @section alphaextract
  4989. Extract the alpha component from the input as a grayscale video. This
  4990. is especially useful with the @var{alphamerge} filter.
  4991. @section alphamerge
  4992. Add or replace the alpha component of the primary input with the
  4993. grayscale value of a second input. This is intended for use with
  4994. @var{alphaextract} to allow the transmission or storage of frame
  4995. sequences that have alpha in a format that doesn't support an alpha
  4996. channel.
  4997. For example, to reconstruct full frames from a normal YUV-encoded video
  4998. and a separate video created with @var{alphaextract}, you might use:
  4999. @example
  5000. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5001. @end example
  5002. @section amplify
  5003. Amplify differences between current pixel and pixels of adjacent frames in
  5004. same pixel location.
  5005. This filter accepts the following options:
  5006. @table @option
  5007. @item radius
  5008. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5009. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5010. @item factor
  5011. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5012. @item threshold
  5013. Set threshold for difference amplification. Any difference greater or equal to
  5014. this value will not alter source pixel. Default is 10.
  5015. Allowed range is from 0 to 65535.
  5016. @item tolerance
  5017. Set tolerance for difference amplification. Any difference lower to
  5018. this value will not alter source pixel. Default is 0.
  5019. Allowed range is from 0 to 65535.
  5020. @item low
  5021. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5022. This option controls maximum possible value that will decrease source pixel value.
  5023. @item high
  5024. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5025. This option controls maximum possible value that will increase source pixel value.
  5026. @item planes
  5027. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5028. @end table
  5029. @subsection Commands
  5030. This filter supports the following @ref{commands} that corresponds to option of same name:
  5031. @table @option
  5032. @item factor
  5033. @item threshold
  5034. @item tolerance
  5035. @item low
  5036. @item high
  5037. @item planes
  5038. @end table
  5039. @section ass
  5040. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5041. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5042. Substation Alpha) subtitles files.
  5043. This filter accepts the following option in addition to the common options from
  5044. the @ref{subtitles} filter:
  5045. @table @option
  5046. @item shaping
  5047. Set the shaping engine
  5048. Available values are:
  5049. @table @samp
  5050. @item auto
  5051. The default libass shaping engine, which is the best available.
  5052. @item simple
  5053. Fast, font-agnostic shaper that can do only substitutions
  5054. @item complex
  5055. Slower shaper using OpenType for substitutions and positioning
  5056. @end table
  5057. The default is @code{auto}.
  5058. @end table
  5059. @section atadenoise
  5060. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5061. The filter accepts the following options:
  5062. @table @option
  5063. @item 0a
  5064. Set threshold A for 1st plane. Default is 0.02.
  5065. Valid range is 0 to 0.3.
  5066. @item 0b
  5067. Set threshold B for 1st plane. Default is 0.04.
  5068. Valid range is 0 to 5.
  5069. @item 1a
  5070. Set threshold A for 2nd plane. Default is 0.02.
  5071. Valid range is 0 to 0.3.
  5072. @item 1b
  5073. Set threshold B for 2nd plane. Default is 0.04.
  5074. Valid range is 0 to 5.
  5075. @item 2a
  5076. Set threshold A for 3rd plane. Default is 0.02.
  5077. Valid range is 0 to 0.3.
  5078. @item 2b
  5079. Set threshold B for 3rd plane. Default is 0.04.
  5080. Valid range is 0 to 5.
  5081. Threshold A is designed to react on abrupt changes in the input signal and
  5082. threshold B is designed to react on continuous changes in the input signal.
  5083. @item s
  5084. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5085. number in range [5, 129].
  5086. @item p
  5087. Set what planes of frame filter will use for averaging. Default is all.
  5088. @item a
  5089. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5090. Alternatively can be set to @code{s} serial.
  5091. Parallel can be faster then serial, while other way around is never true.
  5092. Parallel will abort early on first change being greater then thresholds, while serial
  5093. will continue processing other side of frames if they are equal or bellow thresholds.
  5094. @end table
  5095. @subsection Commands
  5096. This filter supports same @ref{commands} as options except option @code{s}.
  5097. The command accepts the same syntax of the corresponding option.
  5098. @section avgblur
  5099. Apply average blur filter.
  5100. The filter accepts the following options:
  5101. @table @option
  5102. @item sizeX
  5103. Set horizontal radius size.
  5104. @item planes
  5105. Set which planes to filter. By default all planes are filtered.
  5106. @item sizeY
  5107. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5108. Default is @code{0}.
  5109. @end table
  5110. @subsection Commands
  5111. This filter supports same commands as options.
  5112. The command accepts the same syntax of the corresponding option.
  5113. If the specified expression is not valid, it is kept at its current
  5114. value.
  5115. @section bbox
  5116. Compute the bounding box for the non-black pixels in the input frame
  5117. luminance plane.
  5118. This filter computes the bounding box containing all the pixels with a
  5119. luminance value greater than the minimum allowed value.
  5120. The parameters describing the bounding box are printed on the filter
  5121. log.
  5122. The filter accepts the following option:
  5123. @table @option
  5124. @item min_val
  5125. Set the minimal luminance value. Default is @code{16}.
  5126. @end table
  5127. @section bilateral
  5128. Apply bilateral filter, spatial smoothing while preserving edges.
  5129. The filter accepts the following options:
  5130. @table @option
  5131. @item sigmaS
  5132. Set sigma of gaussian function to calculate spatial weight.
  5133. Allowed range is 0 to 512. Default is 0.1.
  5134. @item sigmaR
  5135. Set sigma of gaussian function to calculate range weight.
  5136. Allowed range is 0 to 1. Default is 0.1.
  5137. @item planes
  5138. Set planes to filter. Default is first only.
  5139. @end table
  5140. @section bitplanenoise
  5141. Show and measure bit plane noise.
  5142. The filter accepts the following options:
  5143. @table @option
  5144. @item bitplane
  5145. Set which plane to analyze. Default is @code{1}.
  5146. @item filter
  5147. Filter out noisy pixels from @code{bitplane} set above.
  5148. Default is disabled.
  5149. @end table
  5150. @section blackdetect
  5151. Detect video intervals that are (almost) completely black. Can be
  5152. useful to detect chapter transitions, commercials, or invalid
  5153. recordings.
  5154. The filter outputs its detection analysis to both the log as well as
  5155. frame metadata. If a black segment of at least the specified minimum
  5156. duration is found, a line with the start and end timestamps as well
  5157. as duration is printed to the log with level @code{info}. In addition,
  5158. a log line with level @code{debug} is printed per frame showing the
  5159. black amount detected for that frame.
  5160. The filter also attaches metadata to the first frame of a black
  5161. segment with key @code{lavfi.black_start} and to the first frame
  5162. after the black segment ends with key @code{lavfi.black_end}. The
  5163. value is the frame's timestamp. This metadata is added regardless
  5164. of the minimum duration specified.
  5165. The filter accepts the following options:
  5166. @table @option
  5167. @item black_min_duration, d
  5168. Set the minimum detected black duration expressed in seconds. It must
  5169. be a non-negative floating point number.
  5170. Default value is 2.0.
  5171. @item picture_black_ratio_th, pic_th
  5172. Set the threshold for considering a picture "black".
  5173. Express the minimum value for the ratio:
  5174. @example
  5175. @var{nb_black_pixels} / @var{nb_pixels}
  5176. @end example
  5177. for which a picture is considered black.
  5178. Default value is 0.98.
  5179. @item pixel_black_th, pix_th
  5180. Set the threshold for considering a pixel "black".
  5181. The threshold expresses the maximum pixel luminance value for which a
  5182. pixel is considered "black". The provided value is scaled according to
  5183. the following equation:
  5184. @example
  5185. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5186. @end example
  5187. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5188. the input video format, the range is [0-255] for YUV full-range
  5189. formats and [16-235] for YUV non full-range formats.
  5190. Default value is 0.10.
  5191. @end table
  5192. The following example sets the maximum pixel threshold to the minimum
  5193. value, and detects only black intervals of 2 or more seconds:
  5194. @example
  5195. blackdetect=d=2:pix_th=0.00
  5196. @end example
  5197. @section blackframe
  5198. Detect frames that are (almost) completely black. Can be useful to
  5199. detect chapter transitions or commercials. Output lines consist of
  5200. the frame number of the detected frame, the percentage of blackness,
  5201. the position in the file if known or -1 and the timestamp in seconds.
  5202. In order to display the output lines, you need to set the loglevel at
  5203. least to the AV_LOG_INFO value.
  5204. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5205. The value represents the percentage of pixels in the picture that
  5206. are below the threshold value.
  5207. It accepts the following parameters:
  5208. @table @option
  5209. @item amount
  5210. The percentage of the pixels that have to be below the threshold; it defaults to
  5211. @code{98}.
  5212. @item threshold, thresh
  5213. The threshold below which a pixel value is considered black; it defaults to
  5214. @code{32}.
  5215. @end table
  5216. @anchor{blend}
  5217. @section blend
  5218. Blend two video frames into each other.
  5219. The @code{blend} filter takes two input streams and outputs one
  5220. stream, the first input is the "top" layer and second input is
  5221. "bottom" layer. By default, the output terminates when the longest input terminates.
  5222. The @code{tblend} (time blend) filter takes two consecutive frames
  5223. from one single stream, and outputs the result obtained by blending
  5224. the new frame on top of the old frame.
  5225. A description of the accepted options follows.
  5226. @table @option
  5227. @item c0_mode
  5228. @item c1_mode
  5229. @item c2_mode
  5230. @item c3_mode
  5231. @item all_mode
  5232. Set blend mode for specific pixel component or all pixel components in case
  5233. of @var{all_mode}. Default value is @code{normal}.
  5234. Available values for component modes are:
  5235. @table @samp
  5236. @item addition
  5237. @item grainmerge
  5238. @item and
  5239. @item average
  5240. @item burn
  5241. @item darken
  5242. @item difference
  5243. @item grainextract
  5244. @item divide
  5245. @item dodge
  5246. @item freeze
  5247. @item exclusion
  5248. @item extremity
  5249. @item glow
  5250. @item hardlight
  5251. @item hardmix
  5252. @item heat
  5253. @item lighten
  5254. @item linearlight
  5255. @item multiply
  5256. @item multiply128
  5257. @item negation
  5258. @item normal
  5259. @item or
  5260. @item overlay
  5261. @item phoenix
  5262. @item pinlight
  5263. @item reflect
  5264. @item screen
  5265. @item softlight
  5266. @item subtract
  5267. @item vividlight
  5268. @item xor
  5269. @end table
  5270. @item c0_opacity
  5271. @item c1_opacity
  5272. @item c2_opacity
  5273. @item c3_opacity
  5274. @item all_opacity
  5275. Set blend opacity for specific pixel component or all pixel components in case
  5276. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5277. @item c0_expr
  5278. @item c1_expr
  5279. @item c2_expr
  5280. @item c3_expr
  5281. @item all_expr
  5282. Set blend expression for specific pixel component or all pixel components in case
  5283. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5284. The expressions can use the following variables:
  5285. @table @option
  5286. @item N
  5287. The sequential number of the filtered frame, starting from @code{0}.
  5288. @item X
  5289. @item Y
  5290. the coordinates of the current sample
  5291. @item W
  5292. @item H
  5293. the width and height of currently filtered plane
  5294. @item SW
  5295. @item SH
  5296. Width and height scale for the plane being filtered. It is the
  5297. ratio between the dimensions of the current plane to the luma plane,
  5298. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5299. the luma plane and @code{0.5,0.5} for the chroma planes.
  5300. @item T
  5301. Time of the current frame, expressed in seconds.
  5302. @item TOP, A
  5303. Value of pixel component at current location for first video frame (top layer).
  5304. @item BOTTOM, B
  5305. Value of pixel component at current location for second video frame (bottom layer).
  5306. @end table
  5307. @end table
  5308. The @code{blend} filter also supports the @ref{framesync} options.
  5309. @subsection Examples
  5310. @itemize
  5311. @item
  5312. Apply transition from bottom layer to top layer in first 10 seconds:
  5313. @example
  5314. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5315. @end example
  5316. @item
  5317. Apply linear horizontal transition from top layer to bottom layer:
  5318. @example
  5319. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5320. @end example
  5321. @item
  5322. Apply 1x1 checkerboard effect:
  5323. @example
  5324. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5325. @end example
  5326. @item
  5327. Apply uncover left effect:
  5328. @example
  5329. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5330. @end example
  5331. @item
  5332. Apply uncover down effect:
  5333. @example
  5334. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5335. @end example
  5336. @item
  5337. Apply uncover up-left effect:
  5338. @example
  5339. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5340. @end example
  5341. @item
  5342. Split diagonally video and shows top and bottom layer on each side:
  5343. @example
  5344. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5345. @end example
  5346. @item
  5347. Display differences between the current and the previous frame:
  5348. @example
  5349. tblend=all_mode=grainextract
  5350. @end example
  5351. @end itemize
  5352. @section bm3d
  5353. Denoise frames using Block-Matching 3D algorithm.
  5354. The filter accepts the following options.
  5355. @table @option
  5356. @item sigma
  5357. Set denoising strength. Default value is 1.
  5358. Allowed range is from 0 to 999.9.
  5359. The denoising algorithm is very sensitive to sigma, so adjust it
  5360. according to the source.
  5361. @item block
  5362. Set local patch size. This sets dimensions in 2D.
  5363. @item bstep
  5364. Set sliding step for processing blocks. Default value is 4.
  5365. Allowed range is from 1 to 64.
  5366. Smaller values allows processing more reference blocks and is slower.
  5367. @item group
  5368. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5369. When set to 1, no block matching is done. Larger values allows more blocks
  5370. in single group.
  5371. Allowed range is from 1 to 256.
  5372. @item range
  5373. Set radius for search block matching. Default is 9.
  5374. Allowed range is from 1 to INT32_MAX.
  5375. @item mstep
  5376. Set step between two search locations for block matching. Default is 1.
  5377. Allowed range is from 1 to 64. Smaller is slower.
  5378. @item thmse
  5379. Set threshold of mean square error for block matching. Valid range is 0 to
  5380. INT32_MAX.
  5381. @item hdthr
  5382. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5383. Larger values results in stronger hard-thresholding filtering in frequency
  5384. domain.
  5385. @item estim
  5386. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5387. Default is @code{basic}.
  5388. @item ref
  5389. If enabled, filter will use 2nd stream for block matching.
  5390. Default is disabled for @code{basic} value of @var{estim} option,
  5391. and always enabled if value of @var{estim} is @code{final}.
  5392. @item planes
  5393. Set planes to filter. Default is all available except alpha.
  5394. @end table
  5395. @subsection Examples
  5396. @itemize
  5397. @item
  5398. Basic filtering with bm3d:
  5399. @example
  5400. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5401. @end example
  5402. @item
  5403. Same as above, but filtering only luma:
  5404. @example
  5405. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5406. @end example
  5407. @item
  5408. Same as above, but with both estimation modes:
  5409. @example
  5410. 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
  5411. @end example
  5412. @item
  5413. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5414. @example
  5415. 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
  5416. @end example
  5417. @end itemize
  5418. @section boxblur
  5419. Apply a boxblur algorithm to the input video.
  5420. It accepts the following parameters:
  5421. @table @option
  5422. @item luma_radius, lr
  5423. @item luma_power, lp
  5424. @item chroma_radius, cr
  5425. @item chroma_power, cp
  5426. @item alpha_radius, ar
  5427. @item alpha_power, ap
  5428. @end table
  5429. A description of the accepted options follows.
  5430. @table @option
  5431. @item luma_radius, lr
  5432. @item chroma_radius, cr
  5433. @item alpha_radius, ar
  5434. Set an expression for the box radius in pixels used for blurring the
  5435. corresponding input plane.
  5436. The radius value must be a non-negative number, and must not be
  5437. greater than the value of the expression @code{min(w,h)/2} for the
  5438. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5439. planes.
  5440. Default value for @option{luma_radius} is "2". If not specified,
  5441. @option{chroma_radius} and @option{alpha_radius} default to the
  5442. corresponding value set for @option{luma_radius}.
  5443. The expressions can contain the following constants:
  5444. @table @option
  5445. @item w
  5446. @item h
  5447. The input width and height in pixels.
  5448. @item cw
  5449. @item ch
  5450. The input chroma image width and height in pixels.
  5451. @item hsub
  5452. @item vsub
  5453. The horizontal and vertical chroma subsample values. For example, for the
  5454. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5455. @end table
  5456. @item luma_power, lp
  5457. @item chroma_power, cp
  5458. @item alpha_power, ap
  5459. Specify how many times the boxblur filter is applied to the
  5460. corresponding plane.
  5461. Default value for @option{luma_power} is 2. If not specified,
  5462. @option{chroma_power} and @option{alpha_power} default to the
  5463. corresponding value set for @option{luma_power}.
  5464. A value of 0 will disable the effect.
  5465. @end table
  5466. @subsection Examples
  5467. @itemize
  5468. @item
  5469. Apply a boxblur filter with the luma, chroma, and alpha radii
  5470. set to 2:
  5471. @example
  5472. boxblur=luma_radius=2:luma_power=1
  5473. boxblur=2:1
  5474. @end example
  5475. @item
  5476. Set the luma radius to 2, and alpha and chroma radius to 0:
  5477. @example
  5478. boxblur=2:1:cr=0:ar=0
  5479. @end example
  5480. @item
  5481. Set the luma and chroma radii to a fraction of the video dimension:
  5482. @example
  5483. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5484. @end example
  5485. @end itemize
  5486. @section bwdif
  5487. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5488. Deinterlacing Filter").
  5489. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5490. interpolation algorithms.
  5491. It accepts the following parameters:
  5492. @table @option
  5493. @item mode
  5494. The interlacing mode to adopt. It accepts one of the following values:
  5495. @table @option
  5496. @item 0, send_frame
  5497. Output one frame for each frame.
  5498. @item 1, send_field
  5499. Output one frame for each field.
  5500. @end table
  5501. The default value is @code{send_field}.
  5502. @item parity
  5503. The picture field parity assumed for the input interlaced video. It accepts one
  5504. of the following values:
  5505. @table @option
  5506. @item 0, tff
  5507. Assume the top field is first.
  5508. @item 1, bff
  5509. Assume the bottom field is first.
  5510. @item -1, auto
  5511. Enable automatic detection of field parity.
  5512. @end table
  5513. The default value is @code{auto}.
  5514. If the interlacing is unknown or the decoder does not export this information,
  5515. top field first will be assumed.
  5516. @item deint
  5517. Specify which frames to deinterlace. Accepts one of the following
  5518. values:
  5519. @table @option
  5520. @item 0, all
  5521. Deinterlace all frames.
  5522. @item 1, interlaced
  5523. Only deinterlace frames marked as interlaced.
  5524. @end table
  5525. The default value is @code{all}.
  5526. @end table
  5527. @section cas
  5528. Apply Contrast Adaptive Sharpen filter to video stream.
  5529. The filter accepts the following options:
  5530. @table @option
  5531. @item strength
  5532. Set the sharpening strength. Default value is 0.
  5533. @item planes
  5534. Set planes to filter. Default value is to filter all
  5535. planes except alpha plane.
  5536. @end table
  5537. @section chromahold
  5538. Remove all color information for all colors except for certain one.
  5539. The filter accepts the following options:
  5540. @table @option
  5541. @item color
  5542. The color which will not be replaced with neutral chroma.
  5543. @item similarity
  5544. Similarity percentage with the above color.
  5545. 0.01 matches only the exact key color, while 1.0 matches everything.
  5546. @item blend
  5547. Blend percentage.
  5548. 0.0 makes pixels either fully gray, or not gray at all.
  5549. Higher values result in more preserved color.
  5550. @item yuv
  5551. Signals that the color passed is already in YUV instead of RGB.
  5552. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5553. This can be used to pass exact YUV values as hexadecimal numbers.
  5554. @end table
  5555. @subsection Commands
  5556. This filter supports same @ref{commands} as options.
  5557. The command accepts the same syntax of the corresponding option.
  5558. If the specified expression is not valid, it is kept at its current
  5559. value.
  5560. @section chromakey
  5561. YUV colorspace color/chroma keying.
  5562. The filter accepts the following options:
  5563. @table @option
  5564. @item color
  5565. The color which will be replaced with transparency.
  5566. @item similarity
  5567. Similarity percentage with the key color.
  5568. 0.01 matches only the exact key color, while 1.0 matches everything.
  5569. @item blend
  5570. Blend percentage.
  5571. 0.0 makes pixels either fully transparent, or not transparent at all.
  5572. Higher values result in semi-transparent pixels, with a higher transparency
  5573. the more similar the pixels color is to the key color.
  5574. @item yuv
  5575. Signals that the color passed is already in YUV instead of RGB.
  5576. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5577. This can be used to pass exact YUV values as hexadecimal numbers.
  5578. @end table
  5579. @subsection Commands
  5580. This filter supports same @ref{commands} as options.
  5581. The command accepts the same syntax of the corresponding option.
  5582. If the specified expression is not valid, it is kept at its current
  5583. value.
  5584. @subsection Examples
  5585. @itemize
  5586. @item
  5587. Make every green pixel in the input image transparent:
  5588. @example
  5589. ffmpeg -i input.png -vf chromakey=green out.png
  5590. @end example
  5591. @item
  5592. Overlay a greenscreen-video on top of a static black background.
  5593. @example
  5594. 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
  5595. @end example
  5596. @end itemize
  5597. @section chromanr
  5598. Reduce chrominance noise.
  5599. The filter accepts the following options:
  5600. @table @option
  5601. @item thres
  5602. Set threshold for averaging chrominance values.
  5603. Sum of absolute difference of U and V pixel components or current
  5604. pixel and neighbour pixels lower than this threshold will be used in
  5605. averaging. Luma component is left unchanged and is copied to output.
  5606. Default value is 30. Allowed range is from 1 to 200.
  5607. @item sizew
  5608. Set horizontal radius of rectangle used for averaging.
  5609. Allowed range is from 1 to 100. Default value is 5.
  5610. @item sizeh
  5611. Set vertical radius of rectangle used for averaging.
  5612. Allowed range is from 1 to 100. Default value is 5.
  5613. @item stepw
  5614. Set horizontal step when averaging. Default value is 1.
  5615. Allowed range is from 1 to 50.
  5616. Mostly useful to speed-up filtering.
  5617. @item steph
  5618. Set vertical step when averaging. Default value is 1.
  5619. Allowed range is from 1 to 50.
  5620. Mostly useful to speed-up filtering.
  5621. @end table
  5622. @subsection Commands
  5623. This filter supports same @ref{commands} as options.
  5624. The command accepts the same syntax of the corresponding option.
  5625. @section chromashift
  5626. Shift chroma pixels horizontally and/or vertically.
  5627. The filter accepts the following options:
  5628. @table @option
  5629. @item cbh
  5630. Set amount to shift chroma-blue horizontally.
  5631. @item cbv
  5632. Set amount to shift chroma-blue vertically.
  5633. @item crh
  5634. Set amount to shift chroma-red horizontally.
  5635. @item crv
  5636. Set amount to shift chroma-red vertically.
  5637. @item edge
  5638. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5639. @end table
  5640. @subsection Commands
  5641. This filter supports the all above options as @ref{commands}.
  5642. @section ciescope
  5643. Display CIE color diagram with pixels overlaid onto it.
  5644. The filter accepts the following options:
  5645. @table @option
  5646. @item system
  5647. Set color system.
  5648. @table @samp
  5649. @item ntsc, 470m
  5650. @item ebu, 470bg
  5651. @item smpte
  5652. @item 240m
  5653. @item apple
  5654. @item widergb
  5655. @item cie1931
  5656. @item rec709, hdtv
  5657. @item uhdtv, rec2020
  5658. @item dcip3
  5659. @end table
  5660. @item cie
  5661. Set CIE system.
  5662. @table @samp
  5663. @item xyy
  5664. @item ucs
  5665. @item luv
  5666. @end table
  5667. @item gamuts
  5668. Set what gamuts to draw.
  5669. See @code{system} option for available values.
  5670. @item size, s
  5671. Set ciescope size, by default set to 512.
  5672. @item intensity, i
  5673. Set intensity used to map input pixel values to CIE diagram.
  5674. @item contrast
  5675. Set contrast used to draw tongue colors that are out of active color system gamut.
  5676. @item corrgamma
  5677. Correct gamma displayed on scope, by default enabled.
  5678. @item showwhite
  5679. Show white point on CIE diagram, by default disabled.
  5680. @item gamma
  5681. Set input gamma. Used only with XYZ input color space.
  5682. @end table
  5683. @section codecview
  5684. Visualize information exported by some codecs.
  5685. Some codecs can export information through frames using side-data or other
  5686. means. For example, some MPEG based codecs export motion vectors through the
  5687. @var{export_mvs} flag in the codec @option{flags2} option.
  5688. The filter accepts the following option:
  5689. @table @option
  5690. @item mv
  5691. Set motion vectors to visualize.
  5692. Available flags for @var{mv} are:
  5693. @table @samp
  5694. @item pf
  5695. forward predicted MVs of P-frames
  5696. @item bf
  5697. forward predicted MVs of B-frames
  5698. @item bb
  5699. backward predicted MVs of B-frames
  5700. @end table
  5701. @item qp
  5702. Display quantization parameters using the chroma planes.
  5703. @item mv_type, mvt
  5704. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5705. Available flags for @var{mv_type} are:
  5706. @table @samp
  5707. @item fp
  5708. forward predicted MVs
  5709. @item bp
  5710. backward predicted MVs
  5711. @end table
  5712. @item frame_type, ft
  5713. Set frame type to visualize motion vectors of.
  5714. Available flags for @var{frame_type} are:
  5715. @table @samp
  5716. @item if
  5717. intra-coded frames (I-frames)
  5718. @item pf
  5719. predicted frames (P-frames)
  5720. @item bf
  5721. bi-directionally predicted frames (B-frames)
  5722. @end table
  5723. @end table
  5724. @subsection Examples
  5725. @itemize
  5726. @item
  5727. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5728. @example
  5729. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5730. @end example
  5731. @item
  5732. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5733. @example
  5734. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5735. @end example
  5736. @end itemize
  5737. @section colorbalance
  5738. Modify intensity of primary colors (red, green and blue) of input frames.
  5739. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5740. regions for the red-cyan, green-magenta or blue-yellow balance.
  5741. A positive adjustment value shifts the balance towards the primary color, a negative
  5742. value towards the complementary color.
  5743. The filter accepts the following options:
  5744. @table @option
  5745. @item rs
  5746. @item gs
  5747. @item bs
  5748. Adjust red, green and blue shadows (darkest pixels).
  5749. @item rm
  5750. @item gm
  5751. @item bm
  5752. Adjust red, green and blue midtones (medium pixels).
  5753. @item rh
  5754. @item gh
  5755. @item bh
  5756. Adjust red, green and blue highlights (brightest pixels).
  5757. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5758. @item pl
  5759. Preserve lightness when changing color balance. Default is disabled.
  5760. @end table
  5761. @subsection Examples
  5762. @itemize
  5763. @item
  5764. Add red color cast to shadows:
  5765. @example
  5766. colorbalance=rs=.3
  5767. @end example
  5768. @end itemize
  5769. @subsection Commands
  5770. This filter supports the all above options as @ref{commands}.
  5771. @section colorchannelmixer
  5772. Adjust video input frames by re-mixing color channels.
  5773. This filter modifies a color channel by adding the values associated to
  5774. the other channels of the same pixels. For example if the value to
  5775. modify is red, the output value will be:
  5776. @example
  5777. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5778. @end example
  5779. The filter accepts the following options:
  5780. @table @option
  5781. @item rr
  5782. @item rg
  5783. @item rb
  5784. @item ra
  5785. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5786. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5787. @item gr
  5788. @item gg
  5789. @item gb
  5790. @item ga
  5791. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5792. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5793. @item br
  5794. @item bg
  5795. @item bb
  5796. @item ba
  5797. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5798. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5799. @item ar
  5800. @item ag
  5801. @item ab
  5802. @item aa
  5803. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5804. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5805. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5806. @end table
  5807. @subsection Examples
  5808. @itemize
  5809. @item
  5810. Convert source to grayscale:
  5811. @example
  5812. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5813. @end example
  5814. @item
  5815. Simulate sepia tones:
  5816. @example
  5817. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5818. @end example
  5819. @end itemize
  5820. @subsection Commands
  5821. This filter supports the all above options as @ref{commands}.
  5822. @section colorkey
  5823. RGB colorspace color keying.
  5824. The filter accepts the following options:
  5825. @table @option
  5826. @item color
  5827. The color which will be replaced with transparency.
  5828. @item similarity
  5829. Similarity percentage with the key color.
  5830. 0.01 matches only the exact key color, while 1.0 matches everything.
  5831. @item blend
  5832. Blend percentage.
  5833. 0.0 makes pixels either fully transparent, or not transparent at all.
  5834. Higher values result in semi-transparent pixels, with a higher transparency
  5835. the more similar the pixels color is to the key color.
  5836. @end table
  5837. @subsection Examples
  5838. @itemize
  5839. @item
  5840. Make every green pixel in the input image transparent:
  5841. @example
  5842. ffmpeg -i input.png -vf colorkey=green out.png
  5843. @end example
  5844. @item
  5845. Overlay a greenscreen-video on top of a static background image.
  5846. @example
  5847. 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
  5848. @end example
  5849. @end itemize
  5850. @subsection Commands
  5851. This filter supports same @ref{commands} as options.
  5852. The command accepts the same syntax of the corresponding option.
  5853. If the specified expression is not valid, it is kept at its current
  5854. value.
  5855. @section colorhold
  5856. Remove all color information for all RGB colors except for certain one.
  5857. The filter accepts the following options:
  5858. @table @option
  5859. @item color
  5860. The color which will not be replaced with neutral gray.
  5861. @item similarity
  5862. Similarity percentage with the above color.
  5863. 0.01 matches only the exact key color, while 1.0 matches everything.
  5864. @item blend
  5865. Blend percentage. 0.0 makes pixels fully gray.
  5866. Higher values result in more preserved color.
  5867. @end table
  5868. @subsection Commands
  5869. This filter supports same @ref{commands} as options.
  5870. The command accepts the same syntax of the corresponding option.
  5871. If the specified expression is not valid, it is kept at its current
  5872. value.
  5873. @section colorlevels
  5874. Adjust video input frames using levels.
  5875. The filter accepts the following options:
  5876. @table @option
  5877. @item rimin
  5878. @item gimin
  5879. @item bimin
  5880. @item aimin
  5881. Adjust red, green, blue and alpha input black point.
  5882. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5883. @item rimax
  5884. @item gimax
  5885. @item bimax
  5886. @item aimax
  5887. Adjust red, green, blue and alpha input white point.
  5888. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5889. Input levels are used to lighten highlights (bright tones), darken shadows
  5890. (dark tones), change the balance of bright and dark tones.
  5891. @item romin
  5892. @item gomin
  5893. @item bomin
  5894. @item aomin
  5895. Adjust red, green, blue and alpha output black point.
  5896. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5897. @item romax
  5898. @item gomax
  5899. @item bomax
  5900. @item aomax
  5901. Adjust red, green, blue and alpha output white point.
  5902. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5903. Output levels allows manual selection of a constrained output level range.
  5904. @end table
  5905. @subsection Examples
  5906. @itemize
  5907. @item
  5908. Make video output darker:
  5909. @example
  5910. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5911. @end example
  5912. @item
  5913. Increase contrast:
  5914. @example
  5915. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5916. @end example
  5917. @item
  5918. Make video output lighter:
  5919. @example
  5920. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5921. @end example
  5922. @item
  5923. Increase brightness:
  5924. @example
  5925. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5926. @end example
  5927. @end itemize
  5928. @subsection Commands
  5929. This filter supports the all above options as @ref{commands}.
  5930. @section colormatrix
  5931. Convert color matrix.
  5932. The filter accepts the following options:
  5933. @table @option
  5934. @item src
  5935. @item dst
  5936. Specify the source and destination color matrix. Both values must be
  5937. specified.
  5938. The accepted values are:
  5939. @table @samp
  5940. @item bt709
  5941. BT.709
  5942. @item fcc
  5943. FCC
  5944. @item bt601
  5945. BT.601
  5946. @item bt470
  5947. BT.470
  5948. @item bt470bg
  5949. BT.470BG
  5950. @item smpte170m
  5951. SMPTE-170M
  5952. @item smpte240m
  5953. SMPTE-240M
  5954. @item bt2020
  5955. BT.2020
  5956. @end table
  5957. @end table
  5958. For example to convert from BT.601 to SMPTE-240M, use the command:
  5959. @example
  5960. colormatrix=bt601:smpte240m
  5961. @end example
  5962. @section colorspace
  5963. Convert colorspace, transfer characteristics or color primaries.
  5964. Input video needs to have an even size.
  5965. The filter accepts the following options:
  5966. @table @option
  5967. @anchor{all}
  5968. @item all
  5969. Specify all color properties at once.
  5970. The accepted values are:
  5971. @table @samp
  5972. @item bt470m
  5973. BT.470M
  5974. @item bt470bg
  5975. BT.470BG
  5976. @item bt601-6-525
  5977. BT.601-6 525
  5978. @item bt601-6-625
  5979. BT.601-6 625
  5980. @item bt709
  5981. BT.709
  5982. @item smpte170m
  5983. SMPTE-170M
  5984. @item smpte240m
  5985. SMPTE-240M
  5986. @item bt2020
  5987. BT.2020
  5988. @end table
  5989. @anchor{space}
  5990. @item space
  5991. Specify output colorspace.
  5992. The accepted values are:
  5993. @table @samp
  5994. @item bt709
  5995. BT.709
  5996. @item fcc
  5997. FCC
  5998. @item bt470bg
  5999. BT.470BG or BT.601-6 625
  6000. @item smpte170m
  6001. SMPTE-170M or BT.601-6 525
  6002. @item smpte240m
  6003. SMPTE-240M
  6004. @item ycgco
  6005. YCgCo
  6006. @item bt2020ncl
  6007. BT.2020 with non-constant luminance
  6008. @end table
  6009. @anchor{trc}
  6010. @item trc
  6011. Specify output transfer characteristics.
  6012. The accepted values are:
  6013. @table @samp
  6014. @item bt709
  6015. BT.709
  6016. @item bt470m
  6017. BT.470M
  6018. @item bt470bg
  6019. BT.470BG
  6020. @item gamma22
  6021. Constant gamma of 2.2
  6022. @item gamma28
  6023. Constant gamma of 2.8
  6024. @item smpte170m
  6025. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6026. @item smpte240m
  6027. SMPTE-240M
  6028. @item srgb
  6029. SRGB
  6030. @item iec61966-2-1
  6031. iec61966-2-1
  6032. @item iec61966-2-4
  6033. iec61966-2-4
  6034. @item xvycc
  6035. xvycc
  6036. @item bt2020-10
  6037. BT.2020 for 10-bits content
  6038. @item bt2020-12
  6039. BT.2020 for 12-bits content
  6040. @end table
  6041. @anchor{primaries}
  6042. @item primaries
  6043. Specify output color primaries.
  6044. The accepted values are:
  6045. @table @samp
  6046. @item bt709
  6047. BT.709
  6048. @item bt470m
  6049. BT.470M
  6050. @item bt470bg
  6051. BT.470BG or BT.601-6 625
  6052. @item smpte170m
  6053. SMPTE-170M or BT.601-6 525
  6054. @item smpte240m
  6055. SMPTE-240M
  6056. @item film
  6057. film
  6058. @item smpte431
  6059. SMPTE-431
  6060. @item smpte432
  6061. SMPTE-432
  6062. @item bt2020
  6063. BT.2020
  6064. @item jedec-p22
  6065. JEDEC P22 phosphors
  6066. @end table
  6067. @anchor{range}
  6068. @item range
  6069. Specify output color range.
  6070. The accepted values are:
  6071. @table @samp
  6072. @item tv
  6073. TV (restricted) range
  6074. @item mpeg
  6075. MPEG (restricted) range
  6076. @item pc
  6077. PC (full) range
  6078. @item jpeg
  6079. JPEG (full) range
  6080. @end table
  6081. @item format
  6082. Specify output color format.
  6083. The accepted values are:
  6084. @table @samp
  6085. @item yuv420p
  6086. YUV 4:2:0 planar 8-bits
  6087. @item yuv420p10
  6088. YUV 4:2:0 planar 10-bits
  6089. @item yuv420p12
  6090. YUV 4:2:0 planar 12-bits
  6091. @item yuv422p
  6092. YUV 4:2:2 planar 8-bits
  6093. @item yuv422p10
  6094. YUV 4:2:2 planar 10-bits
  6095. @item yuv422p12
  6096. YUV 4:2:2 planar 12-bits
  6097. @item yuv444p
  6098. YUV 4:4:4 planar 8-bits
  6099. @item yuv444p10
  6100. YUV 4:4:4 planar 10-bits
  6101. @item yuv444p12
  6102. YUV 4:4:4 planar 12-bits
  6103. @end table
  6104. @item fast
  6105. Do a fast conversion, which skips gamma/primary correction. This will take
  6106. significantly less CPU, but will be mathematically incorrect. To get output
  6107. compatible with that produced by the colormatrix filter, use fast=1.
  6108. @item dither
  6109. Specify dithering mode.
  6110. The accepted values are:
  6111. @table @samp
  6112. @item none
  6113. No dithering
  6114. @item fsb
  6115. Floyd-Steinberg dithering
  6116. @end table
  6117. @item wpadapt
  6118. Whitepoint adaptation mode.
  6119. The accepted values are:
  6120. @table @samp
  6121. @item bradford
  6122. Bradford whitepoint adaptation
  6123. @item vonkries
  6124. von Kries whitepoint adaptation
  6125. @item identity
  6126. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6127. @end table
  6128. @item iall
  6129. Override all input properties at once. Same accepted values as @ref{all}.
  6130. @item ispace
  6131. Override input colorspace. Same accepted values as @ref{space}.
  6132. @item iprimaries
  6133. Override input color primaries. Same accepted values as @ref{primaries}.
  6134. @item itrc
  6135. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6136. @item irange
  6137. Override input color range. Same accepted values as @ref{range}.
  6138. @end table
  6139. The filter converts the transfer characteristics, color space and color
  6140. primaries to the specified user values. The output value, if not specified,
  6141. is set to a default value based on the "all" property. If that property is
  6142. also not specified, the filter will log an error. The output color range and
  6143. format default to the same value as the input color range and format. The
  6144. input transfer characteristics, color space, color primaries and color range
  6145. should be set on the input data. If any of these are missing, the filter will
  6146. log an error and no conversion will take place.
  6147. For example to convert the input to SMPTE-240M, use the command:
  6148. @example
  6149. colorspace=smpte240m
  6150. @end example
  6151. @section convolution
  6152. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6153. The filter accepts the following options:
  6154. @table @option
  6155. @item 0m
  6156. @item 1m
  6157. @item 2m
  6158. @item 3m
  6159. Set matrix for each plane.
  6160. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6161. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6162. @item 0rdiv
  6163. @item 1rdiv
  6164. @item 2rdiv
  6165. @item 3rdiv
  6166. Set multiplier for calculated value for each plane.
  6167. If unset or 0, it will be sum of all matrix elements.
  6168. @item 0bias
  6169. @item 1bias
  6170. @item 2bias
  6171. @item 3bias
  6172. Set bias for each plane. This value is added to the result of the multiplication.
  6173. Useful for making the overall image brighter or darker. Default is 0.0.
  6174. @item 0mode
  6175. @item 1mode
  6176. @item 2mode
  6177. @item 3mode
  6178. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6179. Default is @var{square}.
  6180. @end table
  6181. @subsection Examples
  6182. @itemize
  6183. @item
  6184. Apply sharpen:
  6185. @example
  6186. 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"
  6187. @end example
  6188. @item
  6189. Apply blur:
  6190. @example
  6191. 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"
  6192. @end example
  6193. @item
  6194. Apply edge enhance:
  6195. @example
  6196. 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"
  6197. @end example
  6198. @item
  6199. Apply edge detect:
  6200. @example
  6201. 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"
  6202. @end example
  6203. @item
  6204. Apply laplacian edge detector which includes diagonals:
  6205. @example
  6206. 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"
  6207. @end example
  6208. @item
  6209. Apply emboss:
  6210. @example
  6211. 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"
  6212. @end example
  6213. @end itemize
  6214. @section convolve
  6215. Apply 2D convolution of video stream in frequency domain using second stream
  6216. as impulse.
  6217. The filter accepts the following options:
  6218. @table @option
  6219. @item planes
  6220. Set which planes to process.
  6221. @item impulse
  6222. Set which impulse video frames will be processed, can be @var{first}
  6223. or @var{all}. Default is @var{all}.
  6224. @end table
  6225. The @code{convolve} filter also supports the @ref{framesync} options.
  6226. @section copy
  6227. Copy the input video source unchanged to the output. This is mainly useful for
  6228. testing purposes.
  6229. @anchor{coreimage}
  6230. @section coreimage
  6231. Video filtering on GPU using Apple's CoreImage API on OSX.
  6232. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6233. processed by video hardware. However, software-based OpenGL implementations
  6234. exist which means there is no guarantee for hardware processing. It depends on
  6235. the respective OSX.
  6236. There are many filters and image generators provided by Apple that come with a
  6237. large variety of options. The filter has to be referenced by its name along
  6238. with its options.
  6239. The coreimage filter accepts the following options:
  6240. @table @option
  6241. @item list_filters
  6242. List all available filters and generators along with all their respective
  6243. options as well as possible minimum and maximum values along with the default
  6244. values.
  6245. @example
  6246. list_filters=true
  6247. @end example
  6248. @item filter
  6249. Specify all filters by their respective name and options.
  6250. Use @var{list_filters} to determine all valid filter names and options.
  6251. Numerical options are specified by a float value and are automatically clamped
  6252. to their respective value range. Vector and color options have to be specified
  6253. by a list of space separated float values. Character escaping has to be done.
  6254. A special option name @code{default} is available to use default options for a
  6255. filter.
  6256. It is required to specify either @code{default} or at least one of the filter options.
  6257. All omitted options are used with their default values.
  6258. The syntax of the filter string is as follows:
  6259. @example
  6260. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6261. @end example
  6262. @item output_rect
  6263. Specify a rectangle where the output of the filter chain is copied into the
  6264. input image. It is given by a list of space separated float values:
  6265. @example
  6266. output_rect=x\ y\ width\ height
  6267. @end example
  6268. If not given, the output rectangle equals the dimensions of the input image.
  6269. The output rectangle is automatically cropped at the borders of the input
  6270. image. Negative values are valid for each component.
  6271. @example
  6272. output_rect=25\ 25\ 100\ 100
  6273. @end example
  6274. @end table
  6275. Several filters can be chained for successive processing without GPU-HOST
  6276. transfers allowing for fast processing of complex filter chains.
  6277. Currently, only filters with zero (generators) or exactly one (filters) input
  6278. image and one output image are supported. Also, transition filters are not yet
  6279. usable as intended.
  6280. Some filters generate output images with additional padding depending on the
  6281. respective filter kernel. The padding is automatically removed to ensure the
  6282. filter output has the same size as the input image.
  6283. For image generators, the size of the output image is determined by the
  6284. previous output image of the filter chain or the input image of the whole
  6285. filterchain, respectively. The generators do not use the pixel information of
  6286. this image to generate their output. However, the generated output is
  6287. blended onto this image, resulting in partial or complete coverage of the
  6288. output image.
  6289. The @ref{coreimagesrc} video source can be used for generating input images
  6290. which are directly fed into the filter chain. By using it, providing input
  6291. images by another video source or an input video is not required.
  6292. @subsection Examples
  6293. @itemize
  6294. @item
  6295. List all filters available:
  6296. @example
  6297. coreimage=list_filters=true
  6298. @end example
  6299. @item
  6300. Use the CIBoxBlur filter with default options to blur an image:
  6301. @example
  6302. coreimage=filter=CIBoxBlur@@default
  6303. @end example
  6304. @item
  6305. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6306. its center at 100x100 and a radius of 50 pixels:
  6307. @example
  6308. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6309. @end example
  6310. @item
  6311. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6312. given as complete and escaped command-line for Apple's standard bash shell:
  6313. @example
  6314. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6315. @end example
  6316. @end itemize
  6317. @section cover_rect
  6318. Cover a rectangular object
  6319. It accepts the following options:
  6320. @table @option
  6321. @item cover
  6322. Filepath of the optional cover image, needs to be in yuv420.
  6323. @item mode
  6324. Set covering mode.
  6325. It accepts the following values:
  6326. @table @samp
  6327. @item cover
  6328. cover it by the supplied image
  6329. @item blur
  6330. cover it by interpolating the surrounding pixels
  6331. @end table
  6332. Default value is @var{blur}.
  6333. @end table
  6334. @subsection Examples
  6335. @itemize
  6336. @item
  6337. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6338. @example
  6339. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6340. @end example
  6341. @end itemize
  6342. @section crop
  6343. Crop the input video to given dimensions.
  6344. It accepts the following parameters:
  6345. @table @option
  6346. @item w, out_w
  6347. The width of the output video. It defaults to @code{iw}.
  6348. This expression is evaluated only once during the filter
  6349. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6350. @item h, out_h
  6351. The height of the output video. It defaults to @code{ih}.
  6352. This expression is evaluated only once during the filter
  6353. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6354. @item x
  6355. The horizontal position, in the input video, of the left edge of the output
  6356. video. It defaults to @code{(in_w-out_w)/2}.
  6357. This expression is evaluated per-frame.
  6358. @item y
  6359. The vertical position, in the input video, of the top edge of the output video.
  6360. It defaults to @code{(in_h-out_h)/2}.
  6361. This expression is evaluated per-frame.
  6362. @item keep_aspect
  6363. If set to 1 will force the output display aspect ratio
  6364. to be the same of the input, by changing the output sample aspect
  6365. ratio. It defaults to 0.
  6366. @item exact
  6367. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6368. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6369. It defaults to 0.
  6370. @end table
  6371. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6372. expressions containing the following constants:
  6373. @table @option
  6374. @item x
  6375. @item y
  6376. The computed values for @var{x} and @var{y}. They are evaluated for
  6377. each new frame.
  6378. @item in_w
  6379. @item in_h
  6380. The input width and height.
  6381. @item iw
  6382. @item ih
  6383. These are the same as @var{in_w} and @var{in_h}.
  6384. @item out_w
  6385. @item out_h
  6386. The output (cropped) width and height.
  6387. @item ow
  6388. @item oh
  6389. These are the same as @var{out_w} and @var{out_h}.
  6390. @item a
  6391. same as @var{iw} / @var{ih}
  6392. @item sar
  6393. input sample aspect ratio
  6394. @item dar
  6395. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6396. @item hsub
  6397. @item vsub
  6398. horizontal and vertical chroma subsample values. For example for the
  6399. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6400. @item n
  6401. The number of the input frame, starting from 0.
  6402. @item pos
  6403. the position in the file of the input frame, NAN if unknown
  6404. @item t
  6405. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6406. @end table
  6407. The expression for @var{out_w} may depend on the value of @var{out_h},
  6408. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6409. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6410. evaluated after @var{out_w} and @var{out_h}.
  6411. The @var{x} and @var{y} parameters specify the expressions for the
  6412. position of the top-left corner of the output (non-cropped) area. They
  6413. are evaluated for each frame. If the evaluated value is not valid, it
  6414. is approximated to the nearest valid value.
  6415. The expression for @var{x} may depend on @var{y}, and the expression
  6416. for @var{y} may depend on @var{x}.
  6417. @subsection Examples
  6418. @itemize
  6419. @item
  6420. Crop area with size 100x100 at position (12,34).
  6421. @example
  6422. crop=100:100:12:34
  6423. @end example
  6424. Using named options, the example above becomes:
  6425. @example
  6426. crop=w=100:h=100:x=12:y=34
  6427. @end example
  6428. @item
  6429. Crop the central input area with size 100x100:
  6430. @example
  6431. crop=100:100
  6432. @end example
  6433. @item
  6434. Crop the central input area with size 2/3 of the input video:
  6435. @example
  6436. crop=2/3*in_w:2/3*in_h
  6437. @end example
  6438. @item
  6439. Crop the input video central square:
  6440. @example
  6441. crop=out_w=in_h
  6442. crop=in_h
  6443. @end example
  6444. @item
  6445. Delimit the rectangle with the top-left corner placed at position
  6446. 100:100 and the right-bottom corner corresponding to the right-bottom
  6447. corner of the input image.
  6448. @example
  6449. crop=in_w-100:in_h-100:100:100
  6450. @end example
  6451. @item
  6452. Crop 10 pixels from the left and right borders, and 20 pixels from
  6453. the top and bottom borders
  6454. @example
  6455. crop=in_w-2*10:in_h-2*20
  6456. @end example
  6457. @item
  6458. Keep only the bottom right quarter of the input image:
  6459. @example
  6460. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6461. @end example
  6462. @item
  6463. Crop height for getting Greek harmony:
  6464. @example
  6465. crop=in_w:1/PHI*in_w
  6466. @end example
  6467. @item
  6468. Apply trembling effect:
  6469. @example
  6470. 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)
  6471. @end example
  6472. @item
  6473. Apply erratic camera effect depending on timestamp:
  6474. @example
  6475. 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)"
  6476. @end example
  6477. @item
  6478. Set x depending on the value of y:
  6479. @example
  6480. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6481. @end example
  6482. @end itemize
  6483. @subsection Commands
  6484. This filter supports the following commands:
  6485. @table @option
  6486. @item w, out_w
  6487. @item h, out_h
  6488. @item x
  6489. @item y
  6490. Set width/height of the output video and the horizontal/vertical position
  6491. in the input video.
  6492. The command accepts the same syntax of the corresponding option.
  6493. If the specified expression is not valid, it is kept at its current
  6494. value.
  6495. @end table
  6496. @section cropdetect
  6497. Auto-detect the crop size.
  6498. It calculates the necessary cropping parameters and prints the
  6499. recommended parameters via the logging system. The detected dimensions
  6500. correspond to the non-black area of the input video.
  6501. It accepts the following parameters:
  6502. @table @option
  6503. @item limit
  6504. Set higher black value threshold, which can be optionally specified
  6505. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6506. value greater to the set value is considered non-black. It defaults to 24.
  6507. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6508. on the bitdepth of the pixel format.
  6509. @item round
  6510. The value which the width/height should be divisible by. It defaults to
  6511. 16. The offset is automatically adjusted to center the video. Use 2 to
  6512. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6513. encoding to most video codecs.
  6514. @item reset_count, reset
  6515. Set the counter that determines after how many frames cropdetect will
  6516. reset the previously detected largest video area and start over to
  6517. detect the current optimal crop area. Default value is 0.
  6518. This can be useful when channel logos distort the video area. 0
  6519. indicates 'never reset', and returns the largest area encountered during
  6520. playback.
  6521. @end table
  6522. @anchor{cue}
  6523. @section cue
  6524. Delay video filtering until a given wallclock timestamp. The filter first
  6525. passes on @option{preroll} amount of frames, then it buffers at most
  6526. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6527. it forwards the buffered frames and also any subsequent frames coming in its
  6528. input.
  6529. The filter can be used synchronize the output of multiple ffmpeg processes for
  6530. realtime output devices like decklink. By putting the delay in the filtering
  6531. chain and pre-buffering frames the process can pass on data to output almost
  6532. immediately after the target wallclock timestamp is reached.
  6533. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6534. some use cases.
  6535. @table @option
  6536. @item cue
  6537. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6538. @item preroll
  6539. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6540. @item buffer
  6541. The maximum duration of content to buffer before waiting for the cue expressed
  6542. in seconds. Default is 0.
  6543. @end table
  6544. @anchor{curves}
  6545. @section curves
  6546. Apply color adjustments using curves.
  6547. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6548. component (red, green and blue) has its values defined by @var{N} key points
  6549. tied from each other using a smooth curve. The x-axis represents the pixel
  6550. values from the input frame, and the y-axis the new pixel values to be set for
  6551. the output frame.
  6552. By default, a component curve is defined by the two points @var{(0;0)} and
  6553. @var{(1;1)}. This creates a straight line where each original pixel value is
  6554. "adjusted" to its own value, which means no change to the image.
  6555. The filter allows you to redefine these two points and add some more. A new
  6556. curve (using a natural cubic spline interpolation) will be define to pass
  6557. smoothly through all these new coordinates. The new defined points needs to be
  6558. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6559. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6560. the vector spaces, the values will be clipped accordingly.
  6561. The filter accepts the following options:
  6562. @table @option
  6563. @item preset
  6564. Select one of the available color presets. This option can be used in addition
  6565. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6566. options takes priority on the preset values.
  6567. Available presets are:
  6568. @table @samp
  6569. @item none
  6570. @item color_negative
  6571. @item cross_process
  6572. @item darker
  6573. @item increase_contrast
  6574. @item lighter
  6575. @item linear_contrast
  6576. @item medium_contrast
  6577. @item negative
  6578. @item strong_contrast
  6579. @item vintage
  6580. @end table
  6581. Default is @code{none}.
  6582. @item master, m
  6583. Set the master key points. These points will define a second pass mapping. It
  6584. is sometimes called a "luminance" or "value" mapping. It can be used with
  6585. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6586. post-processing LUT.
  6587. @item red, r
  6588. Set the key points for the red component.
  6589. @item green, g
  6590. Set the key points for the green component.
  6591. @item blue, b
  6592. Set the key points for the blue component.
  6593. @item all
  6594. Set the key points for all components (not including master).
  6595. Can be used in addition to the other key points component
  6596. options. In this case, the unset component(s) will fallback on this
  6597. @option{all} setting.
  6598. @item psfile
  6599. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6600. @item plot
  6601. Save Gnuplot script of the curves in specified file.
  6602. @end table
  6603. To avoid some filtergraph syntax conflicts, each key points list need to be
  6604. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6605. @subsection Examples
  6606. @itemize
  6607. @item
  6608. Increase slightly the middle level of blue:
  6609. @example
  6610. curves=blue='0/0 0.5/0.58 1/1'
  6611. @end example
  6612. @item
  6613. Vintage effect:
  6614. @example
  6615. 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'
  6616. @end example
  6617. Here we obtain the following coordinates for each components:
  6618. @table @var
  6619. @item red
  6620. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6621. @item green
  6622. @code{(0;0) (0.50;0.48) (1;1)}
  6623. @item blue
  6624. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6625. @end table
  6626. @item
  6627. The previous example can also be achieved with the associated built-in preset:
  6628. @example
  6629. curves=preset=vintage
  6630. @end example
  6631. @item
  6632. Or simply:
  6633. @example
  6634. curves=vintage
  6635. @end example
  6636. @item
  6637. Use a Photoshop preset and redefine the points of the green component:
  6638. @example
  6639. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6640. @end example
  6641. @item
  6642. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6643. and @command{gnuplot}:
  6644. @example
  6645. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6646. gnuplot -p /tmp/curves.plt
  6647. @end example
  6648. @end itemize
  6649. @section datascope
  6650. Video data analysis filter.
  6651. This filter shows hexadecimal pixel values of part of video.
  6652. The filter accepts the following options:
  6653. @table @option
  6654. @item size, s
  6655. Set output video size.
  6656. @item x
  6657. Set x offset from where to pick pixels.
  6658. @item y
  6659. Set y offset from where to pick pixels.
  6660. @item mode
  6661. Set scope mode, can be one of the following:
  6662. @table @samp
  6663. @item mono
  6664. Draw hexadecimal pixel values with white color on black background.
  6665. @item color
  6666. Draw hexadecimal pixel values with input video pixel color on black
  6667. background.
  6668. @item color2
  6669. Draw hexadecimal pixel values on color background picked from input video,
  6670. the text color is picked in such way so its always visible.
  6671. @end table
  6672. @item axis
  6673. Draw rows and columns numbers on left and top of video.
  6674. @item opacity
  6675. Set background opacity.
  6676. @item format
  6677. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6678. @end table
  6679. @section dblur
  6680. Apply Directional blur filter.
  6681. The filter accepts the following options:
  6682. @table @option
  6683. @item angle
  6684. Set angle of directional blur. Default is @code{45}.
  6685. @item radius
  6686. Set radius of directional blur. Default is @code{5}.
  6687. @item planes
  6688. Set which planes to filter. By default all planes are filtered.
  6689. @end table
  6690. @subsection Commands
  6691. This filter supports same @ref{commands} as options.
  6692. The command accepts the same syntax of the corresponding option.
  6693. If the specified expression is not valid, it is kept at its current
  6694. value.
  6695. @section dctdnoiz
  6696. Denoise frames using 2D DCT (frequency domain filtering).
  6697. This filter is not designed for real time.
  6698. The filter accepts the following options:
  6699. @table @option
  6700. @item sigma, s
  6701. Set the noise sigma constant.
  6702. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6703. coefficient (absolute value) below this threshold with be dropped.
  6704. If you need a more advanced filtering, see @option{expr}.
  6705. Default is @code{0}.
  6706. @item overlap
  6707. Set number overlapping pixels for each block. Since the filter can be slow, you
  6708. may want to reduce this value, at the cost of a less effective filter and the
  6709. risk of various artefacts.
  6710. If the overlapping value doesn't permit processing the whole input width or
  6711. height, a warning will be displayed and according borders won't be denoised.
  6712. Default value is @var{blocksize}-1, which is the best possible setting.
  6713. @item expr, e
  6714. Set the coefficient factor expression.
  6715. For each coefficient of a DCT block, this expression will be evaluated as a
  6716. multiplier value for the coefficient.
  6717. If this is option is set, the @option{sigma} option will be ignored.
  6718. The absolute value of the coefficient can be accessed through the @var{c}
  6719. variable.
  6720. @item n
  6721. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6722. @var{blocksize}, which is the width and height of the processed blocks.
  6723. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6724. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6725. on the speed processing. Also, a larger block size does not necessarily means a
  6726. better de-noising.
  6727. @end table
  6728. @subsection Examples
  6729. Apply a denoise with a @option{sigma} of @code{4.5}:
  6730. @example
  6731. dctdnoiz=4.5
  6732. @end example
  6733. The same operation can be achieved using the expression system:
  6734. @example
  6735. dctdnoiz=e='gte(c, 4.5*3)'
  6736. @end example
  6737. Violent denoise using a block size of @code{16x16}:
  6738. @example
  6739. dctdnoiz=15:n=4
  6740. @end example
  6741. @section deband
  6742. Remove banding artifacts from input video.
  6743. It works by replacing banded pixels with average value of referenced pixels.
  6744. The filter accepts the following options:
  6745. @table @option
  6746. @item 1thr
  6747. @item 2thr
  6748. @item 3thr
  6749. @item 4thr
  6750. Set banding detection threshold for each plane. Default is 0.02.
  6751. Valid range is 0.00003 to 0.5.
  6752. If difference between current pixel and reference pixel is less than threshold,
  6753. it will be considered as banded.
  6754. @item range, r
  6755. Banding detection range in pixels. Default is 16. If positive, random number
  6756. in range 0 to set value will be used. If negative, exact absolute value
  6757. will be used.
  6758. The range defines square of four pixels around current pixel.
  6759. @item direction, d
  6760. Set direction in radians from which four pixel will be compared. If positive,
  6761. random direction from 0 to set direction will be picked. If negative, exact of
  6762. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6763. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6764. column.
  6765. @item blur, b
  6766. If enabled, current pixel is compared with average value of all four
  6767. surrounding pixels. The default is enabled. If disabled current pixel is
  6768. compared with all four surrounding pixels. The pixel is considered banded
  6769. if only all four differences with surrounding pixels are less than threshold.
  6770. @item coupling, c
  6771. If enabled, current pixel is changed if and only if all pixel components are banded,
  6772. e.g. banding detection threshold is triggered for all color components.
  6773. The default is disabled.
  6774. @end table
  6775. @section deblock
  6776. Remove blocking artifacts from input video.
  6777. The filter accepts the following options:
  6778. @table @option
  6779. @item filter
  6780. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6781. This controls what kind of deblocking is applied.
  6782. @item block
  6783. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6784. @item alpha
  6785. @item beta
  6786. @item gamma
  6787. @item delta
  6788. Set blocking detection thresholds. Allowed range is 0 to 1.
  6789. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6790. Using higher threshold gives more deblocking strength.
  6791. Setting @var{alpha} controls threshold detection at exact edge of block.
  6792. Remaining options controls threshold detection near the edge. Each one for
  6793. below/above or left/right. Setting any of those to @var{0} disables
  6794. deblocking.
  6795. @item planes
  6796. Set planes to filter. Default is to filter all available planes.
  6797. @end table
  6798. @subsection Examples
  6799. @itemize
  6800. @item
  6801. Deblock using weak filter and block size of 4 pixels.
  6802. @example
  6803. deblock=filter=weak:block=4
  6804. @end example
  6805. @item
  6806. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6807. deblocking more edges.
  6808. @example
  6809. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6810. @end example
  6811. @item
  6812. Similar as above, but filter only first plane.
  6813. @example
  6814. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6815. @end example
  6816. @item
  6817. Similar as above, but filter only second and third plane.
  6818. @example
  6819. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6820. @end example
  6821. @end itemize
  6822. @anchor{decimate}
  6823. @section decimate
  6824. Drop duplicated frames at regular intervals.
  6825. The filter accepts the following options:
  6826. @table @option
  6827. @item cycle
  6828. Set the number of frames from which one will be dropped. Setting this to
  6829. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6830. Default is @code{5}.
  6831. @item dupthresh
  6832. Set the threshold for duplicate detection. If the difference metric for a frame
  6833. is less than or equal to this value, then it is declared as duplicate. Default
  6834. is @code{1.1}
  6835. @item scthresh
  6836. Set scene change threshold. Default is @code{15}.
  6837. @item blockx
  6838. @item blocky
  6839. Set the size of the x and y-axis blocks used during metric calculations.
  6840. Larger blocks give better noise suppression, but also give worse detection of
  6841. small movements. Must be a power of two. Default is @code{32}.
  6842. @item ppsrc
  6843. Mark main input as a pre-processed input and activate clean source input
  6844. stream. This allows the input to be pre-processed with various filters to help
  6845. the metrics calculation while keeping the frame selection lossless. When set to
  6846. @code{1}, the first stream is for the pre-processed input, and the second
  6847. stream is the clean source from where the kept frames are chosen. Default is
  6848. @code{0}.
  6849. @item chroma
  6850. Set whether or not chroma is considered in the metric calculations. Default is
  6851. @code{1}.
  6852. @end table
  6853. @section deconvolve
  6854. Apply 2D deconvolution of video stream in frequency domain using second stream
  6855. as impulse.
  6856. The filter accepts the following options:
  6857. @table @option
  6858. @item planes
  6859. Set which planes to process.
  6860. @item impulse
  6861. Set which impulse video frames will be processed, can be @var{first}
  6862. or @var{all}. Default is @var{all}.
  6863. @item noise
  6864. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6865. and height are not same and not power of 2 or if stream prior to convolving
  6866. had noise.
  6867. @end table
  6868. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6869. @section dedot
  6870. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6871. It accepts the following options:
  6872. @table @option
  6873. @item m
  6874. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6875. @var{rainbows} for cross-color reduction.
  6876. @item lt
  6877. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6878. @item tl
  6879. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6880. @item tc
  6881. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6882. @item ct
  6883. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6884. @end table
  6885. @section deflate
  6886. Apply deflate effect to the video.
  6887. This filter replaces the pixel by the local(3x3) average by taking into account
  6888. only values lower than the pixel.
  6889. It accepts the following options:
  6890. @table @option
  6891. @item threshold0
  6892. @item threshold1
  6893. @item threshold2
  6894. @item threshold3
  6895. Limit the maximum change for each plane, default is 65535.
  6896. If 0, plane will remain unchanged.
  6897. @end table
  6898. @subsection Commands
  6899. This filter supports the all above options as @ref{commands}.
  6900. @section deflicker
  6901. Remove temporal frame luminance variations.
  6902. It accepts the following options:
  6903. @table @option
  6904. @item size, s
  6905. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6906. @item mode, m
  6907. Set averaging mode to smooth temporal luminance variations.
  6908. Available values are:
  6909. @table @samp
  6910. @item am
  6911. Arithmetic mean
  6912. @item gm
  6913. Geometric mean
  6914. @item hm
  6915. Harmonic mean
  6916. @item qm
  6917. Quadratic mean
  6918. @item cm
  6919. Cubic mean
  6920. @item pm
  6921. Power mean
  6922. @item median
  6923. Median
  6924. @end table
  6925. @item bypass
  6926. Do not actually modify frame. Useful when one only wants metadata.
  6927. @end table
  6928. @section dejudder
  6929. Remove judder produced by partially interlaced telecined content.
  6930. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6931. source was partially telecined content then the output of @code{pullup,dejudder}
  6932. will have a variable frame rate. May change the recorded frame rate of the
  6933. container. Aside from that change, this filter will not affect constant frame
  6934. rate video.
  6935. The option available in this filter is:
  6936. @table @option
  6937. @item cycle
  6938. Specify the length of the window over which the judder repeats.
  6939. Accepts any integer greater than 1. Useful values are:
  6940. @table @samp
  6941. @item 4
  6942. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6943. @item 5
  6944. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6945. @item 20
  6946. If a mixture of the two.
  6947. @end table
  6948. The default is @samp{4}.
  6949. @end table
  6950. @section delogo
  6951. Suppress a TV station logo by a simple interpolation of the surrounding
  6952. pixels. Just set a rectangle covering the logo and watch it disappear
  6953. (and sometimes something even uglier appear - your mileage may vary).
  6954. It accepts the following parameters:
  6955. @table @option
  6956. @item x
  6957. @item y
  6958. Specify the top left corner coordinates of the logo. They must be
  6959. specified.
  6960. @item w
  6961. @item h
  6962. Specify the width and height of the logo to clear. They must be
  6963. specified.
  6964. @item band, t
  6965. Specify the thickness of the fuzzy edge of the rectangle (added to
  6966. @var{w} and @var{h}). The default value is 1. This option is
  6967. deprecated, setting higher values should no longer be necessary and
  6968. is not recommended.
  6969. @item show
  6970. When set to 1, a green rectangle is drawn on the screen to simplify
  6971. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6972. The default value is 0.
  6973. The rectangle is drawn on the outermost pixels which will be (partly)
  6974. replaced with interpolated values. The values of the next pixels
  6975. immediately outside this rectangle in each direction will be used to
  6976. compute the interpolated pixel values inside the rectangle.
  6977. @end table
  6978. @subsection Examples
  6979. @itemize
  6980. @item
  6981. Set a rectangle covering the area with top left corner coordinates 0,0
  6982. and size 100x77, and a band of size 10:
  6983. @example
  6984. delogo=x=0:y=0:w=100:h=77:band=10
  6985. @end example
  6986. @end itemize
  6987. @anchor{derain}
  6988. @section derain
  6989. Remove the rain in the input image/video by applying the derain methods based on
  6990. convolutional neural networks. Supported models:
  6991. @itemize
  6992. @item
  6993. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6994. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6995. @end itemize
  6996. Training as well as model generation scripts are provided in
  6997. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6998. Native model files (.model) can be generated from TensorFlow model
  6999. files (.pb) by using tools/python/convert.py
  7000. The filter accepts the following options:
  7001. @table @option
  7002. @item filter_type
  7003. Specify which filter to use. This option accepts the following values:
  7004. @table @samp
  7005. @item derain
  7006. Derain filter. To conduct derain filter, you need to use a derain model.
  7007. @item dehaze
  7008. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7009. @end table
  7010. Default value is @samp{derain}.
  7011. @item dnn_backend
  7012. Specify which DNN backend to use for model loading and execution. This option accepts
  7013. the following values:
  7014. @table @samp
  7015. @item native
  7016. Native implementation of DNN loading and execution.
  7017. @item tensorflow
  7018. TensorFlow backend. To enable this backend you
  7019. need to install the TensorFlow for C library (see
  7020. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7021. @code{--enable-libtensorflow}
  7022. @end table
  7023. Default value is @samp{native}.
  7024. @item model
  7025. Set path to model file specifying network architecture and its parameters.
  7026. Note that different backends use different file formats. TensorFlow and native
  7027. backend can load files for only its format.
  7028. @end table
  7029. It can also be finished with @ref{dnn_processing} filter.
  7030. @section deshake
  7031. Attempt to fix small changes in horizontal and/or vertical shift. This
  7032. filter helps remove camera shake from hand-holding a camera, bumping a
  7033. tripod, moving on a vehicle, etc.
  7034. The filter accepts the following options:
  7035. @table @option
  7036. @item x
  7037. @item y
  7038. @item w
  7039. @item h
  7040. Specify a rectangular area where to limit the search for motion
  7041. vectors.
  7042. If desired the search for motion vectors can be limited to a
  7043. rectangular area of the frame defined by its top left corner, width
  7044. and height. These parameters have the same meaning as the drawbox
  7045. filter which can be used to visualise the position of the bounding
  7046. box.
  7047. This is useful when simultaneous movement of subjects within the frame
  7048. might be confused for camera motion by the motion vector search.
  7049. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7050. then the full frame is used. This allows later options to be set
  7051. without specifying the bounding box for the motion vector search.
  7052. Default - search the whole frame.
  7053. @item rx
  7054. @item ry
  7055. Specify the maximum extent of movement in x and y directions in the
  7056. range 0-64 pixels. Default 16.
  7057. @item edge
  7058. Specify how to generate pixels to fill blanks at the edge of the
  7059. frame. Available values are:
  7060. @table @samp
  7061. @item blank, 0
  7062. Fill zeroes at blank locations
  7063. @item original, 1
  7064. Original image at blank locations
  7065. @item clamp, 2
  7066. Extruded edge value at blank locations
  7067. @item mirror, 3
  7068. Mirrored edge at blank locations
  7069. @end table
  7070. Default value is @samp{mirror}.
  7071. @item blocksize
  7072. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7073. default 8.
  7074. @item contrast
  7075. Specify the contrast threshold for blocks. Only blocks with more than
  7076. the specified contrast (difference between darkest and lightest
  7077. pixels) will be considered. Range 1-255, default 125.
  7078. @item search
  7079. Specify the search strategy. Available values are:
  7080. @table @samp
  7081. @item exhaustive, 0
  7082. Set exhaustive search
  7083. @item less, 1
  7084. Set less exhaustive search.
  7085. @end table
  7086. Default value is @samp{exhaustive}.
  7087. @item filename
  7088. If set then a detailed log of the motion search is written to the
  7089. specified file.
  7090. @end table
  7091. @section despill
  7092. Remove unwanted contamination of foreground colors, caused by reflected color of
  7093. greenscreen or bluescreen.
  7094. This filter accepts the following options:
  7095. @table @option
  7096. @item type
  7097. Set what type of despill to use.
  7098. @item mix
  7099. Set how spillmap will be generated.
  7100. @item expand
  7101. Set how much to get rid of still remaining spill.
  7102. @item red
  7103. Controls amount of red in spill area.
  7104. @item green
  7105. Controls amount of green in spill area.
  7106. Should be -1 for greenscreen.
  7107. @item blue
  7108. Controls amount of blue in spill area.
  7109. Should be -1 for bluescreen.
  7110. @item brightness
  7111. Controls brightness of spill area, preserving colors.
  7112. @item alpha
  7113. Modify alpha from generated spillmap.
  7114. @end table
  7115. @section detelecine
  7116. Apply an exact inverse of the telecine operation. It requires a predefined
  7117. pattern specified using the pattern option which must be the same as that passed
  7118. to the telecine filter.
  7119. This filter accepts the following options:
  7120. @table @option
  7121. @item first_field
  7122. @table @samp
  7123. @item top, t
  7124. top field first
  7125. @item bottom, b
  7126. bottom field first
  7127. The default value is @code{top}.
  7128. @end table
  7129. @item pattern
  7130. A string of numbers representing the pulldown pattern you wish to apply.
  7131. The default value is @code{23}.
  7132. @item start_frame
  7133. A number representing position of the first frame with respect to the telecine
  7134. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7135. @end table
  7136. @section dilation
  7137. Apply dilation effect to the video.
  7138. This filter replaces the pixel by the local(3x3) maximum.
  7139. It accepts the following options:
  7140. @table @option
  7141. @item threshold0
  7142. @item threshold1
  7143. @item threshold2
  7144. @item threshold3
  7145. Limit the maximum change for each plane, default is 65535.
  7146. If 0, plane will remain unchanged.
  7147. @item coordinates
  7148. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7149. pixels are used.
  7150. Flags to local 3x3 coordinates maps like this:
  7151. 1 2 3
  7152. 4 5
  7153. 6 7 8
  7154. @end table
  7155. @subsection Commands
  7156. This filter supports the all above options as @ref{commands}.
  7157. @section displace
  7158. Displace pixels as indicated by second and third input stream.
  7159. It takes three input streams and outputs one stream, the first input is the
  7160. source, and second and third input are displacement maps.
  7161. The second input specifies how much to displace pixels along the
  7162. x-axis, while the third input specifies how much to displace pixels
  7163. along the y-axis.
  7164. If one of displacement map streams terminates, last frame from that
  7165. displacement map will be used.
  7166. Note that once generated, displacements maps can be reused over and over again.
  7167. A description of the accepted options follows.
  7168. @table @option
  7169. @item edge
  7170. Set displace behavior for pixels that are out of range.
  7171. Available values are:
  7172. @table @samp
  7173. @item blank
  7174. Missing pixels are replaced by black pixels.
  7175. @item smear
  7176. Adjacent pixels will spread out to replace missing pixels.
  7177. @item wrap
  7178. Out of range pixels are wrapped so they point to pixels of other side.
  7179. @item mirror
  7180. Out of range pixels will be replaced with mirrored pixels.
  7181. @end table
  7182. Default is @samp{smear}.
  7183. @end table
  7184. @subsection Examples
  7185. @itemize
  7186. @item
  7187. Add ripple effect to rgb input of video size hd720:
  7188. @example
  7189. 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
  7190. @end example
  7191. @item
  7192. Add wave effect to rgb input of video size hd720:
  7193. @example
  7194. 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
  7195. @end example
  7196. @end itemize
  7197. @anchor{dnn_processing}
  7198. @section dnn_processing
  7199. Do image processing with deep neural networks. It works together with another filter
  7200. which converts the pixel format of the Frame to what the dnn network requires.
  7201. The filter accepts the following options:
  7202. @table @option
  7203. @item dnn_backend
  7204. Specify which DNN backend to use for model loading and execution. This option accepts
  7205. the following values:
  7206. @table @samp
  7207. @item native
  7208. Native implementation of DNN loading and execution.
  7209. @item tensorflow
  7210. TensorFlow backend. To enable this backend you
  7211. need to install the TensorFlow for C library (see
  7212. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7213. @code{--enable-libtensorflow}
  7214. @item openvino
  7215. OpenVINO backend. To enable this backend you
  7216. need to build and install the OpenVINO for C library (see
  7217. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7218. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7219. be needed if the header files and libraries are not installed into system path)
  7220. @end table
  7221. Default value is @samp{native}.
  7222. @item model
  7223. Set path to model file specifying network architecture and its parameters.
  7224. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7225. backend can load files for only its format.
  7226. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7227. @item input
  7228. Set the input name of the dnn network.
  7229. @item output
  7230. Set the output name of the dnn network.
  7231. @end table
  7232. @subsection Examples
  7233. @itemize
  7234. @item
  7235. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7236. @example
  7237. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7238. @end example
  7239. @item
  7240. Halve the pixel value of the frame with format gray32f:
  7241. @example
  7242. 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
  7243. @end example
  7244. @item
  7245. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7246. @example
  7247. ./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
  7248. @end example
  7249. @item
  7250. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7251. @example
  7252. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7253. @end example
  7254. @end itemize
  7255. @section drawbox
  7256. Draw a colored box on the input image.
  7257. It accepts the following parameters:
  7258. @table @option
  7259. @item x
  7260. @item y
  7261. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7262. @item width, w
  7263. @item height, h
  7264. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7265. the input width and height. It defaults to 0.
  7266. @item color, c
  7267. Specify the color of the box to write. For the general syntax of this option,
  7268. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7269. value @code{invert} is used, the box edge color is the same as the
  7270. video with inverted luma.
  7271. @item thickness, t
  7272. The expression which sets the thickness of the box edge.
  7273. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7274. See below for the list of accepted constants.
  7275. @item replace
  7276. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7277. will overwrite the video's color and alpha pixels.
  7278. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7279. @end table
  7280. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7281. following constants:
  7282. @table @option
  7283. @item dar
  7284. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7285. @item hsub
  7286. @item vsub
  7287. horizontal and vertical chroma subsample values. For example for the
  7288. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7289. @item in_h, ih
  7290. @item in_w, iw
  7291. The input width and height.
  7292. @item sar
  7293. The input sample aspect ratio.
  7294. @item x
  7295. @item y
  7296. The x and y offset coordinates where the box is drawn.
  7297. @item w
  7298. @item h
  7299. The width and height of the drawn box.
  7300. @item t
  7301. The thickness of the drawn box.
  7302. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7303. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7304. @end table
  7305. @subsection Examples
  7306. @itemize
  7307. @item
  7308. Draw a black box around the edge of the input image:
  7309. @example
  7310. drawbox
  7311. @end example
  7312. @item
  7313. Draw a box with color red and an opacity of 50%:
  7314. @example
  7315. drawbox=10:20:200:60:red@@0.5
  7316. @end example
  7317. The previous example can be specified as:
  7318. @example
  7319. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7320. @end example
  7321. @item
  7322. Fill the box with pink color:
  7323. @example
  7324. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7325. @end example
  7326. @item
  7327. Draw a 2-pixel red 2.40:1 mask:
  7328. @example
  7329. 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
  7330. @end example
  7331. @end itemize
  7332. @subsection Commands
  7333. This filter supports same commands as options.
  7334. The command accepts the same syntax of the corresponding option.
  7335. If the specified expression is not valid, it is kept at its current
  7336. value.
  7337. @anchor{drawgraph}
  7338. @section drawgraph
  7339. Draw a graph using input video metadata.
  7340. It accepts the following parameters:
  7341. @table @option
  7342. @item m1
  7343. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7344. @item fg1
  7345. Set 1st foreground color expression.
  7346. @item m2
  7347. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7348. @item fg2
  7349. Set 2nd foreground color expression.
  7350. @item m3
  7351. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7352. @item fg3
  7353. Set 3rd foreground color expression.
  7354. @item m4
  7355. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7356. @item fg4
  7357. Set 4th foreground color expression.
  7358. @item min
  7359. Set minimal value of metadata value.
  7360. @item max
  7361. Set maximal value of metadata value.
  7362. @item bg
  7363. Set graph background color. Default is white.
  7364. @item mode
  7365. Set graph mode.
  7366. Available values for mode is:
  7367. @table @samp
  7368. @item bar
  7369. @item dot
  7370. @item line
  7371. @end table
  7372. Default is @code{line}.
  7373. @item slide
  7374. Set slide mode.
  7375. Available values for slide is:
  7376. @table @samp
  7377. @item frame
  7378. Draw new frame when right border is reached.
  7379. @item replace
  7380. Replace old columns with new ones.
  7381. @item scroll
  7382. Scroll from right to left.
  7383. @item rscroll
  7384. Scroll from left to right.
  7385. @item picture
  7386. Draw single picture.
  7387. @end table
  7388. Default is @code{frame}.
  7389. @item size
  7390. Set size of graph video. For the syntax of this option, check the
  7391. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7392. The default value is @code{900x256}.
  7393. @item rate, r
  7394. Set the output frame rate. Default value is @code{25}.
  7395. The foreground color expressions can use the following variables:
  7396. @table @option
  7397. @item MIN
  7398. Minimal value of metadata value.
  7399. @item MAX
  7400. Maximal value of metadata value.
  7401. @item VAL
  7402. Current metadata key value.
  7403. @end table
  7404. The color is defined as 0xAABBGGRR.
  7405. @end table
  7406. Example using metadata from @ref{signalstats} filter:
  7407. @example
  7408. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7409. @end example
  7410. Example using metadata from @ref{ebur128} filter:
  7411. @example
  7412. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7413. @end example
  7414. @section drawgrid
  7415. Draw a grid on the input image.
  7416. It accepts the following parameters:
  7417. @table @option
  7418. @item x
  7419. @item y
  7420. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7421. @item width, w
  7422. @item height, h
  7423. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7424. input width and height, respectively, minus @code{thickness}, so image gets
  7425. framed. Default to 0.
  7426. @item color, c
  7427. Specify the color of the grid. For the general syntax of this option,
  7428. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7429. value @code{invert} is used, the grid color is the same as the
  7430. video with inverted luma.
  7431. @item thickness, t
  7432. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7433. See below for the list of accepted constants.
  7434. @item replace
  7435. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7436. will overwrite the video's color and alpha pixels.
  7437. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7438. @end table
  7439. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7440. following constants:
  7441. @table @option
  7442. @item dar
  7443. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7444. @item hsub
  7445. @item vsub
  7446. horizontal and vertical chroma subsample values. For example for the
  7447. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7448. @item in_h, ih
  7449. @item in_w, iw
  7450. The input grid cell width and height.
  7451. @item sar
  7452. The input sample aspect ratio.
  7453. @item x
  7454. @item y
  7455. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7456. @item w
  7457. @item h
  7458. The width and height of the drawn cell.
  7459. @item t
  7460. The thickness of the drawn cell.
  7461. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7462. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7463. @end table
  7464. @subsection Examples
  7465. @itemize
  7466. @item
  7467. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7468. @example
  7469. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7470. @end example
  7471. @item
  7472. Draw a white 3x3 grid with an opacity of 50%:
  7473. @example
  7474. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7475. @end example
  7476. @end itemize
  7477. @subsection Commands
  7478. This filter supports same commands as options.
  7479. The command accepts the same syntax of the corresponding option.
  7480. If the specified expression is not valid, it is kept at its current
  7481. value.
  7482. @anchor{drawtext}
  7483. @section drawtext
  7484. Draw a text string or text from a specified file on top of a video, using the
  7485. libfreetype library.
  7486. To enable compilation of this filter, you need to configure FFmpeg with
  7487. @code{--enable-libfreetype}.
  7488. To enable default font fallback and the @var{font} option you need to
  7489. configure FFmpeg with @code{--enable-libfontconfig}.
  7490. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7491. @code{--enable-libfribidi}.
  7492. @subsection Syntax
  7493. It accepts the following parameters:
  7494. @table @option
  7495. @item box
  7496. Used to draw a box around text using the background color.
  7497. The value must be either 1 (enable) or 0 (disable).
  7498. The default value of @var{box} is 0.
  7499. @item boxborderw
  7500. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7501. The default value of @var{boxborderw} is 0.
  7502. @item boxcolor
  7503. The color to be used for drawing box around text. For the syntax of this
  7504. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7505. The default value of @var{boxcolor} is "white".
  7506. @item line_spacing
  7507. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7508. The default value of @var{line_spacing} is 0.
  7509. @item borderw
  7510. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7511. The default value of @var{borderw} is 0.
  7512. @item bordercolor
  7513. Set the color to be used for drawing border around text. For the syntax of this
  7514. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7515. The default value of @var{bordercolor} is "black".
  7516. @item expansion
  7517. Select how the @var{text} is expanded. Can be either @code{none},
  7518. @code{strftime} (deprecated) or
  7519. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7520. below for details.
  7521. @item basetime
  7522. Set a start time for the count. Value is in microseconds. Only applied
  7523. in the deprecated strftime expansion mode. To emulate in normal expansion
  7524. mode use the @code{pts} function, supplying the start time (in seconds)
  7525. as the second argument.
  7526. @item fix_bounds
  7527. If true, check and fix text coords to avoid clipping.
  7528. @item fontcolor
  7529. The color to be used for drawing fonts. For the syntax of this option, check
  7530. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7531. The default value of @var{fontcolor} is "black".
  7532. @item fontcolor_expr
  7533. String which is expanded the same way as @var{text} to obtain dynamic
  7534. @var{fontcolor} value. By default this option has empty value and is not
  7535. processed. When this option is set, it overrides @var{fontcolor} option.
  7536. @item font
  7537. The font family to be used for drawing text. By default Sans.
  7538. @item fontfile
  7539. The font file to be used for drawing text. The path must be included.
  7540. This parameter is mandatory if the fontconfig support is disabled.
  7541. @item alpha
  7542. Draw the text applying alpha blending. The value can
  7543. be a number between 0.0 and 1.0.
  7544. The expression accepts the same variables @var{x, y} as well.
  7545. The default value is 1.
  7546. Please see @var{fontcolor_expr}.
  7547. @item fontsize
  7548. The font size to be used for drawing text.
  7549. The default value of @var{fontsize} is 16.
  7550. @item text_shaping
  7551. If set to 1, attempt to shape the text (for example, reverse the order of
  7552. right-to-left text and join Arabic characters) before drawing it.
  7553. Otherwise, just draw the text exactly as given.
  7554. By default 1 (if supported).
  7555. @item ft_load_flags
  7556. The flags to be used for loading the fonts.
  7557. The flags map the corresponding flags supported by libfreetype, and are
  7558. a combination of the following values:
  7559. @table @var
  7560. @item default
  7561. @item no_scale
  7562. @item no_hinting
  7563. @item render
  7564. @item no_bitmap
  7565. @item vertical_layout
  7566. @item force_autohint
  7567. @item crop_bitmap
  7568. @item pedantic
  7569. @item ignore_global_advance_width
  7570. @item no_recurse
  7571. @item ignore_transform
  7572. @item monochrome
  7573. @item linear_design
  7574. @item no_autohint
  7575. @end table
  7576. Default value is "default".
  7577. For more information consult the documentation for the FT_LOAD_*
  7578. libfreetype flags.
  7579. @item shadowcolor
  7580. The color to be used for drawing a shadow behind the drawn text. For the
  7581. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7582. ffmpeg-utils manual,ffmpeg-utils}.
  7583. The default value of @var{shadowcolor} is "black".
  7584. @item shadowx
  7585. @item shadowy
  7586. The x and y offsets for the text shadow position with respect to the
  7587. position of the text. They can be either positive or negative
  7588. values. The default value for both is "0".
  7589. @item start_number
  7590. The starting frame number for the n/frame_num variable. The default value
  7591. is "0".
  7592. @item tabsize
  7593. The size in number of spaces to use for rendering the tab.
  7594. Default value is 4.
  7595. @item timecode
  7596. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7597. format. It can be used with or without text parameter. @var{timecode_rate}
  7598. option must be specified.
  7599. @item timecode_rate, rate, r
  7600. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7601. integer. Minimum value is "1".
  7602. Drop-frame timecode is supported for frame rates 30 & 60.
  7603. @item tc24hmax
  7604. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7605. Default is 0 (disabled).
  7606. @item text
  7607. The text string to be drawn. The text must be a sequence of UTF-8
  7608. encoded characters.
  7609. This parameter is mandatory if no file is specified with the parameter
  7610. @var{textfile}.
  7611. @item textfile
  7612. A text file containing text to be drawn. The text must be a sequence
  7613. of UTF-8 encoded characters.
  7614. This parameter is mandatory if no text string is specified with the
  7615. parameter @var{text}.
  7616. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7617. @item reload
  7618. If set to 1, the @var{textfile} will be reloaded before each frame.
  7619. Be sure to update it atomically, or it may be read partially, or even fail.
  7620. @item x
  7621. @item y
  7622. The expressions which specify the offsets where text will be drawn
  7623. within the video frame. They are relative to the top/left border of the
  7624. output image.
  7625. The default value of @var{x} and @var{y} is "0".
  7626. See below for the list of accepted constants and functions.
  7627. @end table
  7628. The parameters for @var{x} and @var{y} are expressions containing the
  7629. following constants and functions:
  7630. @table @option
  7631. @item dar
  7632. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7633. @item hsub
  7634. @item vsub
  7635. horizontal and vertical chroma subsample values. For example for the
  7636. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7637. @item line_h, lh
  7638. the height of each text line
  7639. @item main_h, h, H
  7640. the input height
  7641. @item main_w, w, W
  7642. the input width
  7643. @item max_glyph_a, ascent
  7644. the maximum distance from the baseline to the highest/upper grid
  7645. coordinate used to place a glyph outline point, for all the rendered
  7646. glyphs.
  7647. It is a positive value, due to the grid's orientation with the Y axis
  7648. upwards.
  7649. @item max_glyph_d, descent
  7650. the maximum distance from the baseline to the lowest grid coordinate
  7651. used to place a glyph outline point, for all the rendered glyphs.
  7652. This is a negative value, due to the grid's orientation, with the Y axis
  7653. upwards.
  7654. @item max_glyph_h
  7655. maximum glyph height, that is the maximum height for all the glyphs
  7656. contained in the rendered text, it is equivalent to @var{ascent} -
  7657. @var{descent}.
  7658. @item max_glyph_w
  7659. maximum glyph width, that is the maximum width for all the glyphs
  7660. contained in the rendered text
  7661. @item n
  7662. the number of input frame, starting from 0
  7663. @item rand(min, max)
  7664. return a random number included between @var{min} and @var{max}
  7665. @item sar
  7666. The input sample aspect ratio.
  7667. @item t
  7668. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7669. @item text_h, th
  7670. the height of the rendered text
  7671. @item text_w, tw
  7672. the width of the rendered text
  7673. @item x
  7674. @item y
  7675. the x and y offset coordinates where the text is drawn.
  7676. These parameters allow the @var{x} and @var{y} expressions to refer
  7677. to each other, so you can for example specify @code{y=x/dar}.
  7678. @item pict_type
  7679. A one character description of the current frame's picture type.
  7680. @item pkt_pos
  7681. The current packet's position in the input file or stream
  7682. (in bytes, from the start of the input). A value of -1 indicates
  7683. this info is not available.
  7684. @item pkt_duration
  7685. The current packet's duration, in seconds.
  7686. @item pkt_size
  7687. The current packet's size (in bytes).
  7688. @end table
  7689. @anchor{drawtext_expansion}
  7690. @subsection Text expansion
  7691. If @option{expansion} is set to @code{strftime},
  7692. the filter recognizes strftime() sequences in the provided text and
  7693. expands them accordingly. Check the documentation of strftime(). This
  7694. feature is deprecated.
  7695. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7696. If @option{expansion} is set to @code{normal} (which is the default),
  7697. the following expansion mechanism is used.
  7698. The backslash character @samp{\}, followed by any character, always expands to
  7699. the second character.
  7700. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7701. braces is a function name, possibly followed by arguments separated by ':'.
  7702. If the arguments contain special characters or delimiters (':' or '@}'),
  7703. they should be escaped.
  7704. Note that they probably must also be escaped as the value for the
  7705. @option{text} option in the filter argument string and as the filter
  7706. argument in the filtergraph description, and possibly also for the shell,
  7707. that makes up to four levels of escaping; using a text file avoids these
  7708. problems.
  7709. The following functions are available:
  7710. @table @command
  7711. @item expr, e
  7712. The expression evaluation result.
  7713. It must take one argument specifying the expression to be evaluated,
  7714. which accepts the same constants and functions as the @var{x} and
  7715. @var{y} values. Note that not all constants should be used, for
  7716. example the text size is not known when evaluating the expression, so
  7717. the constants @var{text_w} and @var{text_h} will have an undefined
  7718. value.
  7719. @item expr_int_format, eif
  7720. Evaluate the expression's value and output as formatted integer.
  7721. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7722. The second argument specifies the output format. Allowed values are @samp{x},
  7723. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7724. @code{printf} function.
  7725. The third parameter is optional and sets the number of positions taken by the output.
  7726. It can be used to add padding with zeros from the left.
  7727. @item gmtime
  7728. The time at which the filter is running, expressed in UTC.
  7729. It can accept an argument: a strftime() format string.
  7730. @item localtime
  7731. The time at which the filter is running, expressed in the local time zone.
  7732. It can accept an argument: a strftime() format string.
  7733. @item metadata
  7734. Frame metadata. Takes one or two arguments.
  7735. The first argument is mandatory and specifies the metadata key.
  7736. The second argument is optional and specifies a default value, used when the
  7737. metadata key is not found or empty.
  7738. Available metadata can be identified by inspecting entries
  7739. starting with TAG included within each frame section
  7740. printed by running @code{ffprobe -show_frames}.
  7741. String metadata generated in filters leading to
  7742. the drawtext filter are also available.
  7743. @item n, frame_num
  7744. The frame number, starting from 0.
  7745. @item pict_type
  7746. A one character description of the current picture type.
  7747. @item pts
  7748. The timestamp of the current frame.
  7749. It can take up to three arguments.
  7750. The first argument is the format of the timestamp; it defaults to @code{flt}
  7751. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7752. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7753. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7754. @code{localtime} stands for the timestamp of the frame formatted as
  7755. local time zone time.
  7756. The second argument is an offset added to the timestamp.
  7757. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7758. supplied to present the hour part of the formatted timestamp in 24h format
  7759. (00-23).
  7760. If the format is set to @code{localtime} or @code{gmtime},
  7761. a third argument may be supplied: a strftime() format string.
  7762. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7763. @end table
  7764. @subsection Commands
  7765. This filter supports altering parameters via commands:
  7766. @table @option
  7767. @item reinit
  7768. Alter existing filter parameters.
  7769. Syntax for the argument is the same as for filter invocation, e.g.
  7770. @example
  7771. fontsize=56:fontcolor=green:text='Hello World'
  7772. @end example
  7773. Full filter invocation with sendcmd would look like this:
  7774. @example
  7775. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7776. @end example
  7777. @end table
  7778. If the entire argument can't be parsed or applied as valid values then the filter will
  7779. continue with its existing parameters.
  7780. @subsection Examples
  7781. @itemize
  7782. @item
  7783. Draw "Test Text" with font FreeSerif, using the default values for the
  7784. optional parameters.
  7785. @example
  7786. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7787. @end example
  7788. @item
  7789. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7790. and y=50 (counting from the top-left corner of the screen), text is
  7791. yellow with a red box around it. Both the text and the box have an
  7792. opacity of 20%.
  7793. @example
  7794. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7795. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7796. @end example
  7797. Note that the double quotes are not necessary if spaces are not used
  7798. within the parameter list.
  7799. @item
  7800. Show the text at the center of the video frame:
  7801. @example
  7802. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7803. @end example
  7804. @item
  7805. Show the text at a random position, switching to a new position every 30 seconds:
  7806. @example
  7807. 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)"
  7808. @end example
  7809. @item
  7810. Show a text line sliding from right to left in the last row of the video
  7811. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7812. with no newlines.
  7813. @example
  7814. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7815. @end example
  7816. @item
  7817. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7818. @example
  7819. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7820. @end example
  7821. @item
  7822. Draw a single green letter "g", at the center of the input video.
  7823. The glyph baseline is placed at half screen height.
  7824. @example
  7825. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7826. @end example
  7827. @item
  7828. Show text for 1 second every 3 seconds:
  7829. @example
  7830. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7831. @end example
  7832. @item
  7833. Use fontconfig to set the font. Note that the colons need to be escaped.
  7834. @example
  7835. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7836. @end example
  7837. @item
  7838. Draw "Test Text" with font size dependent on height of the video.
  7839. @example
  7840. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  7841. @end example
  7842. @item
  7843. Print the date of a real-time encoding (see strftime(3)):
  7844. @example
  7845. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7846. @end example
  7847. @item
  7848. Show text fading in and out (appearing/disappearing):
  7849. @example
  7850. #!/bin/sh
  7851. DS=1.0 # display start
  7852. DE=10.0 # display end
  7853. FID=1.5 # fade in duration
  7854. FOD=5 # fade out duration
  7855. 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 @}"
  7856. @end example
  7857. @item
  7858. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7859. and the @option{fontsize} value are included in the @option{y} offset.
  7860. @example
  7861. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7862. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7863. @end example
  7864. @item
  7865. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7866. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7867. must have option @option{-export_path_metadata 1} for the special metadata fields
  7868. to be available for filters.
  7869. @example
  7870. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7871. @end example
  7872. @end itemize
  7873. For more information about libfreetype, check:
  7874. @url{http://www.freetype.org/}.
  7875. For more information about fontconfig, check:
  7876. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7877. For more information about libfribidi, check:
  7878. @url{http://fribidi.org/}.
  7879. @section edgedetect
  7880. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7881. The filter accepts the following options:
  7882. @table @option
  7883. @item low
  7884. @item high
  7885. Set low and high threshold values used by the Canny thresholding
  7886. algorithm.
  7887. The high threshold selects the "strong" edge pixels, which are then
  7888. connected through 8-connectivity with the "weak" edge pixels selected
  7889. by the low threshold.
  7890. @var{low} and @var{high} threshold values must be chosen in the range
  7891. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7892. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7893. is @code{50/255}.
  7894. @item mode
  7895. Define the drawing mode.
  7896. @table @samp
  7897. @item wires
  7898. Draw white/gray wires on black background.
  7899. @item colormix
  7900. Mix the colors to create a paint/cartoon effect.
  7901. @item canny
  7902. Apply Canny edge detector on all selected planes.
  7903. @end table
  7904. Default value is @var{wires}.
  7905. @item planes
  7906. Select planes for filtering. By default all available planes are filtered.
  7907. @end table
  7908. @subsection Examples
  7909. @itemize
  7910. @item
  7911. Standard edge detection with custom values for the hysteresis thresholding:
  7912. @example
  7913. edgedetect=low=0.1:high=0.4
  7914. @end example
  7915. @item
  7916. Painting effect without thresholding:
  7917. @example
  7918. edgedetect=mode=colormix:high=0
  7919. @end example
  7920. @end itemize
  7921. @section elbg
  7922. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7923. For each input image, the filter will compute the optimal mapping from
  7924. the input to the output given the codebook length, that is the number
  7925. of distinct output colors.
  7926. This filter accepts the following options.
  7927. @table @option
  7928. @item codebook_length, l
  7929. Set codebook length. The value must be a positive integer, and
  7930. represents the number of distinct output colors. Default value is 256.
  7931. @item nb_steps, n
  7932. Set the maximum number of iterations to apply for computing the optimal
  7933. mapping. The higher the value the better the result and the higher the
  7934. computation time. Default value is 1.
  7935. @item seed, s
  7936. Set a random seed, must be an integer included between 0 and
  7937. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7938. will try to use a good random seed on a best effort basis.
  7939. @item pal8
  7940. Set pal8 output pixel format. This option does not work with codebook
  7941. length greater than 256.
  7942. @end table
  7943. @section entropy
  7944. Measure graylevel entropy in histogram of color channels of video frames.
  7945. It accepts the following parameters:
  7946. @table @option
  7947. @item mode
  7948. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7949. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7950. between neighbour histogram values.
  7951. @end table
  7952. @section eq
  7953. Set brightness, contrast, saturation and approximate gamma adjustment.
  7954. The filter accepts the following options:
  7955. @table @option
  7956. @item contrast
  7957. Set the contrast expression. The value must be a float value in range
  7958. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7959. @item brightness
  7960. Set the brightness expression. The value must be a float value in
  7961. range @code{-1.0} to @code{1.0}. The default value is "0".
  7962. @item saturation
  7963. Set the saturation expression. The value must be a float in
  7964. range @code{0.0} to @code{3.0}. The default value is "1".
  7965. @item gamma
  7966. Set the gamma expression. The value must be a float in range
  7967. @code{0.1} to @code{10.0}. The default value is "1".
  7968. @item gamma_r
  7969. Set the gamma expression for red. The value must be a float in
  7970. range @code{0.1} to @code{10.0}. The default value is "1".
  7971. @item gamma_g
  7972. Set the gamma expression for green. The value must be a float in range
  7973. @code{0.1} to @code{10.0}. The default value is "1".
  7974. @item gamma_b
  7975. Set the gamma expression for blue. The value must be a float in range
  7976. @code{0.1} to @code{10.0}. The default value is "1".
  7977. @item gamma_weight
  7978. Set the gamma weight expression. It can be used to reduce the effect
  7979. of a high gamma value on bright image areas, e.g. keep them from
  7980. getting overamplified and just plain white. The value must be a float
  7981. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7982. gamma correction all the way down while @code{1.0} leaves it at its
  7983. full strength. Default is "1".
  7984. @item eval
  7985. Set when the expressions for brightness, contrast, saturation and
  7986. gamma expressions are evaluated.
  7987. It accepts the following values:
  7988. @table @samp
  7989. @item init
  7990. only evaluate expressions once during the filter initialization or
  7991. when a command is processed
  7992. @item frame
  7993. evaluate expressions for each incoming frame
  7994. @end table
  7995. Default value is @samp{init}.
  7996. @end table
  7997. The expressions accept the following parameters:
  7998. @table @option
  7999. @item n
  8000. frame count of the input frame starting from 0
  8001. @item pos
  8002. byte position of the corresponding packet in the input file, NAN if
  8003. unspecified
  8004. @item r
  8005. frame rate of the input video, NAN if the input frame rate is unknown
  8006. @item t
  8007. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8008. @end table
  8009. @subsection Commands
  8010. The filter supports the following commands:
  8011. @table @option
  8012. @item contrast
  8013. Set the contrast expression.
  8014. @item brightness
  8015. Set the brightness expression.
  8016. @item saturation
  8017. Set the saturation expression.
  8018. @item gamma
  8019. Set the gamma expression.
  8020. @item gamma_r
  8021. Set the gamma_r expression.
  8022. @item gamma_g
  8023. Set gamma_g expression.
  8024. @item gamma_b
  8025. Set gamma_b expression.
  8026. @item gamma_weight
  8027. Set gamma_weight expression.
  8028. The command accepts the same syntax of the corresponding option.
  8029. If the specified expression is not valid, it is kept at its current
  8030. value.
  8031. @end table
  8032. @section erosion
  8033. Apply erosion effect to the video.
  8034. This filter replaces the pixel by the local(3x3) minimum.
  8035. It accepts the following options:
  8036. @table @option
  8037. @item threshold0
  8038. @item threshold1
  8039. @item threshold2
  8040. @item threshold3
  8041. Limit the maximum change for each plane, default is 65535.
  8042. If 0, plane will remain unchanged.
  8043. @item coordinates
  8044. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8045. pixels are used.
  8046. Flags to local 3x3 coordinates maps like this:
  8047. 1 2 3
  8048. 4 5
  8049. 6 7 8
  8050. @end table
  8051. @subsection Commands
  8052. This filter supports the all above options as @ref{commands}.
  8053. @section extractplanes
  8054. Extract color channel components from input video stream into
  8055. separate grayscale video streams.
  8056. The filter accepts the following option:
  8057. @table @option
  8058. @item planes
  8059. Set plane(s) to extract.
  8060. Available values for planes are:
  8061. @table @samp
  8062. @item y
  8063. @item u
  8064. @item v
  8065. @item a
  8066. @item r
  8067. @item g
  8068. @item b
  8069. @end table
  8070. Choosing planes not available in the input will result in an error.
  8071. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8072. with @code{y}, @code{u}, @code{v} planes at same time.
  8073. @end table
  8074. @subsection Examples
  8075. @itemize
  8076. @item
  8077. Extract luma, u and v color channel component from input video frame
  8078. into 3 grayscale outputs:
  8079. @example
  8080. 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
  8081. @end example
  8082. @end itemize
  8083. @section fade
  8084. Apply a fade-in/out effect to the input video.
  8085. It accepts the following parameters:
  8086. @table @option
  8087. @item type, t
  8088. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8089. effect.
  8090. Default is @code{in}.
  8091. @item start_frame, s
  8092. Specify the number of the frame to start applying the fade
  8093. effect at. Default is 0.
  8094. @item nb_frames, n
  8095. The number of frames that the fade effect lasts. At the end of the
  8096. fade-in effect, the output video will have the same intensity as the input video.
  8097. At the end of the fade-out transition, the output video will be filled with the
  8098. selected @option{color}.
  8099. Default is 25.
  8100. @item alpha
  8101. If set to 1, fade only alpha channel, if one exists on the input.
  8102. Default value is 0.
  8103. @item start_time, st
  8104. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8105. effect. If both start_frame and start_time are specified, the fade will start at
  8106. whichever comes last. Default is 0.
  8107. @item duration, d
  8108. The number of seconds for which the fade effect has to last. At the end of the
  8109. fade-in effect the output video will have the same intensity as the input video,
  8110. at the end of the fade-out transition the output video will be filled with the
  8111. selected @option{color}.
  8112. If both duration and nb_frames are specified, duration is used. Default is 0
  8113. (nb_frames is used by default).
  8114. @item color, c
  8115. Specify the color of the fade. Default is "black".
  8116. @end table
  8117. @subsection Examples
  8118. @itemize
  8119. @item
  8120. Fade in the first 30 frames of video:
  8121. @example
  8122. fade=in:0:30
  8123. @end example
  8124. The command above is equivalent to:
  8125. @example
  8126. fade=t=in:s=0:n=30
  8127. @end example
  8128. @item
  8129. Fade out the last 45 frames of a 200-frame video:
  8130. @example
  8131. fade=out:155:45
  8132. fade=type=out:start_frame=155:nb_frames=45
  8133. @end example
  8134. @item
  8135. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8136. @example
  8137. fade=in:0:25, fade=out:975:25
  8138. @end example
  8139. @item
  8140. Make the first 5 frames yellow, then fade in from frame 5-24:
  8141. @example
  8142. fade=in:5:20:color=yellow
  8143. @end example
  8144. @item
  8145. Fade in alpha over first 25 frames of video:
  8146. @example
  8147. fade=in:0:25:alpha=1
  8148. @end example
  8149. @item
  8150. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8151. @example
  8152. fade=t=in:st=5.5:d=0.5
  8153. @end example
  8154. @end itemize
  8155. @section fftdnoiz
  8156. Denoise frames using 3D FFT (frequency domain filtering).
  8157. The filter accepts the following options:
  8158. @table @option
  8159. @item sigma
  8160. Set the noise sigma constant. This sets denoising strength.
  8161. Default value is 1. Allowed range is from 0 to 30.
  8162. Using very high sigma with low overlap may give blocking artifacts.
  8163. @item amount
  8164. Set amount of denoising. By default all detected noise is reduced.
  8165. Default value is 1. Allowed range is from 0 to 1.
  8166. @item block
  8167. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8168. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8169. block size in pixels is 2^4 which is 16.
  8170. @item overlap
  8171. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8172. @item prev
  8173. Set number of previous frames to use for denoising. By default is set to 0.
  8174. @item next
  8175. Set number of next frames to to use for denoising. By default is set to 0.
  8176. @item planes
  8177. Set planes which will be filtered, by default are all available filtered
  8178. except alpha.
  8179. @end table
  8180. @section fftfilt
  8181. Apply arbitrary expressions to samples in frequency domain
  8182. @table @option
  8183. @item dc_Y
  8184. Adjust the dc value (gain) of the luma plane of the image. The filter
  8185. accepts an integer value in range @code{0} to @code{1000}. The default
  8186. value is set to @code{0}.
  8187. @item dc_U
  8188. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8189. filter accepts an integer value in range @code{0} to @code{1000}. The
  8190. default value is set to @code{0}.
  8191. @item dc_V
  8192. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8193. filter accepts an integer value in range @code{0} to @code{1000}. The
  8194. default value is set to @code{0}.
  8195. @item weight_Y
  8196. Set the frequency domain weight expression for the luma plane.
  8197. @item weight_U
  8198. Set the frequency domain weight expression for the 1st chroma plane.
  8199. @item weight_V
  8200. Set the frequency domain weight expression for the 2nd chroma plane.
  8201. @item eval
  8202. Set when the expressions are evaluated.
  8203. It accepts the following values:
  8204. @table @samp
  8205. @item init
  8206. Only evaluate expressions once during the filter initialization.
  8207. @item frame
  8208. Evaluate expressions for each incoming frame.
  8209. @end table
  8210. Default value is @samp{init}.
  8211. The filter accepts the following variables:
  8212. @item X
  8213. @item Y
  8214. The coordinates of the current sample.
  8215. @item W
  8216. @item H
  8217. The width and height of the image.
  8218. @item N
  8219. The number of input frame, starting from 0.
  8220. @end table
  8221. @subsection Examples
  8222. @itemize
  8223. @item
  8224. High-pass:
  8225. @example
  8226. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8227. @end example
  8228. @item
  8229. Low-pass:
  8230. @example
  8231. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8232. @end example
  8233. @item
  8234. Sharpen:
  8235. @example
  8236. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8237. @end example
  8238. @item
  8239. Blur:
  8240. @example
  8241. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8242. @end example
  8243. @end itemize
  8244. @section field
  8245. Extract a single field from an interlaced image using stride
  8246. arithmetic to avoid wasting CPU time. The output frames are marked as
  8247. non-interlaced.
  8248. The filter accepts the following options:
  8249. @table @option
  8250. @item type
  8251. Specify whether to extract the top (if the value is @code{0} or
  8252. @code{top}) or the bottom field (if the value is @code{1} or
  8253. @code{bottom}).
  8254. @end table
  8255. @section fieldhint
  8256. Create new frames by copying the top and bottom fields from surrounding frames
  8257. supplied as numbers by the hint file.
  8258. @table @option
  8259. @item hint
  8260. Set file containing hints: absolute/relative frame numbers.
  8261. There must be one line for each frame in a clip. Each line must contain two
  8262. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8263. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8264. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8265. for @code{relative} mode. First number tells from which frame to pick up top
  8266. field and second number tells from which frame to pick up bottom field.
  8267. If optionally followed by @code{+} output frame will be marked as interlaced,
  8268. else if followed by @code{-} output frame will be marked as progressive, else
  8269. it will be marked same as input frame.
  8270. If optionally followed by @code{t} output frame will use only top field, or in
  8271. case of @code{b} it will use only bottom field.
  8272. If line starts with @code{#} or @code{;} that line is skipped.
  8273. @item mode
  8274. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8275. @end table
  8276. Example of first several lines of @code{hint} file for @code{relative} mode:
  8277. @example
  8278. 0,0 - # first frame
  8279. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8280. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8281. 1,0 -
  8282. 0,0 -
  8283. 0,0 -
  8284. 1,0 -
  8285. 1,0 -
  8286. 1,0 -
  8287. 0,0 -
  8288. 0,0 -
  8289. 1,0 -
  8290. 1,0 -
  8291. 1,0 -
  8292. 0,0 -
  8293. @end example
  8294. @section fieldmatch
  8295. Field matching filter for inverse telecine. It is meant to reconstruct the
  8296. progressive frames from a telecined stream. The filter does not drop duplicated
  8297. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8298. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8299. The separation of the field matching and the decimation is notably motivated by
  8300. the possibility of inserting a de-interlacing filter fallback between the two.
  8301. If the source has mixed telecined and real interlaced content,
  8302. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8303. But these remaining combed frames will be marked as interlaced, and thus can be
  8304. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8305. In addition to the various configuration options, @code{fieldmatch} can take an
  8306. optional second stream, activated through the @option{ppsrc} option. If
  8307. enabled, the frames reconstruction will be based on the fields and frames from
  8308. this second stream. This allows the first input to be pre-processed in order to
  8309. help the various algorithms of the filter, while keeping the output lossless
  8310. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8311. or brightness/contrast adjustments can help.
  8312. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8313. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8314. which @code{fieldmatch} is based on. While the semantic and usage are very
  8315. close, some behaviour and options names can differ.
  8316. The @ref{decimate} filter currently only works for constant frame rate input.
  8317. If your input has mixed telecined (30fps) and progressive content with a lower
  8318. framerate like 24fps use the following filterchain to produce the necessary cfr
  8319. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8320. The filter accepts the following options:
  8321. @table @option
  8322. @item order
  8323. Specify the assumed field order of the input stream. Available values are:
  8324. @table @samp
  8325. @item auto
  8326. Auto detect parity (use FFmpeg's internal parity value).
  8327. @item bff
  8328. Assume bottom field first.
  8329. @item tff
  8330. Assume top field first.
  8331. @end table
  8332. Note that it is sometimes recommended not to trust the parity announced by the
  8333. stream.
  8334. Default value is @var{auto}.
  8335. @item mode
  8336. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8337. sense that it won't risk creating jerkiness due to duplicate frames when
  8338. possible, but if there are bad edits or blended fields it will end up
  8339. outputting combed frames when a good match might actually exist. On the other
  8340. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8341. but will almost always find a good frame if there is one. The other values are
  8342. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8343. jerkiness and creating duplicate frames versus finding good matches in sections
  8344. with bad edits, orphaned fields, blended fields, etc.
  8345. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8346. Available values are:
  8347. @table @samp
  8348. @item pc
  8349. 2-way matching (p/c)
  8350. @item pc_n
  8351. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8352. @item pc_u
  8353. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8354. @item pc_n_ub
  8355. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8356. still combed (p/c + n + u/b)
  8357. @item pcn
  8358. 3-way matching (p/c/n)
  8359. @item pcn_ub
  8360. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8361. detected as combed (p/c/n + u/b)
  8362. @end table
  8363. The parenthesis at the end indicate the matches that would be used for that
  8364. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8365. @var{top}).
  8366. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8367. the slowest.
  8368. Default value is @var{pc_n}.
  8369. @item ppsrc
  8370. Mark the main input stream as a pre-processed input, and enable the secondary
  8371. input stream as the clean source to pick the fields from. See the filter
  8372. introduction for more details. It is similar to the @option{clip2} feature from
  8373. VFM/TFM.
  8374. Default value is @code{0} (disabled).
  8375. @item field
  8376. Set the field to match from. It is recommended to set this to the same value as
  8377. @option{order} unless you experience matching failures with that setting. In
  8378. certain circumstances changing the field that is used to match from can have a
  8379. large impact on matching performance. Available values are:
  8380. @table @samp
  8381. @item auto
  8382. Automatic (same value as @option{order}).
  8383. @item bottom
  8384. Match from the bottom field.
  8385. @item top
  8386. Match from the top field.
  8387. @end table
  8388. Default value is @var{auto}.
  8389. @item mchroma
  8390. Set whether or not chroma is included during the match comparisons. In most
  8391. cases it is recommended to leave this enabled. You should set this to @code{0}
  8392. only if your clip has bad chroma problems such as heavy rainbowing or other
  8393. artifacts. Setting this to @code{0} could also be used to speed things up at
  8394. the cost of some accuracy.
  8395. Default value is @code{1}.
  8396. @item y0
  8397. @item y1
  8398. These define an exclusion band which excludes the lines between @option{y0} and
  8399. @option{y1} from being included in the field matching decision. An exclusion
  8400. band can be used to ignore subtitles, a logo, or other things that may
  8401. interfere with the matching. @option{y0} sets the starting scan line and
  8402. @option{y1} sets the ending line; all lines in between @option{y0} and
  8403. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8404. @option{y0} and @option{y1} to the same value will disable the feature.
  8405. @option{y0} and @option{y1} defaults to @code{0}.
  8406. @item scthresh
  8407. Set the scene change detection threshold as a percentage of maximum change on
  8408. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8409. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8410. @option{scthresh} is @code{[0.0, 100.0]}.
  8411. Default value is @code{12.0}.
  8412. @item combmatch
  8413. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8414. account the combed scores of matches when deciding what match to use as the
  8415. final match. Available values are:
  8416. @table @samp
  8417. @item none
  8418. No final matching based on combed scores.
  8419. @item sc
  8420. Combed scores are only used when a scene change is detected.
  8421. @item full
  8422. Use combed scores all the time.
  8423. @end table
  8424. Default is @var{sc}.
  8425. @item combdbg
  8426. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8427. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8428. Available values are:
  8429. @table @samp
  8430. @item none
  8431. No forced calculation.
  8432. @item pcn
  8433. Force p/c/n calculations.
  8434. @item pcnub
  8435. Force p/c/n/u/b calculations.
  8436. @end table
  8437. Default value is @var{none}.
  8438. @item cthresh
  8439. This is the area combing threshold used for combed frame detection. This
  8440. essentially controls how "strong" or "visible" combing must be to be detected.
  8441. Larger values mean combing must be more visible and smaller values mean combing
  8442. can be less visible or strong and still be detected. Valid settings are from
  8443. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8444. be detected as combed). This is basically a pixel difference value. A good
  8445. range is @code{[8, 12]}.
  8446. Default value is @code{9}.
  8447. @item chroma
  8448. Sets whether or not chroma is considered in the combed frame decision. Only
  8449. disable this if your source has chroma problems (rainbowing, etc.) that are
  8450. causing problems for the combed frame detection with chroma enabled. Actually,
  8451. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8452. where there is chroma only combing in the source.
  8453. Default value is @code{0}.
  8454. @item blockx
  8455. @item blocky
  8456. Respectively set the x-axis and y-axis size of the window used during combed
  8457. frame detection. This has to do with the size of the area in which
  8458. @option{combpel} pixels are required to be detected as combed for a frame to be
  8459. declared combed. See the @option{combpel} parameter description for more info.
  8460. Possible values are any number that is a power of 2 starting at 4 and going up
  8461. to 512.
  8462. Default value is @code{16}.
  8463. @item combpel
  8464. The number of combed pixels inside any of the @option{blocky} by
  8465. @option{blockx} size blocks on the frame for the frame to be detected as
  8466. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8467. setting controls "how much" combing there must be in any localized area (a
  8468. window defined by the @option{blockx} and @option{blocky} settings) on the
  8469. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8470. which point no frames will ever be detected as combed). This setting is known
  8471. as @option{MI} in TFM/VFM vocabulary.
  8472. Default value is @code{80}.
  8473. @end table
  8474. @anchor{p/c/n/u/b meaning}
  8475. @subsection p/c/n/u/b meaning
  8476. @subsubsection p/c/n
  8477. We assume the following telecined stream:
  8478. @example
  8479. Top fields: 1 2 2 3 4
  8480. Bottom fields: 1 2 3 4 4
  8481. @end example
  8482. The numbers correspond to the progressive frame the fields relate to. Here, the
  8483. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8484. When @code{fieldmatch} is configured to run a matching from bottom
  8485. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8486. @example
  8487. Input stream:
  8488. T 1 2 2 3 4
  8489. B 1 2 3 4 4 <-- matching reference
  8490. Matches: c c n n c
  8491. Output stream:
  8492. T 1 2 3 4 4
  8493. B 1 2 3 4 4
  8494. @end example
  8495. As a result of the field matching, we can see that some frames get duplicated.
  8496. To perform a complete inverse telecine, you need to rely on a decimation filter
  8497. after this operation. See for instance the @ref{decimate} filter.
  8498. The same operation now matching from top fields (@option{field}=@var{top})
  8499. looks like this:
  8500. @example
  8501. Input stream:
  8502. T 1 2 2 3 4 <-- matching reference
  8503. B 1 2 3 4 4
  8504. Matches: c c p p c
  8505. Output stream:
  8506. T 1 2 2 3 4
  8507. B 1 2 2 3 4
  8508. @end example
  8509. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8510. basically, they refer to the frame and field of the opposite parity:
  8511. @itemize
  8512. @item @var{p} matches the field of the opposite parity in the previous frame
  8513. @item @var{c} matches the field of the opposite parity in the current frame
  8514. @item @var{n} matches the field of the opposite parity in the next frame
  8515. @end itemize
  8516. @subsubsection u/b
  8517. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8518. from the opposite parity flag. In the following examples, we assume that we are
  8519. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8520. 'x' is placed above and below each matched fields.
  8521. With bottom matching (@option{field}=@var{bottom}):
  8522. @example
  8523. Match: c p n b u
  8524. x x x x x
  8525. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8526. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8527. x x x x x
  8528. Output frames:
  8529. 2 1 2 2 2
  8530. 2 2 2 1 3
  8531. @end example
  8532. With top matching (@option{field}=@var{top}):
  8533. @example
  8534. Match: c p n b u
  8535. x x x x x
  8536. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8537. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8538. x x x x x
  8539. Output frames:
  8540. 2 2 2 1 2
  8541. 2 1 3 2 2
  8542. @end example
  8543. @subsection Examples
  8544. Simple IVTC of a top field first telecined stream:
  8545. @example
  8546. fieldmatch=order=tff:combmatch=none, decimate
  8547. @end example
  8548. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8549. @example
  8550. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8551. @end example
  8552. @section fieldorder
  8553. Transform the field order of the input video.
  8554. It accepts the following parameters:
  8555. @table @option
  8556. @item order
  8557. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8558. for bottom field first.
  8559. @end table
  8560. The default value is @samp{tff}.
  8561. The transformation is done by shifting the picture content up or down
  8562. by one line, and filling the remaining line with appropriate picture content.
  8563. This method is consistent with most broadcast field order converters.
  8564. If the input video is not flagged as being interlaced, or it is already
  8565. flagged as being of the required output field order, then this filter does
  8566. not alter the incoming video.
  8567. It is very useful when converting to or from PAL DV material,
  8568. which is bottom field first.
  8569. For example:
  8570. @example
  8571. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8572. @end example
  8573. @section fifo, afifo
  8574. Buffer input images and send them when they are requested.
  8575. It is mainly useful when auto-inserted by the libavfilter
  8576. framework.
  8577. It does not take parameters.
  8578. @section fillborders
  8579. Fill borders of the input video, without changing video stream dimensions.
  8580. Sometimes video can have garbage at the four edges and you may not want to
  8581. crop video input to keep size multiple of some number.
  8582. This filter accepts the following options:
  8583. @table @option
  8584. @item left
  8585. Number of pixels to fill from left border.
  8586. @item right
  8587. Number of pixels to fill from right border.
  8588. @item top
  8589. Number of pixels to fill from top border.
  8590. @item bottom
  8591. Number of pixels to fill from bottom border.
  8592. @item mode
  8593. Set fill mode.
  8594. It accepts the following values:
  8595. @table @samp
  8596. @item smear
  8597. fill pixels using outermost pixels
  8598. @item mirror
  8599. fill pixels using mirroring
  8600. @item fixed
  8601. fill pixels with constant value
  8602. @end table
  8603. Default is @var{smear}.
  8604. @item color
  8605. Set color for pixels in fixed mode. Default is @var{black}.
  8606. @end table
  8607. @subsection Commands
  8608. This filter supports same @ref{commands} as options.
  8609. The command accepts the same syntax of the corresponding option.
  8610. If the specified expression is not valid, it is kept at its current
  8611. value.
  8612. @section find_rect
  8613. Find a rectangular object
  8614. It accepts the following options:
  8615. @table @option
  8616. @item object
  8617. Filepath of the object image, needs to be in gray8.
  8618. @item threshold
  8619. Detection threshold, default is 0.5.
  8620. @item mipmaps
  8621. Number of mipmaps, default is 3.
  8622. @item xmin, ymin, xmax, ymax
  8623. Specifies the rectangle in which to search.
  8624. @end table
  8625. @subsection Examples
  8626. @itemize
  8627. @item
  8628. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8629. @example
  8630. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8631. @end example
  8632. @end itemize
  8633. @section floodfill
  8634. Flood area with values of same pixel components with another values.
  8635. It accepts the following options:
  8636. @table @option
  8637. @item x
  8638. Set pixel x coordinate.
  8639. @item y
  8640. Set pixel y coordinate.
  8641. @item s0
  8642. Set source #0 component value.
  8643. @item s1
  8644. Set source #1 component value.
  8645. @item s2
  8646. Set source #2 component value.
  8647. @item s3
  8648. Set source #3 component value.
  8649. @item d0
  8650. Set destination #0 component value.
  8651. @item d1
  8652. Set destination #1 component value.
  8653. @item d2
  8654. Set destination #2 component value.
  8655. @item d3
  8656. Set destination #3 component value.
  8657. @end table
  8658. @anchor{format}
  8659. @section format
  8660. Convert the input video to one of the specified pixel formats.
  8661. Libavfilter will try to pick one that is suitable as input to
  8662. the next filter.
  8663. It accepts the following parameters:
  8664. @table @option
  8665. @item pix_fmts
  8666. A '|'-separated list of pixel format names, such as
  8667. "pix_fmts=yuv420p|monow|rgb24".
  8668. @end table
  8669. @subsection Examples
  8670. @itemize
  8671. @item
  8672. Convert the input video to the @var{yuv420p} format
  8673. @example
  8674. format=pix_fmts=yuv420p
  8675. @end example
  8676. Convert the input video to any of the formats in the list
  8677. @example
  8678. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8679. @end example
  8680. @end itemize
  8681. @anchor{fps}
  8682. @section fps
  8683. Convert the video to specified constant frame rate by duplicating or dropping
  8684. frames as necessary.
  8685. It accepts the following parameters:
  8686. @table @option
  8687. @item fps
  8688. The desired output frame rate. The default is @code{25}.
  8689. @item start_time
  8690. Assume the first PTS should be the given value, in seconds. This allows for
  8691. padding/trimming at the start of stream. By default, no assumption is made
  8692. about the first frame's expected PTS, so no padding or trimming is done.
  8693. For example, this could be set to 0 to pad the beginning with duplicates of
  8694. the first frame if a video stream starts after the audio stream or to trim any
  8695. frames with a negative PTS.
  8696. @item round
  8697. Timestamp (PTS) rounding method.
  8698. Possible values are:
  8699. @table @option
  8700. @item zero
  8701. round towards 0
  8702. @item inf
  8703. round away from 0
  8704. @item down
  8705. round towards -infinity
  8706. @item up
  8707. round towards +infinity
  8708. @item near
  8709. round to nearest
  8710. @end table
  8711. The default is @code{near}.
  8712. @item eof_action
  8713. Action performed when reading the last frame.
  8714. Possible values are:
  8715. @table @option
  8716. @item round
  8717. Use same timestamp rounding method as used for other frames.
  8718. @item pass
  8719. Pass through last frame if input duration has not been reached yet.
  8720. @end table
  8721. The default is @code{round}.
  8722. @end table
  8723. Alternatively, the options can be specified as a flat string:
  8724. @var{fps}[:@var{start_time}[:@var{round}]].
  8725. See also the @ref{setpts} filter.
  8726. @subsection Examples
  8727. @itemize
  8728. @item
  8729. A typical usage in order to set the fps to 25:
  8730. @example
  8731. fps=fps=25
  8732. @end example
  8733. @item
  8734. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8735. @example
  8736. fps=fps=film:round=near
  8737. @end example
  8738. @end itemize
  8739. @section framepack
  8740. Pack two different video streams into a stereoscopic video, setting proper
  8741. metadata on supported codecs. The two views should have the same size and
  8742. framerate and processing will stop when the shorter video ends. Please note
  8743. that you may conveniently adjust view properties with the @ref{scale} and
  8744. @ref{fps} filters.
  8745. It accepts the following parameters:
  8746. @table @option
  8747. @item format
  8748. The desired packing format. Supported values are:
  8749. @table @option
  8750. @item sbs
  8751. The views are next to each other (default).
  8752. @item tab
  8753. The views are on top of each other.
  8754. @item lines
  8755. The views are packed by line.
  8756. @item columns
  8757. The views are packed by column.
  8758. @item frameseq
  8759. The views are temporally interleaved.
  8760. @end table
  8761. @end table
  8762. Some examples:
  8763. @example
  8764. # Convert left and right views into a frame-sequential video
  8765. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8766. # Convert views into a side-by-side video with the same output resolution as the input
  8767. 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
  8768. @end example
  8769. @section framerate
  8770. Change the frame rate by interpolating new video output frames from the source
  8771. frames.
  8772. This filter is not designed to function correctly with interlaced media. If
  8773. you wish to change the frame rate of interlaced media then you are required
  8774. to deinterlace before this filter and re-interlace after this filter.
  8775. A description of the accepted options follows.
  8776. @table @option
  8777. @item fps
  8778. Specify the output frames per second. This option can also be specified
  8779. as a value alone. The default is @code{50}.
  8780. @item interp_start
  8781. Specify the start of a range where the output frame will be created as a
  8782. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8783. the default is @code{15}.
  8784. @item interp_end
  8785. Specify the end of a range where the output frame will be created as a
  8786. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8787. the default is @code{240}.
  8788. @item scene
  8789. Specify the level at which a scene change is detected as a value between
  8790. 0 and 100 to indicate a new scene; a low value reflects a low
  8791. probability for the current frame to introduce a new scene, while a higher
  8792. value means the current frame is more likely to be one.
  8793. The default is @code{8.2}.
  8794. @item flags
  8795. Specify flags influencing the filter process.
  8796. Available value for @var{flags} is:
  8797. @table @option
  8798. @item scene_change_detect, scd
  8799. Enable scene change detection using the value of the option @var{scene}.
  8800. This flag is enabled by default.
  8801. @end table
  8802. @end table
  8803. @section framestep
  8804. Select one frame every N-th frame.
  8805. This filter accepts the following option:
  8806. @table @option
  8807. @item step
  8808. Select frame after every @code{step} frames.
  8809. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8810. @end table
  8811. @section freezedetect
  8812. Detect frozen video.
  8813. This filter logs a message and sets frame metadata when it detects that the
  8814. input video has no significant change in content during a specified duration.
  8815. Video freeze detection calculates the mean average absolute difference of all
  8816. the components of video frames and compares it to a noise floor.
  8817. The printed times and duration are expressed in seconds. The
  8818. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8819. whose timestamp equals or exceeds the detection duration and it contains the
  8820. timestamp of the first frame of the freeze. The
  8821. @code{lavfi.freezedetect.freeze_duration} and
  8822. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8823. after the freeze.
  8824. The filter accepts the following options:
  8825. @table @option
  8826. @item noise, n
  8827. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8828. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8829. 0.001.
  8830. @item duration, d
  8831. Set freeze duration until notification (default is 2 seconds).
  8832. @end table
  8833. @section freezeframes
  8834. Freeze video frames.
  8835. This filter freezes video frames using frame from 2nd input.
  8836. The filter accepts the following options:
  8837. @table @option
  8838. @item first
  8839. Set number of first frame from which to start freeze.
  8840. @item last
  8841. Set number of last frame from which to end freeze.
  8842. @item replace
  8843. Set number of frame from 2nd input which will be used instead of replaced frames.
  8844. @end table
  8845. @anchor{frei0r}
  8846. @section frei0r
  8847. Apply a frei0r effect to the input video.
  8848. To enable the compilation of this filter, you need to install the frei0r
  8849. header and configure FFmpeg with @code{--enable-frei0r}.
  8850. It accepts the following parameters:
  8851. @table @option
  8852. @item filter_name
  8853. The name of the frei0r effect to load. If the environment variable
  8854. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8855. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8856. Otherwise, the standard frei0r paths are searched, in this order:
  8857. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8858. @file{/usr/lib/frei0r-1/}.
  8859. @item filter_params
  8860. A '|'-separated list of parameters to pass to the frei0r effect.
  8861. @end table
  8862. A frei0r effect parameter can be a boolean (its value is either
  8863. "y" or "n"), a double, a color (specified as
  8864. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8865. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8866. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8867. a position (specified as @var{X}/@var{Y}, where
  8868. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8869. The number and types of parameters depend on the loaded effect. If an
  8870. effect parameter is not specified, the default value is set.
  8871. @subsection Examples
  8872. @itemize
  8873. @item
  8874. Apply the distort0r effect, setting the first two double parameters:
  8875. @example
  8876. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8877. @end example
  8878. @item
  8879. Apply the colordistance effect, taking a color as the first parameter:
  8880. @example
  8881. frei0r=colordistance:0.2/0.3/0.4
  8882. frei0r=colordistance:violet
  8883. frei0r=colordistance:0x112233
  8884. @end example
  8885. @item
  8886. Apply the perspective effect, specifying the top left and top right image
  8887. positions:
  8888. @example
  8889. frei0r=perspective:0.2/0.2|0.8/0.2
  8890. @end example
  8891. @end itemize
  8892. For more information, see
  8893. @url{http://frei0r.dyne.org}
  8894. @section fspp
  8895. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8896. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8897. processing filter, one of them is performed once per block, not per pixel.
  8898. This allows for much higher speed.
  8899. The filter accepts the following options:
  8900. @table @option
  8901. @item quality
  8902. Set quality. This option defines the number of levels for averaging. It accepts
  8903. an integer in the range 4-5. Default value is @code{4}.
  8904. @item qp
  8905. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8906. If not set, the filter will use the QP from the video stream (if available).
  8907. @item strength
  8908. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8909. more details but also more artifacts, while higher values make the image smoother
  8910. but also blurrier. Default value is @code{0} − PSNR optimal.
  8911. @item use_bframe_qp
  8912. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8913. option may cause flicker since the B-Frames have often larger QP. Default is
  8914. @code{0} (not enabled).
  8915. @end table
  8916. @section gblur
  8917. Apply Gaussian blur filter.
  8918. The filter accepts the following options:
  8919. @table @option
  8920. @item sigma
  8921. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8922. @item steps
  8923. Set number of steps for Gaussian approximation. Default is @code{1}.
  8924. @item planes
  8925. Set which planes to filter. By default all planes are filtered.
  8926. @item sigmaV
  8927. Set vertical sigma, if negative it will be same as @code{sigma}.
  8928. Default is @code{-1}.
  8929. @end table
  8930. @subsection Commands
  8931. This filter supports same commands as options.
  8932. The command accepts the same syntax of the corresponding option.
  8933. If the specified expression is not valid, it is kept at its current
  8934. value.
  8935. @section geq
  8936. Apply generic equation to each pixel.
  8937. The filter accepts the following options:
  8938. @table @option
  8939. @item lum_expr, lum
  8940. Set the luminance expression.
  8941. @item cb_expr, cb
  8942. Set the chrominance blue expression.
  8943. @item cr_expr, cr
  8944. Set the chrominance red expression.
  8945. @item alpha_expr, a
  8946. Set the alpha expression.
  8947. @item red_expr, r
  8948. Set the red expression.
  8949. @item green_expr, g
  8950. Set the green expression.
  8951. @item blue_expr, b
  8952. Set the blue expression.
  8953. @end table
  8954. The colorspace is selected according to the specified options. If one
  8955. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8956. options is specified, the filter will automatically select a YCbCr
  8957. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8958. @option{blue_expr} options is specified, it will select an RGB
  8959. colorspace.
  8960. If one of the chrominance expression is not defined, it falls back on the other
  8961. one. If no alpha expression is specified it will evaluate to opaque value.
  8962. If none of chrominance expressions are specified, they will evaluate
  8963. to the luminance expression.
  8964. The expressions can use the following variables and functions:
  8965. @table @option
  8966. @item N
  8967. The sequential number of the filtered frame, starting from @code{0}.
  8968. @item X
  8969. @item Y
  8970. The coordinates of the current sample.
  8971. @item W
  8972. @item H
  8973. The width and height of the image.
  8974. @item SW
  8975. @item SH
  8976. Width and height scale depending on the currently filtered plane. It is the
  8977. ratio between the corresponding luma plane number of pixels and the current
  8978. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8979. @code{0.5,0.5} for chroma planes.
  8980. @item T
  8981. Time of the current frame, expressed in seconds.
  8982. @item p(x, y)
  8983. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8984. plane.
  8985. @item lum(x, y)
  8986. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8987. plane.
  8988. @item cb(x, y)
  8989. Return the value of the pixel at location (@var{x},@var{y}) of the
  8990. blue-difference chroma plane. Return 0 if there is no such plane.
  8991. @item cr(x, y)
  8992. Return the value of the pixel at location (@var{x},@var{y}) of the
  8993. red-difference chroma plane. Return 0 if there is no such plane.
  8994. @item r(x, y)
  8995. @item g(x, y)
  8996. @item b(x, y)
  8997. Return the value of the pixel at location (@var{x},@var{y}) of the
  8998. red/green/blue component. Return 0 if there is no such component.
  8999. @item alpha(x, y)
  9000. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9001. plane. Return 0 if there is no such plane.
  9002. @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)
  9003. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9004. sums of samples within a rectangle. See the functions without the sum postfix.
  9005. @item interpolation
  9006. Set one of interpolation methods:
  9007. @table @option
  9008. @item nearest, n
  9009. @item bilinear, b
  9010. @end table
  9011. Default is bilinear.
  9012. @end table
  9013. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9014. automatically clipped to the closer edge.
  9015. Please note that this filter can use multiple threads in which case each slice
  9016. will have its own expression state. If you want to use only a single expression
  9017. state because your expressions depend on previous state then you should limit
  9018. the number of filter threads to 1.
  9019. @subsection Examples
  9020. @itemize
  9021. @item
  9022. Flip the image horizontally:
  9023. @example
  9024. geq=p(W-X\,Y)
  9025. @end example
  9026. @item
  9027. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9028. wavelength of 100 pixels:
  9029. @example
  9030. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9031. @end example
  9032. @item
  9033. Generate a fancy enigmatic moving light:
  9034. @example
  9035. 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
  9036. @end example
  9037. @item
  9038. Generate a quick emboss effect:
  9039. @example
  9040. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9041. @end example
  9042. @item
  9043. Modify RGB components depending on pixel position:
  9044. @example
  9045. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9046. @end example
  9047. @item
  9048. Create a radial gradient that is the same size as the input (also see
  9049. the @ref{vignette} filter):
  9050. @example
  9051. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9052. @end example
  9053. @end itemize
  9054. @section gradfun
  9055. Fix the banding artifacts that are sometimes introduced into nearly flat
  9056. regions by truncation to 8-bit color depth.
  9057. Interpolate the gradients that should go where the bands are, and
  9058. dither them.
  9059. It is designed for playback only. Do not use it prior to
  9060. lossy compression, because compression tends to lose the dither and
  9061. bring back the bands.
  9062. It accepts the following parameters:
  9063. @table @option
  9064. @item strength
  9065. The maximum amount by which the filter will change any one pixel. This is also
  9066. the threshold for detecting nearly flat regions. Acceptable values range from
  9067. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9068. valid range.
  9069. @item radius
  9070. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9071. gradients, but also prevents the filter from modifying the pixels near detailed
  9072. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9073. values will be clipped to the valid range.
  9074. @end table
  9075. Alternatively, the options can be specified as a flat string:
  9076. @var{strength}[:@var{radius}]
  9077. @subsection Examples
  9078. @itemize
  9079. @item
  9080. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9081. @example
  9082. gradfun=3.5:8
  9083. @end example
  9084. @item
  9085. Specify radius, omitting the strength (which will fall-back to the default
  9086. value):
  9087. @example
  9088. gradfun=radius=8
  9089. @end example
  9090. @end itemize
  9091. @anchor{graphmonitor}
  9092. @section graphmonitor
  9093. Show various filtergraph stats.
  9094. With this filter one can debug complete filtergraph.
  9095. Especially issues with links filling with queued frames.
  9096. The filter accepts the following options:
  9097. @table @option
  9098. @item size, s
  9099. Set video output size. Default is @var{hd720}.
  9100. @item opacity, o
  9101. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9102. @item mode, m
  9103. Set output mode, can be @var{fulll} or @var{compact}.
  9104. In @var{compact} mode only filters with some queued frames have displayed stats.
  9105. @item flags, f
  9106. Set flags which enable which stats are shown in video.
  9107. Available values for flags are:
  9108. @table @samp
  9109. @item queue
  9110. Display number of queued frames in each link.
  9111. @item frame_count_in
  9112. Display number of frames taken from filter.
  9113. @item frame_count_out
  9114. Display number of frames given out from filter.
  9115. @item pts
  9116. Display current filtered frame pts.
  9117. @item time
  9118. Display current filtered frame time.
  9119. @item timebase
  9120. Display time base for filter link.
  9121. @item format
  9122. Display used format for filter link.
  9123. @item size
  9124. Display video size or number of audio channels in case of audio used by filter link.
  9125. @item rate
  9126. Display video frame rate or sample rate in case of audio used by filter link.
  9127. @item eof
  9128. Display link output status.
  9129. @end table
  9130. @item rate, r
  9131. Set upper limit for video rate of output stream, Default value is @var{25}.
  9132. This guarantee that output video frame rate will not be higher than this value.
  9133. @end table
  9134. @section greyedge
  9135. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9136. and corrects the scene colors accordingly.
  9137. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9138. The filter accepts the following options:
  9139. @table @option
  9140. @item difford
  9141. The order of differentiation to be applied on the scene. Must be chosen in the range
  9142. [0,2] and default value is 1.
  9143. @item minknorm
  9144. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9145. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9146. max value instead of calculating Minkowski distance.
  9147. @item sigma
  9148. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9149. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9150. can't be equal to 0 if @var{difford} is greater than 0.
  9151. @end table
  9152. @subsection Examples
  9153. @itemize
  9154. @item
  9155. Grey Edge:
  9156. @example
  9157. greyedge=difford=1:minknorm=5:sigma=2
  9158. @end example
  9159. @item
  9160. Max Edge:
  9161. @example
  9162. greyedge=difford=1:minknorm=0:sigma=2
  9163. @end example
  9164. @end itemize
  9165. @anchor{haldclut}
  9166. @section haldclut
  9167. Apply a Hald CLUT to a video stream.
  9168. First input is the video stream to process, and second one is the Hald CLUT.
  9169. The Hald CLUT input can be a simple picture or a complete video stream.
  9170. The filter accepts the following options:
  9171. @table @option
  9172. @item shortest
  9173. Force termination when the shortest input terminates. Default is @code{0}.
  9174. @item repeatlast
  9175. Continue applying the last CLUT after the end of the stream. A value of
  9176. @code{0} disable the filter after the last frame of the CLUT is reached.
  9177. Default is @code{1}.
  9178. @end table
  9179. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9180. filters share the same internals).
  9181. This filter also supports the @ref{framesync} options.
  9182. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9183. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9184. @subsection Workflow examples
  9185. @subsubsection Hald CLUT video stream
  9186. Generate an identity Hald CLUT stream altered with various effects:
  9187. @example
  9188. 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
  9189. @end example
  9190. Note: make sure you use a lossless codec.
  9191. Then use it with @code{haldclut} to apply it on some random stream:
  9192. @example
  9193. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9194. @end example
  9195. The Hald CLUT will be applied to the 10 first seconds (duration of
  9196. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9197. to the remaining frames of the @code{mandelbrot} stream.
  9198. @subsubsection Hald CLUT with preview
  9199. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9200. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9201. biggest possible square starting at the top left of the picture. The remaining
  9202. padding pixels (bottom or right) will be ignored. This area can be used to add
  9203. a preview of the Hald CLUT.
  9204. Typically, the following generated Hald CLUT will be supported by the
  9205. @code{haldclut} filter:
  9206. @example
  9207. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9208. pad=iw+320 [padded_clut];
  9209. smptebars=s=320x256, split [a][b];
  9210. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9211. [main][b] overlay=W-320" -frames:v 1 clut.png
  9212. @end example
  9213. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9214. bars are displayed on the right-top, and below the same color bars processed by
  9215. the color changes.
  9216. Then, the effect of this Hald CLUT can be visualized with:
  9217. @example
  9218. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9219. @end example
  9220. @section hflip
  9221. Flip the input video horizontally.
  9222. For example, to horizontally flip the input video with @command{ffmpeg}:
  9223. @example
  9224. ffmpeg -i in.avi -vf "hflip" out.avi
  9225. @end example
  9226. @section histeq
  9227. This filter applies a global color histogram equalization on a
  9228. per-frame basis.
  9229. It can be used to correct video that has a compressed range of pixel
  9230. intensities. The filter redistributes the pixel intensities to
  9231. equalize their distribution across the intensity range. It may be
  9232. viewed as an "automatically adjusting contrast filter". This filter is
  9233. useful only for correcting degraded or poorly captured source
  9234. video.
  9235. The filter accepts the following options:
  9236. @table @option
  9237. @item strength
  9238. Determine the amount of equalization to be applied. As the strength
  9239. is reduced, the distribution of pixel intensities more-and-more
  9240. approaches that of the input frame. The value must be a float number
  9241. in the range [0,1] and defaults to 0.200.
  9242. @item intensity
  9243. Set the maximum intensity that can generated and scale the output
  9244. values appropriately. The strength should be set as desired and then
  9245. the intensity can be limited if needed to avoid washing-out. The value
  9246. must be a float number in the range [0,1] and defaults to 0.210.
  9247. @item antibanding
  9248. Set the antibanding level. If enabled the filter will randomly vary
  9249. the luminance of output pixels by a small amount to avoid banding of
  9250. the histogram. Possible values are @code{none}, @code{weak} or
  9251. @code{strong}. It defaults to @code{none}.
  9252. @end table
  9253. @anchor{histogram}
  9254. @section histogram
  9255. Compute and draw a color distribution histogram for the input video.
  9256. The computed histogram is a representation of the color component
  9257. distribution in an image.
  9258. Standard histogram displays the color components distribution in an image.
  9259. Displays color graph for each color component. Shows distribution of
  9260. the Y, U, V, A or R, G, B components, depending on input format, in the
  9261. current frame. Below each graph a color component scale meter is shown.
  9262. The filter accepts the following options:
  9263. @table @option
  9264. @item level_height
  9265. Set height of level. Default value is @code{200}.
  9266. Allowed range is [50, 2048].
  9267. @item scale_height
  9268. Set height of color scale. Default value is @code{12}.
  9269. Allowed range is [0, 40].
  9270. @item display_mode
  9271. Set display mode.
  9272. It accepts the following values:
  9273. @table @samp
  9274. @item stack
  9275. Per color component graphs are placed below each other.
  9276. @item parade
  9277. Per color component graphs are placed side by side.
  9278. @item overlay
  9279. Presents information identical to that in the @code{parade}, except
  9280. that the graphs representing color components are superimposed directly
  9281. over one another.
  9282. @end table
  9283. Default is @code{stack}.
  9284. @item levels_mode
  9285. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9286. Default is @code{linear}.
  9287. @item components
  9288. Set what color components to display.
  9289. Default is @code{7}.
  9290. @item fgopacity
  9291. Set foreground opacity. Default is @code{0.7}.
  9292. @item bgopacity
  9293. Set background opacity. Default is @code{0.5}.
  9294. @end table
  9295. @subsection Examples
  9296. @itemize
  9297. @item
  9298. Calculate and draw histogram:
  9299. @example
  9300. ffplay -i input -vf histogram
  9301. @end example
  9302. @end itemize
  9303. @anchor{hqdn3d}
  9304. @section hqdn3d
  9305. This is a high precision/quality 3d denoise filter. It aims to reduce
  9306. image noise, producing smooth images and making still images really
  9307. still. It should enhance compressibility.
  9308. It accepts the following optional parameters:
  9309. @table @option
  9310. @item luma_spatial
  9311. A non-negative floating point number which specifies spatial luma strength.
  9312. It defaults to 4.0.
  9313. @item chroma_spatial
  9314. A non-negative floating point number which specifies spatial chroma strength.
  9315. It defaults to 3.0*@var{luma_spatial}/4.0.
  9316. @item luma_tmp
  9317. A floating point number which specifies luma temporal strength. It defaults to
  9318. 6.0*@var{luma_spatial}/4.0.
  9319. @item chroma_tmp
  9320. A floating point number which specifies chroma temporal strength. It defaults to
  9321. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9322. @end table
  9323. @subsection Commands
  9324. This filter supports same @ref{commands} as options.
  9325. The command accepts the same syntax of the corresponding option.
  9326. If the specified expression is not valid, it is kept at its current
  9327. value.
  9328. @anchor{hwdownload}
  9329. @section hwdownload
  9330. Download hardware frames to system memory.
  9331. The input must be in hardware frames, and the output a non-hardware format.
  9332. Not all formats will be supported on the output - it may be necessary to insert
  9333. an additional @option{format} filter immediately following in the graph to get
  9334. the output in a supported format.
  9335. @section hwmap
  9336. Map hardware frames to system memory or to another device.
  9337. This filter has several different modes of operation; which one is used depends
  9338. on the input and output formats:
  9339. @itemize
  9340. @item
  9341. Hardware frame input, normal frame output
  9342. Map the input frames to system memory and pass them to the output. If the
  9343. original hardware frame is later required (for example, after overlaying
  9344. something else on part of it), the @option{hwmap} filter can be used again
  9345. in the next mode to retrieve it.
  9346. @item
  9347. Normal frame input, hardware frame output
  9348. If the input is actually a software-mapped hardware frame, then unmap it -
  9349. that is, return the original hardware frame.
  9350. Otherwise, a device must be provided. Create new hardware surfaces on that
  9351. device for the output, then map them back to the software format at the input
  9352. and give those frames to the preceding filter. This will then act like the
  9353. @option{hwupload} filter, but may be able to avoid an additional copy when
  9354. the input is already in a compatible format.
  9355. @item
  9356. Hardware frame input and output
  9357. A device must be supplied for the output, either directly or with the
  9358. @option{derive_device} option. The input and output devices must be of
  9359. different types and compatible - the exact meaning of this is
  9360. system-dependent, but typically it means that they must refer to the same
  9361. underlying hardware context (for example, refer to the same graphics card).
  9362. If the input frames were originally created on the output device, then unmap
  9363. to retrieve the original frames.
  9364. Otherwise, map the frames to the output device - create new hardware frames
  9365. on the output corresponding to the frames on the input.
  9366. @end itemize
  9367. The following additional parameters are accepted:
  9368. @table @option
  9369. @item mode
  9370. Set the frame mapping mode. Some combination of:
  9371. @table @var
  9372. @item read
  9373. The mapped frame should be readable.
  9374. @item write
  9375. The mapped frame should be writeable.
  9376. @item overwrite
  9377. The mapping will always overwrite the entire frame.
  9378. This may improve performance in some cases, as the original contents of the
  9379. frame need not be loaded.
  9380. @item direct
  9381. The mapping must not involve any copying.
  9382. Indirect mappings to copies of frames are created in some cases where either
  9383. direct mapping is not possible or it would have unexpected properties.
  9384. Setting this flag ensures that the mapping is direct and will fail if that is
  9385. not possible.
  9386. @end table
  9387. Defaults to @var{read+write} if not specified.
  9388. @item derive_device @var{type}
  9389. Rather than using the device supplied at initialisation, instead derive a new
  9390. device of type @var{type} from the device the input frames exist on.
  9391. @item reverse
  9392. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9393. and map them back to the source. This may be necessary in some cases where
  9394. a mapping in one direction is required but only the opposite direction is
  9395. supported by the devices being used.
  9396. This option is dangerous - it may break the preceding filter in undefined
  9397. ways if there are any additional constraints on that filter's output.
  9398. Do not use it without fully understanding the implications of its use.
  9399. @end table
  9400. @anchor{hwupload}
  9401. @section hwupload
  9402. Upload system memory frames to hardware surfaces.
  9403. The device to upload to must be supplied when the filter is initialised. If
  9404. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9405. option or with the @option{derive_device} option. The input and output devices
  9406. must be of different types and compatible - the exact meaning of this is
  9407. system-dependent, but typically it means that they must refer to the same
  9408. underlying hardware context (for example, refer to the same graphics card).
  9409. The following additional parameters are accepted:
  9410. @table @option
  9411. @item derive_device @var{type}
  9412. Rather than using the device supplied at initialisation, instead derive a new
  9413. device of type @var{type} from the device the input frames exist on.
  9414. @end table
  9415. @anchor{hwupload_cuda}
  9416. @section hwupload_cuda
  9417. Upload system memory frames to a CUDA device.
  9418. It accepts the following optional parameters:
  9419. @table @option
  9420. @item device
  9421. The number of the CUDA device to use
  9422. @end table
  9423. @section hqx
  9424. Apply a high-quality magnification filter designed for pixel art. This filter
  9425. was originally created by Maxim Stepin.
  9426. It accepts the following option:
  9427. @table @option
  9428. @item n
  9429. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9430. @code{hq3x} and @code{4} for @code{hq4x}.
  9431. Default is @code{3}.
  9432. @end table
  9433. @section hstack
  9434. Stack input videos horizontally.
  9435. All streams must be of same pixel format and of same height.
  9436. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9437. to create same output.
  9438. The filter accepts the following option:
  9439. @table @option
  9440. @item inputs
  9441. Set number of input streams. Default is 2.
  9442. @item shortest
  9443. If set to 1, force the output to terminate when the shortest input
  9444. terminates. Default value is 0.
  9445. @end table
  9446. @section hue
  9447. Modify the hue and/or the saturation of the input.
  9448. It accepts the following parameters:
  9449. @table @option
  9450. @item h
  9451. Specify the hue angle as a number of degrees. It accepts an expression,
  9452. and defaults to "0".
  9453. @item s
  9454. Specify the saturation in the [-10,10] range. It accepts an expression and
  9455. defaults to "1".
  9456. @item H
  9457. Specify the hue angle as a number of radians. It accepts an
  9458. expression, and defaults to "0".
  9459. @item b
  9460. Specify the brightness in the [-10,10] range. It accepts an expression and
  9461. defaults to "0".
  9462. @end table
  9463. @option{h} and @option{H} are mutually exclusive, and can't be
  9464. specified at the same time.
  9465. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9466. expressions containing the following constants:
  9467. @table @option
  9468. @item n
  9469. frame count of the input frame starting from 0
  9470. @item pts
  9471. presentation timestamp of the input frame expressed in time base units
  9472. @item r
  9473. frame rate of the input video, NAN if the input frame rate is unknown
  9474. @item t
  9475. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9476. @item tb
  9477. time base of the input video
  9478. @end table
  9479. @subsection Examples
  9480. @itemize
  9481. @item
  9482. Set the hue to 90 degrees and the saturation to 1.0:
  9483. @example
  9484. hue=h=90:s=1
  9485. @end example
  9486. @item
  9487. Same command but expressing the hue in radians:
  9488. @example
  9489. hue=H=PI/2:s=1
  9490. @end example
  9491. @item
  9492. Rotate hue and make the saturation swing between 0
  9493. and 2 over a period of 1 second:
  9494. @example
  9495. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9496. @end example
  9497. @item
  9498. Apply a 3 seconds saturation fade-in effect starting at 0:
  9499. @example
  9500. hue="s=min(t/3\,1)"
  9501. @end example
  9502. The general fade-in expression can be written as:
  9503. @example
  9504. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9505. @end example
  9506. @item
  9507. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9508. @example
  9509. hue="s=max(0\, min(1\, (8-t)/3))"
  9510. @end example
  9511. The general fade-out expression can be written as:
  9512. @example
  9513. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9514. @end example
  9515. @end itemize
  9516. @subsection Commands
  9517. This filter supports the following commands:
  9518. @table @option
  9519. @item b
  9520. @item s
  9521. @item h
  9522. @item H
  9523. Modify the hue and/or the saturation and/or brightness of the input video.
  9524. The command accepts the same syntax of the corresponding option.
  9525. If the specified expression is not valid, it is kept at its current
  9526. value.
  9527. @end table
  9528. @section hysteresis
  9529. Grow first stream into second stream by connecting components.
  9530. This makes it possible to build more robust edge masks.
  9531. This filter accepts the following options:
  9532. @table @option
  9533. @item planes
  9534. Set which planes will be processed as bitmap, unprocessed planes will be
  9535. copied from first stream.
  9536. By default value 0xf, all planes will be processed.
  9537. @item threshold
  9538. Set threshold which is used in filtering. If pixel component value is higher than
  9539. this value filter algorithm for connecting components is activated.
  9540. By default value is 0.
  9541. @end table
  9542. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9543. @section idet
  9544. Detect video interlacing type.
  9545. This filter tries to detect if the input frames are interlaced, progressive,
  9546. top or bottom field first. It will also try to detect fields that are
  9547. repeated between adjacent frames (a sign of telecine).
  9548. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9549. Multiple frame detection incorporates the classification history of previous frames.
  9550. The filter will log these metadata values:
  9551. @table @option
  9552. @item single.current_frame
  9553. Detected type of current frame using single-frame detection. One of:
  9554. ``tff'' (top field first), ``bff'' (bottom field first),
  9555. ``progressive'', or ``undetermined''
  9556. @item single.tff
  9557. Cumulative number of frames detected as top field first using single-frame detection.
  9558. @item multiple.tff
  9559. Cumulative number of frames detected as top field first using multiple-frame detection.
  9560. @item single.bff
  9561. Cumulative number of frames detected as bottom field first using single-frame detection.
  9562. @item multiple.current_frame
  9563. Detected type of current frame using multiple-frame detection. One of:
  9564. ``tff'' (top field first), ``bff'' (bottom field first),
  9565. ``progressive'', or ``undetermined''
  9566. @item multiple.bff
  9567. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9568. @item single.progressive
  9569. Cumulative number of frames detected as progressive using single-frame detection.
  9570. @item multiple.progressive
  9571. Cumulative number of frames detected as progressive using multiple-frame detection.
  9572. @item single.undetermined
  9573. Cumulative number of frames that could not be classified using single-frame detection.
  9574. @item multiple.undetermined
  9575. Cumulative number of frames that could not be classified using multiple-frame detection.
  9576. @item repeated.current_frame
  9577. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9578. @item repeated.neither
  9579. Cumulative number of frames with no repeated field.
  9580. @item repeated.top
  9581. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9582. @item repeated.bottom
  9583. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9584. @end table
  9585. The filter accepts the following options:
  9586. @table @option
  9587. @item intl_thres
  9588. Set interlacing threshold.
  9589. @item prog_thres
  9590. Set progressive threshold.
  9591. @item rep_thres
  9592. Threshold for repeated field detection.
  9593. @item half_life
  9594. Number of frames after which a given frame's contribution to the
  9595. statistics is halved (i.e., it contributes only 0.5 to its
  9596. classification). The default of 0 means that all frames seen are given
  9597. full weight of 1.0 forever.
  9598. @item analyze_interlaced_flag
  9599. When this is not 0 then idet will use the specified number of frames to determine
  9600. if the interlaced flag is accurate, it will not count undetermined frames.
  9601. If the flag is found to be accurate it will be used without any further
  9602. computations, if it is found to be inaccurate it will be cleared without any
  9603. further computations. This allows inserting the idet filter as a low computational
  9604. method to clean up the interlaced flag
  9605. @end table
  9606. @section il
  9607. Deinterleave or interleave fields.
  9608. This filter allows one to process interlaced images fields without
  9609. deinterlacing them. Deinterleaving splits the input frame into 2
  9610. fields (so called half pictures). Odd lines are moved to the top
  9611. half of the output image, even lines to the bottom half.
  9612. You can process (filter) them independently and then re-interleave them.
  9613. The filter accepts the following options:
  9614. @table @option
  9615. @item luma_mode, l
  9616. @item chroma_mode, c
  9617. @item alpha_mode, a
  9618. Available values for @var{luma_mode}, @var{chroma_mode} and
  9619. @var{alpha_mode} are:
  9620. @table @samp
  9621. @item none
  9622. Do nothing.
  9623. @item deinterleave, d
  9624. Deinterleave fields, placing one above the other.
  9625. @item interleave, i
  9626. Interleave fields. Reverse the effect of deinterleaving.
  9627. @end table
  9628. Default value is @code{none}.
  9629. @item luma_swap, ls
  9630. @item chroma_swap, cs
  9631. @item alpha_swap, as
  9632. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9633. @end table
  9634. @subsection Commands
  9635. This filter supports the all above options as @ref{commands}.
  9636. @section inflate
  9637. Apply inflate effect to the video.
  9638. This filter replaces the pixel by the local(3x3) average by taking into account
  9639. only values higher than the pixel.
  9640. It accepts the following options:
  9641. @table @option
  9642. @item threshold0
  9643. @item threshold1
  9644. @item threshold2
  9645. @item threshold3
  9646. Limit the maximum change for each plane, default is 65535.
  9647. If 0, plane will remain unchanged.
  9648. @end table
  9649. @subsection Commands
  9650. This filter supports the all above options as @ref{commands}.
  9651. @section interlace
  9652. Simple interlacing filter from progressive contents. This interleaves upper (or
  9653. lower) lines from odd frames with lower (or upper) lines from even frames,
  9654. halving the frame rate and preserving image height.
  9655. @example
  9656. Original Original New Frame
  9657. Frame 'j' Frame 'j+1' (tff)
  9658. ========== =========== ==================
  9659. Line 0 --------------------> Frame 'j' Line 0
  9660. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9661. Line 2 ---------------------> Frame 'j' Line 2
  9662. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9663. ... ... ...
  9664. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9665. @end example
  9666. It accepts the following optional parameters:
  9667. @table @option
  9668. @item scan
  9669. This determines whether the interlaced frame is taken from the even
  9670. (tff - default) or odd (bff) lines of the progressive frame.
  9671. @item lowpass
  9672. Vertical lowpass filter to avoid twitter interlacing and
  9673. reduce moire patterns.
  9674. @table @samp
  9675. @item 0, off
  9676. Disable vertical lowpass filter
  9677. @item 1, linear
  9678. Enable linear filter (default)
  9679. @item 2, complex
  9680. Enable complex filter. This will slightly less reduce twitter and moire
  9681. but better retain detail and subjective sharpness impression.
  9682. @end table
  9683. @end table
  9684. @section kerndeint
  9685. Deinterlace input video by applying Donald Graft's adaptive kernel
  9686. deinterling. Work on interlaced parts of a video to produce
  9687. progressive frames.
  9688. The description of the accepted parameters follows.
  9689. @table @option
  9690. @item thresh
  9691. Set the threshold which affects the filter's tolerance when
  9692. determining if a pixel line must be processed. It must be an integer
  9693. in the range [0,255] and defaults to 10. A value of 0 will result in
  9694. applying the process on every pixels.
  9695. @item map
  9696. Paint pixels exceeding the threshold value to white if set to 1.
  9697. Default is 0.
  9698. @item order
  9699. Set the fields order. Swap fields if set to 1, leave fields alone if
  9700. 0. Default is 0.
  9701. @item sharp
  9702. Enable additional sharpening if set to 1. Default is 0.
  9703. @item twoway
  9704. Enable twoway sharpening if set to 1. Default is 0.
  9705. @end table
  9706. @subsection Examples
  9707. @itemize
  9708. @item
  9709. Apply default values:
  9710. @example
  9711. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9712. @end example
  9713. @item
  9714. Enable additional sharpening:
  9715. @example
  9716. kerndeint=sharp=1
  9717. @end example
  9718. @item
  9719. Paint processed pixels in white:
  9720. @example
  9721. kerndeint=map=1
  9722. @end example
  9723. @end itemize
  9724. @section lagfun
  9725. Slowly update darker pixels.
  9726. This filter makes short flashes of light appear longer.
  9727. This filter accepts the following options:
  9728. @table @option
  9729. @item decay
  9730. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9731. @item planes
  9732. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9733. @end table
  9734. @section lenscorrection
  9735. Correct radial lens distortion
  9736. This filter can be used to correct for radial distortion as can result from the use
  9737. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9738. one can use tools available for example as part of opencv or simply trial-and-error.
  9739. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9740. and extract the k1 and k2 coefficients from the resulting matrix.
  9741. Note that effectively the same filter is available in the open-source tools Krita and
  9742. Digikam from the KDE project.
  9743. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9744. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9745. brightness distribution, so you may want to use both filters together in certain
  9746. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9747. be applied before or after lens correction.
  9748. @subsection Options
  9749. The filter accepts the following options:
  9750. @table @option
  9751. @item cx
  9752. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9753. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9754. width. Default is 0.5.
  9755. @item cy
  9756. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9757. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9758. height. Default is 0.5.
  9759. @item k1
  9760. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9761. no correction. Default is 0.
  9762. @item k2
  9763. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9764. 0 means no correction. Default is 0.
  9765. @end table
  9766. The formula that generates the correction is:
  9767. @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)
  9768. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9769. distances from the focal point in the source and target images, respectively.
  9770. @section lensfun
  9771. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9772. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9773. to apply the lens correction. The filter will load the lensfun database and
  9774. query it to find the corresponding camera and lens entries in the database. As
  9775. long as these entries can be found with the given options, the filter can
  9776. perform corrections on frames. Note that incomplete strings will result in the
  9777. filter choosing the best match with the given options, and the filter will
  9778. output the chosen camera and lens models (logged with level "info"). You must
  9779. provide the make, camera model, and lens model as they are required.
  9780. The filter accepts the following options:
  9781. @table @option
  9782. @item make
  9783. The make of the camera (for example, "Canon"). This option is required.
  9784. @item model
  9785. The model of the camera (for example, "Canon EOS 100D"). This option is
  9786. required.
  9787. @item lens_model
  9788. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9789. option is required.
  9790. @item mode
  9791. The type of correction to apply. The following values are valid options:
  9792. @table @samp
  9793. @item vignetting
  9794. Enables fixing lens vignetting.
  9795. @item geometry
  9796. Enables fixing lens geometry. This is the default.
  9797. @item subpixel
  9798. Enables fixing chromatic aberrations.
  9799. @item vig_geo
  9800. Enables fixing lens vignetting and lens geometry.
  9801. @item vig_subpixel
  9802. Enables fixing lens vignetting and chromatic aberrations.
  9803. @item distortion
  9804. Enables fixing both lens geometry and chromatic aberrations.
  9805. @item all
  9806. Enables all possible corrections.
  9807. @end table
  9808. @item focal_length
  9809. The focal length of the image/video (zoom; expected constant for video). For
  9810. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9811. range should be chosen when using that lens. Default 18.
  9812. @item aperture
  9813. The aperture of the image/video (expected constant for video). Note that
  9814. aperture is only used for vignetting correction. Default 3.5.
  9815. @item focus_distance
  9816. The focus distance of the image/video (expected constant for video). Note that
  9817. focus distance is only used for vignetting and only slightly affects the
  9818. vignetting correction process. If unknown, leave it at the default value (which
  9819. is 1000).
  9820. @item scale
  9821. The scale factor which is applied after transformation. After correction the
  9822. video is no longer necessarily rectangular. This parameter controls how much of
  9823. the resulting image is visible. The value 0 means that a value will be chosen
  9824. automatically such that there is little or no unmapped area in the output
  9825. image. 1.0 means that no additional scaling is done. Lower values may result
  9826. in more of the corrected image being visible, while higher values may avoid
  9827. unmapped areas in the output.
  9828. @item target_geometry
  9829. The target geometry of the output image/video. The following values are valid
  9830. options:
  9831. @table @samp
  9832. @item rectilinear (default)
  9833. @item fisheye
  9834. @item panoramic
  9835. @item equirectangular
  9836. @item fisheye_orthographic
  9837. @item fisheye_stereographic
  9838. @item fisheye_equisolid
  9839. @item fisheye_thoby
  9840. @end table
  9841. @item reverse
  9842. Apply the reverse of image correction (instead of correcting distortion, apply
  9843. it).
  9844. @item interpolation
  9845. The type of interpolation used when correcting distortion. The following values
  9846. are valid options:
  9847. @table @samp
  9848. @item nearest
  9849. @item linear (default)
  9850. @item lanczos
  9851. @end table
  9852. @end table
  9853. @subsection Examples
  9854. @itemize
  9855. @item
  9856. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9857. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9858. aperture of "8.0".
  9859. @example
  9860. 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
  9861. @end example
  9862. @item
  9863. Apply the same as before, but only for the first 5 seconds of video.
  9864. @example
  9865. 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
  9866. @end example
  9867. @end itemize
  9868. @section libvmaf
  9869. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9870. score between two input videos.
  9871. The obtained VMAF score is printed through the logging system.
  9872. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9873. After installing the library it can be enabled using:
  9874. @code{./configure --enable-libvmaf}.
  9875. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9876. The filter has following options:
  9877. @table @option
  9878. @item model_path
  9879. Set the model path which is to be used for SVM.
  9880. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9881. @item log_path
  9882. Set the file path to be used to store logs.
  9883. @item log_fmt
  9884. Set the format of the log file (csv, json or xml).
  9885. @item enable_transform
  9886. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9887. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9888. Default value: @code{false}
  9889. @item phone_model
  9890. Invokes the phone model which will generate VMAF scores higher than in the
  9891. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9892. Default value: @code{false}
  9893. @item psnr
  9894. Enables computing psnr along with vmaf.
  9895. Default value: @code{false}
  9896. @item ssim
  9897. Enables computing ssim along with vmaf.
  9898. Default value: @code{false}
  9899. @item ms_ssim
  9900. Enables computing ms_ssim along with vmaf.
  9901. Default value: @code{false}
  9902. @item pool
  9903. Set the pool method to be used for computing vmaf.
  9904. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9905. @item n_threads
  9906. Set number of threads to be used when computing vmaf.
  9907. Default value: @code{0}, which makes use of all available logical processors.
  9908. @item n_subsample
  9909. Set interval for frame subsampling used when computing vmaf.
  9910. Default value: @code{1}
  9911. @item enable_conf_interval
  9912. Enables confidence interval.
  9913. Default value: @code{false}
  9914. @end table
  9915. This filter also supports the @ref{framesync} options.
  9916. @subsection Examples
  9917. @itemize
  9918. @item
  9919. On the below examples the input file @file{main.mpg} being processed is
  9920. compared with the reference file @file{ref.mpg}.
  9921. @example
  9922. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9923. @end example
  9924. @item
  9925. Example with options:
  9926. @example
  9927. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9928. @end example
  9929. @item
  9930. Example with options and different containers:
  9931. @example
  9932. 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 -
  9933. @end example
  9934. @end itemize
  9935. @section limiter
  9936. Limits the pixel components values to the specified range [min, max].
  9937. The filter accepts the following options:
  9938. @table @option
  9939. @item min
  9940. Lower bound. Defaults to the lowest allowed value for the input.
  9941. @item max
  9942. Upper bound. Defaults to the highest allowed value for the input.
  9943. @item planes
  9944. Specify which planes will be processed. Defaults to all available.
  9945. @end table
  9946. @section loop
  9947. Loop video frames.
  9948. The filter accepts the following options:
  9949. @table @option
  9950. @item loop
  9951. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9952. Default is 0.
  9953. @item size
  9954. Set maximal size in number of frames. Default is 0.
  9955. @item start
  9956. Set first frame of loop. Default is 0.
  9957. @end table
  9958. @subsection Examples
  9959. @itemize
  9960. @item
  9961. Loop single first frame infinitely:
  9962. @example
  9963. loop=loop=-1:size=1:start=0
  9964. @end example
  9965. @item
  9966. Loop single first frame 10 times:
  9967. @example
  9968. loop=loop=10:size=1:start=0
  9969. @end example
  9970. @item
  9971. Loop 10 first frames 5 times:
  9972. @example
  9973. loop=loop=5:size=10:start=0
  9974. @end example
  9975. @end itemize
  9976. @section lut1d
  9977. Apply a 1D LUT to an input video.
  9978. The filter accepts the following options:
  9979. @table @option
  9980. @item file
  9981. Set the 1D LUT file name.
  9982. Currently supported formats:
  9983. @table @samp
  9984. @item cube
  9985. Iridas
  9986. @item csp
  9987. cineSpace
  9988. @end table
  9989. @item interp
  9990. Select interpolation mode.
  9991. Available values are:
  9992. @table @samp
  9993. @item nearest
  9994. Use values from the nearest defined point.
  9995. @item linear
  9996. Interpolate values using the linear interpolation.
  9997. @item cosine
  9998. Interpolate values using the cosine interpolation.
  9999. @item cubic
  10000. Interpolate values using the cubic interpolation.
  10001. @item spline
  10002. Interpolate values using the spline interpolation.
  10003. @end table
  10004. @end table
  10005. @anchor{lut3d}
  10006. @section lut3d
  10007. Apply a 3D LUT to an input video.
  10008. The filter accepts the following options:
  10009. @table @option
  10010. @item file
  10011. Set the 3D LUT file name.
  10012. Currently supported formats:
  10013. @table @samp
  10014. @item 3dl
  10015. AfterEffects
  10016. @item cube
  10017. Iridas
  10018. @item dat
  10019. DaVinci
  10020. @item m3d
  10021. Pandora
  10022. @item csp
  10023. cineSpace
  10024. @end table
  10025. @item interp
  10026. Select interpolation mode.
  10027. Available values are:
  10028. @table @samp
  10029. @item nearest
  10030. Use values from the nearest defined point.
  10031. @item trilinear
  10032. Interpolate values using the 8 points defining a cube.
  10033. @item tetrahedral
  10034. Interpolate values using a tetrahedron.
  10035. @end table
  10036. @end table
  10037. @section lumakey
  10038. Turn certain luma values into transparency.
  10039. The filter accepts the following options:
  10040. @table @option
  10041. @item threshold
  10042. Set the luma which will be used as base for transparency.
  10043. Default value is @code{0}.
  10044. @item tolerance
  10045. Set the range of luma values to be keyed out.
  10046. Default value is @code{0.01}.
  10047. @item softness
  10048. Set the range of softness. Default value is @code{0}.
  10049. Use this to control gradual transition from zero to full transparency.
  10050. @end table
  10051. @subsection Commands
  10052. This filter supports same @ref{commands} as options.
  10053. The command accepts the same syntax of the corresponding option.
  10054. If the specified expression is not valid, it is kept at its current
  10055. value.
  10056. @section lut, lutrgb, lutyuv
  10057. Compute a look-up table for binding each pixel component input value
  10058. to an output value, and apply it to the input video.
  10059. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10060. to an RGB input video.
  10061. These filters accept the following parameters:
  10062. @table @option
  10063. @item c0
  10064. set first pixel component expression
  10065. @item c1
  10066. set second pixel component expression
  10067. @item c2
  10068. set third pixel component expression
  10069. @item c3
  10070. set fourth pixel component expression, corresponds to the alpha component
  10071. @item r
  10072. set red component expression
  10073. @item g
  10074. set green component expression
  10075. @item b
  10076. set blue component expression
  10077. @item a
  10078. alpha component expression
  10079. @item y
  10080. set Y/luminance component expression
  10081. @item u
  10082. set U/Cb component expression
  10083. @item v
  10084. set V/Cr component expression
  10085. @end table
  10086. Each of them specifies the expression to use for computing the lookup table for
  10087. the corresponding pixel component values.
  10088. The exact component associated to each of the @var{c*} options depends on the
  10089. format in input.
  10090. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10091. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10092. The expressions can contain the following constants and functions:
  10093. @table @option
  10094. @item w
  10095. @item h
  10096. The input width and height.
  10097. @item val
  10098. The input value for the pixel component.
  10099. @item clipval
  10100. The input value, clipped to the @var{minval}-@var{maxval} range.
  10101. @item maxval
  10102. The maximum value for the pixel component.
  10103. @item minval
  10104. The minimum value for the pixel component.
  10105. @item negval
  10106. The negated value for the pixel component value, clipped to the
  10107. @var{minval}-@var{maxval} range; it corresponds to the expression
  10108. "maxval-clipval+minval".
  10109. @item clip(val)
  10110. The computed value in @var{val}, clipped to the
  10111. @var{minval}-@var{maxval} range.
  10112. @item gammaval(gamma)
  10113. The computed gamma correction value of the pixel component value,
  10114. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10115. expression
  10116. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10117. @end table
  10118. All expressions default to "val".
  10119. @subsection Examples
  10120. @itemize
  10121. @item
  10122. Negate input video:
  10123. @example
  10124. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10125. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10126. @end example
  10127. The above is the same as:
  10128. @example
  10129. lutrgb="r=negval:g=negval:b=negval"
  10130. lutyuv="y=negval:u=negval:v=negval"
  10131. @end example
  10132. @item
  10133. Negate luminance:
  10134. @example
  10135. lutyuv=y=negval
  10136. @end example
  10137. @item
  10138. Remove chroma components, turning the video into a graytone image:
  10139. @example
  10140. lutyuv="u=128:v=128"
  10141. @end example
  10142. @item
  10143. Apply a luma burning effect:
  10144. @example
  10145. lutyuv="y=2*val"
  10146. @end example
  10147. @item
  10148. Remove green and blue components:
  10149. @example
  10150. lutrgb="g=0:b=0"
  10151. @end example
  10152. @item
  10153. Set a constant alpha channel value on input:
  10154. @example
  10155. format=rgba,lutrgb=a="maxval-minval/2"
  10156. @end example
  10157. @item
  10158. Correct luminance gamma by a factor of 0.5:
  10159. @example
  10160. lutyuv=y=gammaval(0.5)
  10161. @end example
  10162. @item
  10163. Discard least significant bits of luma:
  10164. @example
  10165. lutyuv=y='bitand(val, 128+64+32)'
  10166. @end example
  10167. @item
  10168. Technicolor like effect:
  10169. @example
  10170. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10171. @end example
  10172. @end itemize
  10173. @section lut2, tlut2
  10174. The @code{lut2} filter takes two input streams and outputs one
  10175. stream.
  10176. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10177. from one single stream.
  10178. This filter accepts 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 d
  10189. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10190. which means bit depth is automatically picked from first input format.
  10191. @end table
  10192. The @code{lut2} filter also supports the @ref{framesync} options.
  10193. Each of them specifies the expression to use for computing the lookup table for
  10194. the corresponding pixel component values.
  10195. The exact component associated to each of the @var{c*} options depends on the
  10196. format in inputs.
  10197. The expressions can contain the following constants:
  10198. @table @option
  10199. @item w
  10200. @item h
  10201. The input width and height.
  10202. @item x
  10203. The first input value for the pixel component.
  10204. @item y
  10205. The second input value for the pixel component.
  10206. @item bdx
  10207. The first input video bit depth.
  10208. @item bdy
  10209. The second input video bit depth.
  10210. @end table
  10211. All expressions default to "x".
  10212. @subsection Examples
  10213. @itemize
  10214. @item
  10215. Highlight differences between two RGB video streams:
  10216. @example
  10217. 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)'
  10218. @end example
  10219. @item
  10220. Highlight differences between two YUV video streams:
  10221. @example
  10222. 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)'
  10223. @end example
  10224. @item
  10225. Show max difference between two video streams:
  10226. @example
  10227. 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)))'
  10228. @end example
  10229. @end itemize
  10230. @section maskedclamp
  10231. Clamp the first input stream with the second input and third input stream.
  10232. Returns the value of first stream to be between second input
  10233. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10234. This filter accepts the following options:
  10235. @table @option
  10236. @item undershoot
  10237. Default value is @code{0}.
  10238. @item overshoot
  10239. Default value is @code{0}.
  10240. @item planes
  10241. Set which planes will be processed as bitmap, unprocessed planes will be
  10242. copied from first stream.
  10243. By default value 0xf, all planes will be processed.
  10244. @end table
  10245. @section maskedmax
  10246. Merge the second and third input stream into output stream using absolute differences
  10247. between second input stream and first input stream and absolute difference between
  10248. third input stream and first input stream. The picked value will be from second input
  10249. stream if second absolute difference is greater than first one or from third input stream
  10250. otherwise.
  10251. This filter accepts the following options:
  10252. @table @option
  10253. @item planes
  10254. Set which planes will be processed as bitmap, unprocessed planes will be
  10255. copied from first stream.
  10256. By default value 0xf, all planes will be processed.
  10257. @end table
  10258. @section maskedmerge
  10259. Merge the first input stream with the second input stream using per pixel
  10260. weights in the third input stream.
  10261. A value of 0 in the third stream pixel component means that pixel component
  10262. from first stream is returned unchanged, while maximum value (eg. 255 for
  10263. 8-bit videos) means that pixel component from second stream is returned
  10264. unchanged. Intermediate values define the amount of merging between both
  10265. input stream's pixel components.
  10266. This filter accepts the following options:
  10267. @table @option
  10268. @item planes
  10269. Set which planes will be processed as bitmap, unprocessed planes will be
  10270. copied from first stream.
  10271. By default value 0xf, all planes will be processed.
  10272. @end table
  10273. @section maskedmin
  10274. Merge the second and third input stream into output stream using absolute differences
  10275. between second input stream and first input stream and absolute difference between
  10276. third input stream and first input stream. The picked value will be from second input
  10277. stream if second absolute difference is less than first one or from third input stream
  10278. otherwise.
  10279. This filter accepts the following options:
  10280. @table @option
  10281. @item planes
  10282. Set which planes will be processed as bitmap, unprocessed planes will be
  10283. copied from first stream.
  10284. By default value 0xf, all planes will be processed.
  10285. @end table
  10286. @section maskedthreshold
  10287. Pick pixels comparing absolute difference of two video streams with fixed
  10288. threshold.
  10289. If absolute difference between pixel component of first and second video
  10290. stream is equal or lower than user supplied threshold than pixel component
  10291. from first video stream is picked, otherwise pixel component from second
  10292. video stream is picked.
  10293. This filter accepts the following options:
  10294. @table @option
  10295. @item threshold
  10296. Set threshold used when picking pixels from absolute difference from two input
  10297. video streams.
  10298. @item planes
  10299. Set which planes will be processed as bitmap, unprocessed planes will be
  10300. copied from second stream.
  10301. By default value 0xf, all planes will be processed.
  10302. @end table
  10303. @section maskfun
  10304. Create mask from input video.
  10305. For example it is useful to create motion masks after @code{tblend} filter.
  10306. This filter accepts the following options:
  10307. @table @option
  10308. @item low
  10309. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10310. @item high
  10311. Set high threshold. Any pixel component higher than this value will be set to max value
  10312. allowed for current pixel format.
  10313. @item planes
  10314. Set planes to filter, by default all available planes are filtered.
  10315. @item fill
  10316. Fill all frame pixels with this value.
  10317. @item sum
  10318. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10319. average, output frame will be completely filled with value set by @var{fill} option.
  10320. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10321. @end table
  10322. @section mcdeint
  10323. Apply motion-compensation deinterlacing.
  10324. It needs one field per frame as input and must thus be used together
  10325. with yadif=1/3 or equivalent.
  10326. This filter accepts the following options:
  10327. @table @option
  10328. @item mode
  10329. Set the deinterlacing mode.
  10330. It accepts one of the following values:
  10331. @table @samp
  10332. @item fast
  10333. @item medium
  10334. @item slow
  10335. use iterative motion estimation
  10336. @item extra_slow
  10337. like @samp{slow}, but use multiple reference frames.
  10338. @end table
  10339. Default value is @samp{fast}.
  10340. @item parity
  10341. Set the picture field parity assumed for the input video. It must be
  10342. one of the following values:
  10343. @table @samp
  10344. @item 0, tff
  10345. assume top field first
  10346. @item 1, bff
  10347. assume bottom field first
  10348. @end table
  10349. Default value is @samp{bff}.
  10350. @item qp
  10351. Set per-block quantization parameter (QP) used by the internal
  10352. encoder.
  10353. Higher values should result in a smoother motion vector field but less
  10354. optimal individual vectors. Default value is 1.
  10355. @end table
  10356. @section median
  10357. Pick median pixel from certain rectangle defined by radius.
  10358. This filter accepts the following options:
  10359. @table @option
  10360. @item radius
  10361. Set horizontal radius size. Default value is @code{1}.
  10362. Allowed range is integer from 1 to 127.
  10363. @item planes
  10364. Set which planes to process. Default is @code{15}, which is all available planes.
  10365. @item radiusV
  10366. Set vertical radius size. Default value is @code{0}.
  10367. Allowed range is integer from 0 to 127.
  10368. If it is 0, value will be picked from horizontal @code{radius} option.
  10369. @item percentile
  10370. Set median percentile. Default value is @code{0.5}.
  10371. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10372. minimum values, and @code{1} maximum values.
  10373. @end table
  10374. @subsection Commands
  10375. This filter supports same @ref{commands} as options.
  10376. The command accepts the same syntax of the corresponding option.
  10377. If the specified expression is not valid, it is kept at its current
  10378. value.
  10379. @section mergeplanes
  10380. Merge color channel components from several video streams.
  10381. The filter accepts up to 4 input streams, and merge selected input
  10382. planes to the output video.
  10383. This filter accepts the following options:
  10384. @table @option
  10385. @item mapping
  10386. Set input to output plane mapping. Default is @code{0}.
  10387. The mappings is specified as a bitmap. It should be specified as a
  10388. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10389. mapping for the first plane of the output stream. 'A' sets the number of
  10390. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10391. corresponding input to use (from 0 to 3). The rest of the mappings is
  10392. similar, 'Bb' describes the mapping for the output stream second
  10393. plane, 'Cc' describes the mapping for the output stream third plane and
  10394. 'Dd' describes the mapping for the output stream fourth plane.
  10395. @item format
  10396. Set output pixel format. Default is @code{yuva444p}.
  10397. @end table
  10398. @subsection Examples
  10399. @itemize
  10400. @item
  10401. Merge three gray video streams of same width and height into single video stream:
  10402. @example
  10403. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10404. @end example
  10405. @item
  10406. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10407. @example
  10408. [a0][a1]mergeplanes=0x00010210:yuva444p
  10409. @end example
  10410. @item
  10411. Swap Y and A plane in yuva444p stream:
  10412. @example
  10413. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10414. @end example
  10415. @item
  10416. Swap U and V plane in yuv420p stream:
  10417. @example
  10418. format=yuv420p,mergeplanes=0x000201:yuv420p
  10419. @end example
  10420. @item
  10421. Cast a rgb24 clip to yuv444p:
  10422. @example
  10423. format=rgb24,mergeplanes=0x000102:yuv444p
  10424. @end example
  10425. @end itemize
  10426. @section mestimate
  10427. Estimate and export motion vectors using block matching algorithms.
  10428. Motion vectors are stored in frame side data to be used by other filters.
  10429. This filter accepts the following options:
  10430. @table @option
  10431. @item method
  10432. Specify the motion estimation method. Accepts one of the following values:
  10433. @table @samp
  10434. @item esa
  10435. Exhaustive search algorithm.
  10436. @item tss
  10437. Three step search algorithm.
  10438. @item tdls
  10439. Two dimensional logarithmic search algorithm.
  10440. @item ntss
  10441. New three step search algorithm.
  10442. @item fss
  10443. Four step search algorithm.
  10444. @item ds
  10445. Diamond search algorithm.
  10446. @item hexbs
  10447. Hexagon-based search algorithm.
  10448. @item epzs
  10449. Enhanced predictive zonal search algorithm.
  10450. @item umh
  10451. Uneven multi-hexagon search algorithm.
  10452. @end table
  10453. Default value is @samp{esa}.
  10454. @item mb_size
  10455. Macroblock size. Default @code{16}.
  10456. @item search_param
  10457. Search parameter. Default @code{7}.
  10458. @end table
  10459. @section midequalizer
  10460. Apply Midway Image Equalization effect using two video streams.
  10461. Midway Image Equalization adjusts a pair of images to have the same
  10462. histogram, while maintaining their dynamics as much as possible. It's
  10463. useful for e.g. matching exposures from a pair of stereo cameras.
  10464. This filter has two inputs and one output, which must be of same pixel format, but
  10465. may be of different sizes. The output of filter is first input adjusted with
  10466. midway histogram of both inputs.
  10467. This filter accepts the following option:
  10468. @table @option
  10469. @item planes
  10470. Set which planes to process. Default is @code{15}, which is all available planes.
  10471. @end table
  10472. @section minterpolate
  10473. Convert the video to specified frame rate using motion interpolation.
  10474. This filter accepts the following options:
  10475. @table @option
  10476. @item fps
  10477. 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}.
  10478. @item mi_mode
  10479. Motion interpolation mode. Following values are accepted:
  10480. @table @samp
  10481. @item dup
  10482. Duplicate previous or next frame for interpolating new ones.
  10483. @item blend
  10484. Blend source frames. Interpolated frame is mean of previous and next frames.
  10485. @item mci
  10486. Motion compensated interpolation. Following options are effective when this mode is selected:
  10487. @table @samp
  10488. @item mc_mode
  10489. Motion compensation mode. Following values are accepted:
  10490. @table @samp
  10491. @item obmc
  10492. Overlapped block motion compensation.
  10493. @item aobmc
  10494. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10495. @end table
  10496. Default mode is @samp{obmc}.
  10497. @item me_mode
  10498. Motion estimation mode. Following values are accepted:
  10499. @table @samp
  10500. @item bidir
  10501. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10502. @item bilat
  10503. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10504. @end table
  10505. Default mode is @samp{bilat}.
  10506. @item me
  10507. The algorithm to be used for motion estimation. Following values are accepted:
  10508. @table @samp
  10509. @item esa
  10510. Exhaustive search algorithm.
  10511. @item tss
  10512. Three step search algorithm.
  10513. @item tdls
  10514. Two dimensional logarithmic search algorithm.
  10515. @item ntss
  10516. New three step search algorithm.
  10517. @item fss
  10518. Four step search algorithm.
  10519. @item ds
  10520. Diamond search algorithm.
  10521. @item hexbs
  10522. Hexagon-based search algorithm.
  10523. @item epzs
  10524. Enhanced predictive zonal search algorithm.
  10525. @item umh
  10526. Uneven multi-hexagon search algorithm.
  10527. @end table
  10528. Default algorithm is @samp{epzs}.
  10529. @item mb_size
  10530. Macroblock size. Default @code{16}.
  10531. @item search_param
  10532. Motion estimation search parameter. Default @code{32}.
  10533. @item vsbmc
  10534. 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).
  10535. @end table
  10536. @end table
  10537. @item scd
  10538. 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:
  10539. @table @samp
  10540. @item none
  10541. Disable scene change detection.
  10542. @item fdiff
  10543. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10544. @end table
  10545. Default method is @samp{fdiff}.
  10546. @item scd_threshold
  10547. Scene change detection threshold. Default is @code{10.}.
  10548. @end table
  10549. @section mix
  10550. Mix several video input streams into one video stream.
  10551. A description of the accepted options follows.
  10552. @table @option
  10553. @item nb_inputs
  10554. The number of inputs. If unspecified, it defaults to 2.
  10555. @item weights
  10556. Specify weight of each input video stream as sequence.
  10557. Each weight is separated by space. If number of weights
  10558. is smaller than number of @var{frames} last specified
  10559. weight will be used for all remaining unset weights.
  10560. @item scale
  10561. Specify scale, if it is set it will be multiplied with sum
  10562. of each weight multiplied with pixel values to give final destination
  10563. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10564. @item duration
  10565. Specify how end of stream is determined.
  10566. @table @samp
  10567. @item longest
  10568. The duration of the longest input. (default)
  10569. @item shortest
  10570. The duration of the shortest input.
  10571. @item first
  10572. The duration of the first input.
  10573. @end table
  10574. @end table
  10575. @section mpdecimate
  10576. Drop frames that do not differ greatly from the previous frame in
  10577. order to reduce frame rate.
  10578. The main use of this filter is for very-low-bitrate encoding
  10579. (e.g. streaming over dialup modem), but it could in theory be used for
  10580. fixing movies that were inverse-telecined incorrectly.
  10581. A description of the accepted options follows.
  10582. @table @option
  10583. @item max
  10584. Set the maximum number of consecutive frames which can be dropped (if
  10585. positive), or the minimum interval between dropped frames (if
  10586. negative). If the value is 0, the frame is dropped disregarding the
  10587. number of previous sequentially dropped frames.
  10588. Default value is 0.
  10589. @item hi
  10590. @item lo
  10591. @item frac
  10592. Set the dropping threshold values.
  10593. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10594. represent actual pixel value differences, so a threshold of 64
  10595. corresponds to 1 unit of difference for each pixel, or the same spread
  10596. out differently over the block.
  10597. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10598. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10599. meaning the whole image) differ by more than a threshold of @option{lo}.
  10600. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10601. 64*5, and default value for @option{frac} is 0.33.
  10602. @end table
  10603. @section negate
  10604. Negate (invert) the input video.
  10605. It accepts the following option:
  10606. @table @option
  10607. @item negate_alpha
  10608. With value 1, it negates the alpha component, if present. Default value is 0.
  10609. @end table
  10610. @anchor{nlmeans}
  10611. @section nlmeans
  10612. Denoise frames using Non-Local Means algorithm.
  10613. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10614. context similarity is defined by comparing their surrounding patches of size
  10615. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10616. around the pixel.
  10617. Note that the research area defines centers for patches, which means some
  10618. patches will be made of pixels outside that research area.
  10619. The filter accepts the following options.
  10620. @table @option
  10621. @item s
  10622. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10623. @item p
  10624. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10625. @item pc
  10626. Same as @option{p} but for chroma planes.
  10627. The default value is @var{0} and means automatic.
  10628. @item r
  10629. Set research size. Default is 15. Must be odd number in range [0, 99].
  10630. @item rc
  10631. Same as @option{r} but for chroma planes.
  10632. The default value is @var{0} and means automatic.
  10633. @end table
  10634. @section nnedi
  10635. Deinterlace video using neural network edge directed interpolation.
  10636. This filter accepts the following options:
  10637. @table @option
  10638. @item weights
  10639. Mandatory option, without binary file filter can not work.
  10640. Currently file can be found here:
  10641. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10642. @item deint
  10643. Set which frames to deinterlace, by default it is @code{all}.
  10644. Can be @code{all} or @code{interlaced}.
  10645. @item field
  10646. Set mode of operation.
  10647. Can be one of the following:
  10648. @table @samp
  10649. @item af
  10650. Use frame flags, both fields.
  10651. @item a
  10652. Use frame flags, single field.
  10653. @item t
  10654. Use top field only.
  10655. @item b
  10656. Use bottom field only.
  10657. @item tf
  10658. Use both fields, top first.
  10659. @item bf
  10660. Use both fields, bottom first.
  10661. @end table
  10662. @item planes
  10663. Set which planes to process, by default filter process all frames.
  10664. @item nsize
  10665. Set size of local neighborhood around each pixel, used by the predictor neural
  10666. network.
  10667. Can be one of the following:
  10668. @table @samp
  10669. @item s8x6
  10670. @item s16x6
  10671. @item s32x6
  10672. @item s48x6
  10673. @item s8x4
  10674. @item s16x4
  10675. @item s32x4
  10676. @end table
  10677. @item nns
  10678. Set the number of neurons in predictor neural network.
  10679. Can be one of the following:
  10680. @table @samp
  10681. @item n16
  10682. @item n32
  10683. @item n64
  10684. @item n128
  10685. @item n256
  10686. @end table
  10687. @item qual
  10688. Controls the number of different neural network predictions that are blended
  10689. together to compute the final output value. Can be @code{fast}, default or
  10690. @code{slow}.
  10691. @item etype
  10692. Set which set of weights to use in the predictor.
  10693. Can be one of the following:
  10694. @table @samp
  10695. @item a
  10696. weights trained to minimize absolute error
  10697. @item s
  10698. weights trained to minimize squared error
  10699. @end table
  10700. @item pscrn
  10701. Controls whether or not the prescreener neural network is used to decide
  10702. which pixels should be processed by the predictor neural network and which
  10703. can be handled by simple cubic interpolation.
  10704. The prescreener is trained to know whether cubic interpolation will be
  10705. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10706. The computational complexity of the prescreener nn is much less than that of
  10707. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10708. using the prescreener generally results in much faster processing.
  10709. The prescreener is pretty accurate, so the difference between using it and not
  10710. using it is almost always unnoticeable.
  10711. Can be one of the following:
  10712. @table @samp
  10713. @item none
  10714. @item original
  10715. @item new
  10716. @end table
  10717. Default is @code{new}.
  10718. @item fapprox
  10719. Set various debugging flags.
  10720. @end table
  10721. @section noformat
  10722. Force libavfilter not to use any of the specified pixel formats for the
  10723. input to the next filter.
  10724. It accepts the following parameters:
  10725. @table @option
  10726. @item pix_fmts
  10727. A '|'-separated list of pixel format names, such as
  10728. pix_fmts=yuv420p|monow|rgb24".
  10729. @end table
  10730. @subsection Examples
  10731. @itemize
  10732. @item
  10733. Force libavfilter to use a format different from @var{yuv420p} for the
  10734. input to the vflip filter:
  10735. @example
  10736. noformat=pix_fmts=yuv420p,vflip
  10737. @end example
  10738. @item
  10739. Convert the input video to any of the formats not contained in the list:
  10740. @example
  10741. noformat=yuv420p|yuv444p|yuv410p
  10742. @end example
  10743. @end itemize
  10744. @section noise
  10745. Add noise on video input frame.
  10746. The filter accepts the following options:
  10747. @table @option
  10748. @item all_seed
  10749. @item c0_seed
  10750. @item c1_seed
  10751. @item c2_seed
  10752. @item c3_seed
  10753. Set noise seed for specific pixel component or all pixel components in case
  10754. of @var{all_seed}. Default value is @code{123457}.
  10755. @item all_strength, alls
  10756. @item c0_strength, c0s
  10757. @item c1_strength, c1s
  10758. @item c2_strength, c2s
  10759. @item c3_strength, c3s
  10760. Set noise strength for specific pixel component or all pixel components in case
  10761. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10762. @item all_flags, allf
  10763. @item c0_flags, c0f
  10764. @item c1_flags, c1f
  10765. @item c2_flags, c2f
  10766. @item c3_flags, c3f
  10767. Set pixel component flags or set flags for all components if @var{all_flags}.
  10768. Available values for component flags are:
  10769. @table @samp
  10770. @item a
  10771. averaged temporal noise (smoother)
  10772. @item p
  10773. mix random noise with a (semi)regular pattern
  10774. @item t
  10775. temporal noise (noise pattern changes between frames)
  10776. @item u
  10777. uniform noise (gaussian otherwise)
  10778. @end table
  10779. @end table
  10780. @subsection Examples
  10781. Add temporal and uniform noise to input video:
  10782. @example
  10783. noise=alls=20:allf=t+u
  10784. @end example
  10785. @section normalize
  10786. Normalize RGB video (aka histogram stretching, contrast stretching).
  10787. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10788. For each channel of each frame, the filter computes the input range and maps
  10789. it linearly to the user-specified output range. The output range defaults
  10790. to the full dynamic range from pure black to pure white.
  10791. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10792. changes in brightness) caused when small dark or bright objects enter or leave
  10793. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10794. video camera, and, like a video camera, it may cause a period of over- or
  10795. under-exposure of the video.
  10796. The R,G,B channels can be normalized independently, which may cause some
  10797. color shifting, or linked together as a single channel, which prevents
  10798. color shifting. Linked normalization preserves hue. Independent normalization
  10799. does not, so it can be used to remove some color casts. Independent and linked
  10800. normalization can be combined in any ratio.
  10801. The normalize filter accepts the following options:
  10802. @table @option
  10803. @item blackpt
  10804. @item whitept
  10805. Colors which define the output range. The minimum input value is mapped to
  10806. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10807. The defaults are black and white respectively. Specifying white for
  10808. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10809. normalized video. Shades of grey can be used to reduce the dynamic range
  10810. (contrast). Specifying saturated colors here can create some interesting
  10811. effects.
  10812. @item smoothing
  10813. The number of previous frames to use for temporal smoothing. The input range
  10814. of each channel is smoothed using a rolling average over the current frame
  10815. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10816. smoothing).
  10817. @item independence
  10818. Controls the ratio of independent (color shifting) channel normalization to
  10819. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10820. independent. Defaults to 1.0 (fully independent).
  10821. @item strength
  10822. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10823. expensive no-op. Defaults to 1.0 (full strength).
  10824. @end table
  10825. @subsection Commands
  10826. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10827. The command accepts the same syntax of the corresponding option.
  10828. If the specified expression is not valid, it is kept at its current
  10829. value.
  10830. @subsection Examples
  10831. Stretch video contrast to use the full dynamic range, with no temporal
  10832. smoothing; may flicker depending on the source content:
  10833. @example
  10834. normalize=blackpt=black:whitept=white:smoothing=0
  10835. @end example
  10836. As above, but with 50 frames of temporal smoothing; flicker should be
  10837. reduced, depending on the source content:
  10838. @example
  10839. normalize=blackpt=black:whitept=white:smoothing=50
  10840. @end example
  10841. As above, but with hue-preserving linked channel normalization:
  10842. @example
  10843. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10844. @end example
  10845. As above, but with half strength:
  10846. @example
  10847. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10848. @end example
  10849. Map the darkest input color to red, the brightest input color to cyan:
  10850. @example
  10851. normalize=blackpt=red:whitept=cyan
  10852. @end example
  10853. @section null
  10854. Pass the video source unchanged to the output.
  10855. @section ocr
  10856. Optical Character Recognition
  10857. This filter uses Tesseract for optical character recognition. To enable
  10858. compilation of this filter, you need to configure FFmpeg with
  10859. @code{--enable-libtesseract}.
  10860. It accepts the following options:
  10861. @table @option
  10862. @item datapath
  10863. Set datapath to tesseract data. Default is to use whatever was
  10864. set at installation.
  10865. @item language
  10866. Set language, default is "eng".
  10867. @item whitelist
  10868. Set character whitelist.
  10869. @item blacklist
  10870. Set character blacklist.
  10871. @end table
  10872. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10873. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10874. @section ocv
  10875. Apply a video transform using libopencv.
  10876. To enable this filter, install the libopencv library and headers and
  10877. configure FFmpeg with @code{--enable-libopencv}.
  10878. It accepts the following parameters:
  10879. @table @option
  10880. @item filter_name
  10881. The name of the libopencv filter to apply.
  10882. @item filter_params
  10883. The parameters to pass to the libopencv filter. If not specified, the default
  10884. values are assumed.
  10885. @end table
  10886. Refer to the official libopencv documentation for more precise
  10887. information:
  10888. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10889. Several libopencv filters are supported; see the following subsections.
  10890. @anchor{dilate}
  10891. @subsection dilate
  10892. Dilate an image by using a specific structuring element.
  10893. It corresponds to the libopencv function @code{cvDilate}.
  10894. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10895. @var{struct_el} represents a structuring element, and has the syntax:
  10896. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10897. @var{cols} and @var{rows} represent the number of columns and rows of
  10898. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10899. point, and @var{shape} the shape for the structuring element. @var{shape}
  10900. must be "rect", "cross", "ellipse", or "custom".
  10901. If the value for @var{shape} is "custom", it must be followed by a
  10902. string of the form "=@var{filename}". The file with name
  10903. @var{filename} is assumed to represent a binary image, with each
  10904. printable character corresponding to a bright pixel. When a custom
  10905. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10906. or columns and rows of the read file are assumed instead.
  10907. The default value for @var{struct_el} is "3x3+0x0/rect".
  10908. @var{nb_iterations} specifies the number of times the transform is
  10909. applied to the image, and defaults to 1.
  10910. Some examples:
  10911. @example
  10912. # Use the default values
  10913. ocv=dilate
  10914. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10915. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10916. # Read the shape from the file diamond.shape, iterating two times.
  10917. # The file diamond.shape may contain a pattern of characters like this
  10918. # *
  10919. # ***
  10920. # *****
  10921. # ***
  10922. # *
  10923. # The specified columns and rows are ignored
  10924. # but the anchor point coordinates are not
  10925. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10926. @end example
  10927. @subsection erode
  10928. Erode an image by using a specific structuring element.
  10929. It corresponds to the libopencv function @code{cvErode}.
  10930. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10931. with the same syntax and semantics as the @ref{dilate} filter.
  10932. @subsection smooth
  10933. Smooth the input video.
  10934. The filter takes the following parameters:
  10935. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10936. @var{type} is the type of smooth filter to apply, and must be one of
  10937. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10938. or "bilateral". The default value is "gaussian".
  10939. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10940. depends on the smooth type. @var{param1} and
  10941. @var{param2} accept integer positive values or 0. @var{param3} and
  10942. @var{param4} accept floating point values.
  10943. The default value for @var{param1} is 3. The default value for the
  10944. other parameters is 0.
  10945. These parameters correspond to the parameters assigned to the
  10946. libopencv function @code{cvSmooth}.
  10947. @section oscilloscope
  10948. 2D Video Oscilloscope.
  10949. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10950. It accepts the following parameters:
  10951. @table @option
  10952. @item x
  10953. Set scope center x position.
  10954. @item y
  10955. Set scope center y position.
  10956. @item s
  10957. Set scope size, relative to frame diagonal.
  10958. @item t
  10959. Set scope tilt/rotation.
  10960. @item o
  10961. Set trace opacity.
  10962. @item tx
  10963. Set trace center x position.
  10964. @item ty
  10965. Set trace center y position.
  10966. @item tw
  10967. Set trace width, relative to width of frame.
  10968. @item th
  10969. Set trace height, relative to height of frame.
  10970. @item c
  10971. Set which components to trace. By default it traces first three components.
  10972. @item g
  10973. Draw trace grid. By default is enabled.
  10974. @item st
  10975. Draw some statistics. By default is enabled.
  10976. @item sc
  10977. Draw scope. By default is enabled.
  10978. @end table
  10979. @subsection Commands
  10980. This filter supports same @ref{commands} as options.
  10981. The command accepts the same syntax of the corresponding option.
  10982. If the specified expression is not valid, it is kept at its current
  10983. value.
  10984. @subsection Examples
  10985. @itemize
  10986. @item
  10987. Inspect full first row of video frame.
  10988. @example
  10989. oscilloscope=x=0.5:y=0:s=1
  10990. @end example
  10991. @item
  10992. Inspect full last row of video frame.
  10993. @example
  10994. oscilloscope=x=0.5:y=1:s=1
  10995. @end example
  10996. @item
  10997. Inspect full 5th line of video frame of height 1080.
  10998. @example
  10999. oscilloscope=x=0.5:y=5/1080:s=1
  11000. @end example
  11001. @item
  11002. Inspect full last column of video frame.
  11003. @example
  11004. oscilloscope=x=1:y=0.5:s=1:t=1
  11005. @end example
  11006. @end itemize
  11007. @anchor{overlay}
  11008. @section overlay
  11009. Overlay one video on top of another.
  11010. It takes two inputs and has one output. The first input is the "main"
  11011. video on which the second input is overlaid.
  11012. It accepts the following parameters:
  11013. A description of the accepted options follows.
  11014. @table @option
  11015. @item x
  11016. @item y
  11017. Set the expression for the x and y coordinates of the overlaid video
  11018. on the main video. Default value is "0" for both expressions. In case
  11019. the expression is invalid, it is set to a huge value (meaning that the
  11020. overlay will not be displayed within the output visible area).
  11021. @item eof_action
  11022. See @ref{framesync}.
  11023. @item eval
  11024. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11025. It accepts the following values:
  11026. @table @samp
  11027. @item init
  11028. only evaluate expressions once during the filter initialization or
  11029. when a command is processed
  11030. @item frame
  11031. evaluate expressions for each incoming frame
  11032. @end table
  11033. Default value is @samp{frame}.
  11034. @item shortest
  11035. See @ref{framesync}.
  11036. @item format
  11037. Set the format for the output video.
  11038. It accepts the following values:
  11039. @table @samp
  11040. @item yuv420
  11041. force YUV420 output
  11042. @item yuv420p10
  11043. force YUV420p10 output
  11044. @item yuv422
  11045. force YUV422 output
  11046. @item yuv422p10
  11047. force YUV422p10 output
  11048. @item yuv444
  11049. force YUV444 output
  11050. @item rgb
  11051. force packed RGB output
  11052. @item gbrp
  11053. force planar RGB output
  11054. @item auto
  11055. automatically pick format
  11056. @end table
  11057. Default value is @samp{yuv420}.
  11058. @item repeatlast
  11059. See @ref{framesync}.
  11060. @item alpha
  11061. Set format of alpha of the overlaid video, it can be @var{straight} or
  11062. @var{premultiplied}. Default is @var{straight}.
  11063. @end table
  11064. The @option{x}, and @option{y} expressions can contain the following
  11065. parameters.
  11066. @table @option
  11067. @item main_w, W
  11068. @item main_h, H
  11069. The main input width and height.
  11070. @item overlay_w, w
  11071. @item overlay_h, h
  11072. The overlay input width and height.
  11073. @item x
  11074. @item y
  11075. The computed values for @var{x} and @var{y}. They are evaluated for
  11076. each new frame.
  11077. @item hsub
  11078. @item vsub
  11079. horizontal and vertical chroma subsample values of the output
  11080. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11081. @var{vsub} is 1.
  11082. @item n
  11083. the number of input frame, starting from 0
  11084. @item pos
  11085. the position in the file of the input frame, NAN if unknown
  11086. @item t
  11087. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11088. @end table
  11089. This filter also supports the @ref{framesync} options.
  11090. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11091. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11092. when @option{eval} is set to @samp{init}.
  11093. Be aware that frames are taken from each input video in timestamp
  11094. order, hence, if their initial timestamps differ, it is a good idea
  11095. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11096. have them begin in the same zero timestamp, as the example for
  11097. the @var{movie} filter does.
  11098. You can chain together more overlays but you should test the
  11099. efficiency of such approach.
  11100. @subsection Commands
  11101. This filter supports the following commands:
  11102. @table @option
  11103. @item x
  11104. @item y
  11105. Modify the x and y of the overlay input.
  11106. The command accepts the same syntax of the corresponding option.
  11107. If the specified expression is not valid, it is kept at its current
  11108. value.
  11109. @end table
  11110. @subsection Examples
  11111. @itemize
  11112. @item
  11113. Draw the overlay at 10 pixels from the bottom right corner of the main
  11114. video:
  11115. @example
  11116. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11117. @end example
  11118. Using named options the example above becomes:
  11119. @example
  11120. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11121. @end example
  11122. @item
  11123. Insert a transparent PNG logo in the bottom left corner of the input,
  11124. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11125. @example
  11126. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11127. @end example
  11128. @item
  11129. Insert 2 different transparent PNG logos (second logo on bottom
  11130. right corner) using the @command{ffmpeg} tool:
  11131. @example
  11132. 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
  11133. @end example
  11134. @item
  11135. Add a transparent color layer on top of the main video; @code{WxH}
  11136. must specify the size of the main input to the overlay filter:
  11137. @example
  11138. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11139. @end example
  11140. @item
  11141. Play an original video and a filtered version (here with the deshake
  11142. filter) side by side using the @command{ffplay} tool:
  11143. @example
  11144. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11145. @end example
  11146. The above command is the same as:
  11147. @example
  11148. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11149. @end example
  11150. @item
  11151. Make a sliding overlay appearing from the left to the right top part of the
  11152. screen starting since time 2:
  11153. @example
  11154. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11155. @end example
  11156. @item
  11157. Compose output by putting two input videos side to side:
  11158. @example
  11159. ffmpeg -i left.avi -i right.avi -filter_complex "
  11160. nullsrc=size=200x100 [background];
  11161. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11162. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11163. [background][left] overlay=shortest=1 [background+left];
  11164. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11165. "
  11166. @end example
  11167. @item
  11168. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11169. @example
  11170. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11171. -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]'
  11172. masked.avi
  11173. @end example
  11174. @item
  11175. Chain several overlays in cascade:
  11176. @example
  11177. nullsrc=s=200x200 [bg];
  11178. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11179. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11180. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11181. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11182. [in3] null, [mid2] overlay=100:100 [out0]
  11183. @end example
  11184. @end itemize
  11185. @anchor{overlay_cuda}
  11186. @section overlay_cuda
  11187. Overlay one video on top of another.
  11188. This is the CUDA cariant of the @ref{overlay} filter.
  11189. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11190. It takes two inputs and has one output. The first input is the "main"
  11191. video on which the second input is overlaid.
  11192. It accepts the following parameters:
  11193. @table @option
  11194. @item x
  11195. @item y
  11196. Set the x and y coordinates of the overlaid video on the main video.
  11197. Default value is "0" for both expressions.
  11198. @item eof_action
  11199. See @ref{framesync}.
  11200. @item shortest
  11201. See @ref{framesync}.
  11202. @item repeatlast
  11203. See @ref{framesync}.
  11204. @end table
  11205. This filter also supports the @ref{framesync} options.
  11206. @section owdenoise
  11207. Apply Overcomplete Wavelet denoiser.
  11208. The filter accepts the following options:
  11209. @table @option
  11210. @item depth
  11211. Set depth.
  11212. Larger depth values will denoise lower frequency components more, but
  11213. slow down filtering.
  11214. Must be an int in the range 8-16, default is @code{8}.
  11215. @item luma_strength, ls
  11216. Set luma strength.
  11217. Must be a double value in the range 0-1000, default is @code{1.0}.
  11218. @item chroma_strength, cs
  11219. Set chroma strength.
  11220. Must be a double value in the range 0-1000, default is @code{1.0}.
  11221. @end table
  11222. @anchor{pad}
  11223. @section pad
  11224. Add paddings to the input image, and place the original input at the
  11225. provided @var{x}, @var{y} coordinates.
  11226. It accepts the following parameters:
  11227. @table @option
  11228. @item width, w
  11229. @item height, h
  11230. Specify an expression for the size of the output image with the
  11231. paddings added. If the value for @var{width} or @var{height} is 0, the
  11232. corresponding input size is used for the output.
  11233. The @var{width} expression can reference the value set by the
  11234. @var{height} expression, and vice versa.
  11235. The default value of @var{width} and @var{height} is 0.
  11236. @item x
  11237. @item y
  11238. Specify the offsets to place the input image at within the padded area,
  11239. with respect to the top/left border of the output image.
  11240. The @var{x} expression can reference the value set by the @var{y}
  11241. expression, and vice versa.
  11242. The default value of @var{x} and @var{y} is 0.
  11243. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11244. so the input image is centered on the padded area.
  11245. @item color
  11246. Specify the color of the padded area. For the syntax of this option,
  11247. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11248. manual,ffmpeg-utils}.
  11249. The default value of @var{color} is "black".
  11250. @item eval
  11251. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11252. It accepts the following values:
  11253. @table @samp
  11254. @item init
  11255. Only evaluate expressions once during the filter initialization or when
  11256. a command is processed.
  11257. @item frame
  11258. Evaluate expressions for each incoming frame.
  11259. @end table
  11260. Default value is @samp{init}.
  11261. @item aspect
  11262. Pad to aspect instead to a resolution.
  11263. @end table
  11264. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11265. options are expressions containing the following constants:
  11266. @table @option
  11267. @item in_w
  11268. @item in_h
  11269. The input video width and height.
  11270. @item iw
  11271. @item ih
  11272. These are the same as @var{in_w} and @var{in_h}.
  11273. @item out_w
  11274. @item out_h
  11275. The output width and height (the size of the padded area), as
  11276. specified by the @var{width} and @var{height} expressions.
  11277. @item ow
  11278. @item oh
  11279. These are the same as @var{out_w} and @var{out_h}.
  11280. @item x
  11281. @item y
  11282. The x and y offsets as specified by the @var{x} and @var{y}
  11283. expressions, or NAN if not yet specified.
  11284. @item a
  11285. same as @var{iw} / @var{ih}
  11286. @item sar
  11287. input sample aspect ratio
  11288. @item dar
  11289. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11290. @item hsub
  11291. @item vsub
  11292. The horizontal and vertical chroma subsample values. For example for the
  11293. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11294. @end table
  11295. @subsection Examples
  11296. @itemize
  11297. @item
  11298. Add paddings with the color "violet" to the input video. The output video
  11299. size is 640x480, and the top-left corner of the input video is placed at
  11300. column 0, row 40
  11301. @example
  11302. pad=640:480:0:40:violet
  11303. @end example
  11304. The example above is equivalent to the following command:
  11305. @example
  11306. pad=width=640:height=480:x=0:y=40:color=violet
  11307. @end example
  11308. @item
  11309. Pad the input to get an output with dimensions increased by 3/2,
  11310. and put the input video at the center of the padded area:
  11311. @example
  11312. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11313. @end example
  11314. @item
  11315. Pad the input to get a squared output with size equal to the maximum
  11316. value between the input width and height, and put the input video at
  11317. the center of the padded area:
  11318. @example
  11319. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11320. @end example
  11321. @item
  11322. Pad the input to get a final w/h ratio of 16:9:
  11323. @example
  11324. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11325. @end example
  11326. @item
  11327. In case of anamorphic video, in order to set the output display aspect
  11328. correctly, it is necessary to use @var{sar} in the expression,
  11329. according to the relation:
  11330. @example
  11331. (ih * X / ih) * sar = output_dar
  11332. X = output_dar / sar
  11333. @end example
  11334. Thus the previous example needs to be modified to:
  11335. @example
  11336. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11337. @end example
  11338. @item
  11339. Double the output size and put the input video in the bottom-right
  11340. corner of the output padded area:
  11341. @example
  11342. pad="2*iw:2*ih:ow-iw:oh-ih"
  11343. @end example
  11344. @end itemize
  11345. @anchor{palettegen}
  11346. @section palettegen
  11347. Generate one palette for a whole video stream.
  11348. It accepts the following options:
  11349. @table @option
  11350. @item max_colors
  11351. Set the maximum number of colors to quantize in the palette.
  11352. Note: the palette will still contain 256 colors; the unused palette entries
  11353. will be black.
  11354. @item reserve_transparent
  11355. Create a palette of 255 colors maximum and reserve the last one for
  11356. transparency. Reserving the transparency color is useful for GIF optimization.
  11357. If not set, the maximum of colors in the palette will be 256. You probably want
  11358. to disable this option for a standalone image.
  11359. Set by default.
  11360. @item transparency_color
  11361. Set the color that will be used as background for transparency.
  11362. @item stats_mode
  11363. Set statistics mode.
  11364. It accepts the following values:
  11365. @table @samp
  11366. @item full
  11367. Compute full frame histograms.
  11368. @item diff
  11369. Compute histograms only for the part that differs from previous frame. This
  11370. might be relevant to give more importance to the moving part of your input if
  11371. the background is static.
  11372. @item single
  11373. Compute new histogram for each frame.
  11374. @end table
  11375. Default value is @var{full}.
  11376. @end table
  11377. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11378. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11379. color quantization of the palette. This information is also visible at
  11380. @var{info} logging level.
  11381. @subsection Examples
  11382. @itemize
  11383. @item
  11384. Generate a representative palette of a given video using @command{ffmpeg}:
  11385. @example
  11386. ffmpeg -i input.mkv -vf palettegen palette.png
  11387. @end example
  11388. @end itemize
  11389. @section paletteuse
  11390. Use a palette to downsample an input video stream.
  11391. The filter takes two inputs: one video stream and a palette. The palette must
  11392. be a 256 pixels image.
  11393. It accepts the following options:
  11394. @table @option
  11395. @item dither
  11396. Select dithering mode. Available algorithms are:
  11397. @table @samp
  11398. @item bayer
  11399. Ordered 8x8 bayer dithering (deterministic)
  11400. @item heckbert
  11401. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11402. Note: this dithering is sometimes considered "wrong" and is included as a
  11403. reference.
  11404. @item floyd_steinberg
  11405. Floyd and Steingberg dithering (error diffusion)
  11406. @item sierra2
  11407. Frankie Sierra dithering v2 (error diffusion)
  11408. @item sierra2_4a
  11409. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11410. @end table
  11411. Default is @var{sierra2_4a}.
  11412. @item bayer_scale
  11413. When @var{bayer} dithering is selected, this option defines the scale of the
  11414. pattern (how much the crosshatch pattern is visible). A low value means more
  11415. visible pattern for less banding, and higher value means less visible pattern
  11416. at the cost of more banding.
  11417. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11418. @item diff_mode
  11419. If set, define the zone to process
  11420. @table @samp
  11421. @item rectangle
  11422. Only the changing rectangle will be reprocessed. This is similar to GIF
  11423. cropping/offsetting compression mechanism. This option can be useful for speed
  11424. if only a part of the image is changing, and has use cases such as limiting the
  11425. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11426. moving scene (it leads to more deterministic output if the scene doesn't change
  11427. much, and as a result less moving noise and better GIF compression).
  11428. @end table
  11429. Default is @var{none}.
  11430. @item new
  11431. Take new palette for each output frame.
  11432. @item alpha_threshold
  11433. Sets the alpha threshold for transparency. Alpha values above this threshold
  11434. will be treated as completely opaque, and values below this threshold will be
  11435. treated as completely transparent.
  11436. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11437. @end table
  11438. @subsection Examples
  11439. @itemize
  11440. @item
  11441. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11442. using @command{ffmpeg}:
  11443. @example
  11444. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11445. @end example
  11446. @end itemize
  11447. @section perspective
  11448. Correct perspective of video not recorded perpendicular to the screen.
  11449. A description of the accepted parameters follows.
  11450. @table @option
  11451. @item x0
  11452. @item y0
  11453. @item x1
  11454. @item y1
  11455. @item x2
  11456. @item y2
  11457. @item x3
  11458. @item y3
  11459. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11460. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11461. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11462. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11463. then the corners of the source will be sent to the specified coordinates.
  11464. The expressions can use the following variables:
  11465. @table @option
  11466. @item W
  11467. @item H
  11468. the width and height of video frame.
  11469. @item in
  11470. Input frame count.
  11471. @item on
  11472. Output frame count.
  11473. @end table
  11474. @item interpolation
  11475. Set interpolation for perspective correction.
  11476. It accepts the following values:
  11477. @table @samp
  11478. @item linear
  11479. @item cubic
  11480. @end table
  11481. Default value is @samp{linear}.
  11482. @item sense
  11483. Set interpretation of coordinate options.
  11484. It accepts the following values:
  11485. @table @samp
  11486. @item 0, source
  11487. Send point in the source specified by the given coordinates to
  11488. the corners of the destination.
  11489. @item 1, destination
  11490. Send the corners of the source to the point in the destination specified
  11491. by the given coordinates.
  11492. Default value is @samp{source}.
  11493. @end table
  11494. @item eval
  11495. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11496. It accepts the following values:
  11497. @table @samp
  11498. @item init
  11499. only evaluate expressions once during the filter initialization or
  11500. when a command is processed
  11501. @item frame
  11502. evaluate expressions for each incoming frame
  11503. @end table
  11504. Default value is @samp{init}.
  11505. @end table
  11506. @section phase
  11507. Delay interlaced video by one field time so that the field order changes.
  11508. The intended use is to fix PAL movies that have been captured with the
  11509. opposite field order to the film-to-video transfer.
  11510. A description of the accepted parameters follows.
  11511. @table @option
  11512. @item mode
  11513. Set phase mode.
  11514. It accepts the following values:
  11515. @table @samp
  11516. @item t
  11517. Capture field order top-first, transfer bottom-first.
  11518. Filter will delay the bottom field.
  11519. @item b
  11520. Capture field order bottom-first, transfer top-first.
  11521. Filter will delay the top field.
  11522. @item p
  11523. Capture and transfer with the same field order. This mode only exists
  11524. for the documentation of the other options to refer to, but if you
  11525. actually select it, the filter will faithfully do nothing.
  11526. @item a
  11527. Capture field order determined automatically by field flags, transfer
  11528. opposite.
  11529. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11530. basis using field flags. If no field information is available,
  11531. then this works just like @samp{u}.
  11532. @item u
  11533. Capture unknown or varying, transfer opposite.
  11534. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11535. analyzing the images and selecting the alternative that produces best
  11536. match between the fields.
  11537. @item T
  11538. Capture top-first, transfer unknown or varying.
  11539. Filter selects among @samp{t} and @samp{p} using image analysis.
  11540. @item B
  11541. Capture bottom-first, transfer unknown or varying.
  11542. Filter selects among @samp{b} and @samp{p} using image analysis.
  11543. @item A
  11544. Capture determined by field flags, transfer unknown or varying.
  11545. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11546. image analysis. If no field information is available, then this works just
  11547. like @samp{U}. This is the default mode.
  11548. @item U
  11549. Both capture and transfer unknown or varying.
  11550. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11551. @end table
  11552. @end table
  11553. @section photosensitivity
  11554. Reduce various flashes in video, so to help users with epilepsy.
  11555. It accepts the following options:
  11556. @table @option
  11557. @item frames, f
  11558. Set how many frames to use when filtering. Default is 30.
  11559. @item threshold, t
  11560. Set detection threshold factor. Default is 1.
  11561. Lower is stricter.
  11562. @item skip
  11563. Set how many pixels to skip when sampling frames. Default is 1.
  11564. Allowed range is from 1 to 1024.
  11565. @item bypass
  11566. Leave frames unchanged. Default is disabled.
  11567. @end table
  11568. @section pixdesctest
  11569. Pixel format descriptor test filter, mainly useful for internal
  11570. testing. The output video should be equal to the input video.
  11571. For example:
  11572. @example
  11573. format=monow, pixdesctest
  11574. @end example
  11575. can be used to test the monowhite pixel format descriptor definition.
  11576. @section pixscope
  11577. Display sample values of color channels. Mainly useful for checking color
  11578. and levels. Minimum supported resolution is 640x480.
  11579. The filters accept the following options:
  11580. @table @option
  11581. @item x
  11582. Set scope X position, relative offset on X axis.
  11583. @item y
  11584. Set scope Y position, relative offset on Y axis.
  11585. @item w
  11586. Set scope width.
  11587. @item h
  11588. Set scope height.
  11589. @item o
  11590. Set window opacity. This window also holds statistics about pixel area.
  11591. @item wx
  11592. Set window X position, relative offset on X axis.
  11593. @item wy
  11594. Set window Y position, relative offset on Y axis.
  11595. @end table
  11596. @section pp
  11597. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11598. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11599. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11600. Each subfilter and some options have a short and a long name that can be used
  11601. interchangeably, i.e. dr/dering are the same.
  11602. The filters accept the following options:
  11603. @table @option
  11604. @item subfilters
  11605. Set postprocessing subfilters string.
  11606. @end table
  11607. All subfilters share common options to determine their scope:
  11608. @table @option
  11609. @item a/autoq
  11610. Honor the quality commands for this subfilter.
  11611. @item c/chrom
  11612. Do chrominance filtering, too (default).
  11613. @item y/nochrom
  11614. Do luminance filtering only (no chrominance).
  11615. @item n/noluma
  11616. Do chrominance filtering only (no luminance).
  11617. @end table
  11618. These options can be appended after the subfilter name, separated by a '|'.
  11619. Available subfilters are:
  11620. @table @option
  11621. @item hb/hdeblock[|difference[|flatness]]
  11622. Horizontal deblocking filter
  11623. @table @option
  11624. @item difference
  11625. Difference factor where higher values mean more deblocking (default: @code{32}).
  11626. @item flatness
  11627. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11628. @end table
  11629. @item vb/vdeblock[|difference[|flatness]]
  11630. Vertical deblocking filter
  11631. @table @option
  11632. @item difference
  11633. Difference factor where higher values mean more deblocking (default: @code{32}).
  11634. @item flatness
  11635. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11636. @end table
  11637. @item ha/hadeblock[|difference[|flatness]]
  11638. Accurate horizontal deblocking filter
  11639. @table @option
  11640. @item difference
  11641. Difference factor where higher values mean more deblocking (default: @code{32}).
  11642. @item flatness
  11643. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11644. @end table
  11645. @item va/vadeblock[|difference[|flatness]]
  11646. Accurate vertical deblocking filter
  11647. @table @option
  11648. @item difference
  11649. Difference factor where higher values mean more deblocking (default: @code{32}).
  11650. @item flatness
  11651. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11652. @end table
  11653. @end table
  11654. The horizontal and vertical deblocking filters share the difference and
  11655. flatness values so you cannot set different horizontal and vertical
  11656. thresholds.
  11657. @table @option
  11658. @item h1/x1hdeblock
  11659. Experimental horizontal deblocking filter
  11660. @item v1/x1vdeblock
  11661. Experimental vertical deblocking filter
  11662. @item dr/dering
  11663. Deringing filter
  11664. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11665. @table @option
  11666. @item threshold1
  11667. larger -> stronger filtering
  11668. @item threshold2
  11669. larger -> stronger filtering
  11670. @item threshold3
  11671. larger -> stronger filtering
  11672. @end table
  11673. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11674. @table @option
  11675. @item f/fullyrange
  11676. Stretch luminance to @code{0-255}.
  11677. @end table
  11678. @item lb/linblenddeint
  11679. Linear blend deinterlacing filter that deinterlaces the given block by
  11680. filtering all lines with a @code{(1 2 1)} filter.
  11681. @item li/linipoldeint
  11682. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11683. linearly interpolating every second line.
  11684. @item ci/cubicipoldeint
  11685. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11686. cubically interpolating every second line.
  11687. @item md/mediandeint
  11688. Median deinterlacing filter that deinterlaces the given block by applying a
  11689. median filter to every second line.
  11690. @item fd/ffmpegdeint
  11691. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11692. second line with a @code{(-1 4 2 4 -1)} filter.
  11693. @item l5/lowpass5
  11694. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11695. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11696. @item fq/forceQuant[|quantizer]
  11697. Overrides the quantizer table from the input with the constant quantizer you
  11698. specify.
  11699. @table @option
  11700. @item quantizer
  11701. Quantizer to use
  11702. @end table
  11703. @item de/default
  11704. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11705. @item fa/fast
  11706. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11707. @item ac
  11708. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11709. @end table
  11710. @subsection Examples
  11711. @itemize
  11712. @item
  11713. Apply horizontal and vertical deblocking, deringing and automatic
  11714. brightness/contrast:
  11715. @example
  11716. pp=hb/vb/dr/al
  11717. @end example
  11718. @item
  11719. Apply default filters without brightness/contrast correction:
  11720. @example
  11721. pp=de/-al
  11722. @end example
  11723. @item
  11724. Apply default filters and temporal denoiser:
  11725. @example
  11726. pp=default/tmpnoise|1|2|3
  11727. @end example
  11728. @item
  11729. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11730. automatically depending on available CPU time:
  11731. @example
  11732. pp=hb|y/vb|a
  11733. @end example
  11734. @end itemize
  11735. @section pp7
  11736. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11737. similar to spp = 6 with 7 point DCT, where only the center sample is
  11738. used after IDCT.
  11739. The filter accepts the following options:
  11740. @table @option
  11741. @item qp
  11742. Force a constant quantization parameter. It accepts an integer in range
  11743. 0 to 63. If not set, the filter will use the QP from the video stream
  11744. (if available).
  11745. @item mode
  11746. Set thresholding mode. Available modes are:
  11747. @table @samp
  11748. @item hard
  11749. Set hard thresholding.
  11750. @item soft
  11751. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11752. @item medium
  11753. Set medium thresholding (good results, default).
  11754. @end table
  11755. @end table
  11756. @section premultiply
  11757. Apply alpha premultiply effect to input video stream using first plane
  11758. of second stream as alpha.
  11759. Both streams must have same dimensions and same pixel format.
  11760. The filter accepts the following option:
  11761. @table @option
  11762. @item planes
  11763. Set which planes will be processed, unprocessed planes will be copied.
  11764. By default value 0xf, all planes will be processed.
  11765. @item inplace
  11766. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11767. @end table
  11768. @section prewitt
  11769. Apply prewitt operator to input video stream.
  11770. The filter accepts the following option:
  11771. @table @option
  11772. @item planes
  11773. Set which planes will be processed, unprocessed planes will be copied.
  11774. By default value 0xf, all planes will be processed.
  11775. @item scale
  11776. Set value which will be multiplied with filtered result.
  11777. @item delta
  11778. Set value which will be added to filtered result.
  11779. @end table
  11780. @section pseudocolor
  11781. Alter frame colors in video with pseudocolors.
  11782. This filter accepts the following options:
  11783. @table @option
  11784. @item c0
  11785. set pixel first component expression
  11786. @item c1
  11787. set pixel second component expression
  11788. @item c2
  11789. set pixel third component expression
  11790. @item c3
  11791. set pixel fourth component expression, corresponds to the alpha component
  11792. @item i
  11793. set component to use as base for altering colors
  11794. @end table
  11795. Each of them specifies the expression to use for computing the lookup table for
  11796. the corresponding pixel component values.
  11797. The expressions can contain the following constants and functions:
  11798. @table @option
  11799. @item w
  11800. @item h
  11801. The input width and height.
  11802. @item val
  11803. The input value for the pixel component.
  11804. @item ymin, umin, vmin, amin
  11805. The minimum allowed component value.
  11806. @item ymax, umax, vmax, amax
  11807. The maximum allowed component value.
  11808. @end table
  11809. All expressions default to "val".
  11810. @subsection Examples
  11811. @itemize
  11812. @item
  11813. Change too high luma values to gradient:
  11814. @example
  11815. 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'"
  11816. @end example
  11817. @end itemize
  11818. @section psnr
  11819. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11820. Ratio) between two input videos.
  11821. This filter takes in input two input videos, the first input is
  11822. considered the "main" source and is passed unchanged to the
  11823. output. The second input is used as a "reference" video for computing
  11824. the PSNR.
  11825. Both video inputs must have the same resolution and pixel format for
  11826. this filter to work correctly. Also it assumes that both inputs
  11827. have the same number of frames, which are compared one by one.
  11828. The obtained average PSNR is printed through the logging system.
  11829. The filter stores the accumulated MSE (mean squared error) of each
  11830. frame, and at the end of the processing it is averaged across all frames
  11831. equally, and the following formula is applied to obtain the PSNR:
  11832. @example
  11833. PSNR = 10*log10(MAX^2/MSE)
  11834. @end example
  11835. Where MAX is the average of the maximum values of each component of the
  11836. image.
  11837. The description of the accepted parameters follows.
  11838. @table @option
  11839. @item stats_file, f
  11840. If specified the filter will use the named file to save the PSNR of
  11841. each individual frame. When filename equals "-" the data is sent to
  11842. standard output.
  11843. @item stats_version
  11844. Specifies which version of the stats file format to use. Details of
  11845. each format are written below.
  11846. Default value is 1.
  11847. @item stats_add_max
  11848. Determines whether the max value is output to the stats log.
  11849. Default value is 0.
  11850. Requires stats_version >= 2. If this is set and stats_version < 2,
  11851. the filter will return an error.
  11852. @end table
  11853. This filter also supports the @ref{framesync} options.
  11854. The file printed if @var{stats_file} is selected, contains a sequence of
  11855. key/value pairs of the form @var{key}:@var{value} for each compared
  11856. couple of frames.
  11857. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11858. the list of per-frame-pair stats, with key value pairs following the frame
  11859. format with the following parameters:
  11860. @table @option
  11861. @item psnr_log_version
  11862. The version of the log file format. Will match @var{stats_version}.
  11863. @item fields
  11864. A comma separated list of the per-frame-pair parameters included in
  11865. the log.
  11866. @end table
  11867. A description of each shown per-frame-pair parameter follows:
  11868. @table @option
  11869. @item n
  11870. sequential number of the input frame, starting from 1
  11871. @item mse_avg
  11872. Mean Square Error pixel-by-pixel average difference of the compared
  11873. frames, averaged over all the image components.
  11874. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11875. Mean Square Error pixel-by-pixel average difference of the compared
  11876. frames for the component specified by the suffix.
  11877. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11878. Peak Signal to Noise ratio of the compared frames for the component
  11879. specified by the suffix.
  11880. @item max_avg, max_y, max_u, max_v
  11881. Maximum allowed value for each channel, and average over all
  11882. channels.
  11883. @end table
  11884. @subsection Examples
  11885. @itemize
  11886. @item
  11887. For example:
  11888. @example
  11889. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11890. [main][ref] psnr="stats_file=stats.log" [out]
  11891. @end example
  11892. On this example the input file being processed is compared with the
  11893. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11894. is stored in @file{stats.log}.
  11895. @item
  11896. Another example with different containers:
  11897. @example
  11898. 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 -
  11899. @end example
  11900. @end itemize
  11901. @anchor{pullup}
  11902. @section pullup
  11903. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11904. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11905. content.
  11906. The pullup filter is designed to take advantage of future context in making
  11907. its decisions. This filter is stateless in the sense that it does not lock
  11908. onto a pattern to follow, but it instead looks forward to the following
  11909. fields in order to identify matches and rebuild progressive frames.
  11910. To produce content with an even framerate, insert the fps filter after
  11911. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11912. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11913. The filter accepts the following options:
  11914. @table @option
  11915. @item jl
  11916. @item jr
  11917. @item jt
  11918. @item jb
  11919. These options set the amount of "junk" to ignore at the left, right, top, and
  11920. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11921. while top and bottom are in units of 2 lines.
  11922. The default is 8 pixels on each side.
  11923. @item sb
  11924. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11925. filter generating an occasional mismatched frame, but it may also cause an
  11926. excessive number of frames to be dropped during high motion sequences.
  11927. Conversely, setting it to -1 will make filter match fields more easily.
  11928. This may help processing of video where there is slight blurring between
  11929. the fields, but may also cause there to be interlaced frames in the output.
  11930. Default value is @code{0}.
  11931. @item mp
  11932. Set the metric plane to use. It accepts the following values:
  11933. @table @samp
  11934. @item l
  11935. Use luma plane.
  11936. @item u
  11937. Use chroma blue plane.
  11938. @item v
  11939. Use chroma red plane.
  11940. @end table
  11941. This option may be set to use chroma plane instead of the default luma plane
  11942. for doing filter's computations. This may improve accuracy on very clean
  11943. source material, but more likely will decrease accuracy, especially if there
  11944. is chroma noise (rainbow effect) or any grayscale video.
  11945. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11946. load and make pullup usable in realtime on slow machines.
  11947. @end table
  11948. For best results (without duplicated frames in the output file) it is
  11949. necessary to change the output frame rate. For example, to inverse
  11950. telecine NTSC input:
  11951. @example
  11952. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11953. @end example
  11954. @section qp
  11955. Change video quantization parameters (QP).
  11956. The filter accepts the following option:
  11957. @table @option
  11958. @item qp
  11959. Set expression for quantization parameter.
  11960. @end table
  11961. The expression is evaluated through the eval API and can contain, among others,
  11962. the following constants:
  11963. @table @var
  11964. @item known
  11965. 1 if index is not 129, 0 otherwise.
  11966. @item qp
  11967. Sequential index starting from -129 to 128.
  11968. @end table
  11969. @subsection Examples
  11970. @itemize
  11971. @item
  11972. Some equation like:
  11973. @example
  11974. qp=2+2*sin(PI*qp)
  11975. @end example
  11976. @end itemize
  11977. @section random
  11978. Flush video frames from internal cache of frames into a random order.
  11979. No frame is discarded.
  11980. Inspired by @ref{frei0r} nervous filter.
  11981. @table @option
  11982. @item frames
  11983. Set size in number of frames of internal cache, in range from @code{2} to
  11984. @code{512}. Default is @code{30}.
  11985. @item seed
  11986. Set seed for random number generator, must be an integer included between
  11987. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11988. less than @code{0}, the filter will try to use a good random seed on a
  11989. best effort basis.
  11990. @end table
  11991. @section readeia608
  11992. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11993. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11994. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11995. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11996. @table @option
  11997. @item lavfi.readeia608.X.cc
  11998. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11999. @item lavfi.readeia608.X.line
  12000. The number of the line on which the EIA-608 data was identified and read.
  12001. @end table
  12002. This filter accepts the following options:
  12003. @table @option
  12004. @item scan_min
  12005. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12006. @item scan_max
  12007. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12008. @item spw
  12009. Set the ratio of width reserved for sync code detection.
  12010. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12011. @item chp
  12012. Enable checking the parity bit. In the event of a parity error, the filter will output
  12013. @code{0x00} for that character. Default is false.
  12014. @item lp
  12015. Lowpass lines prior to further processing. Default is enabled.
  12016. @end table
  12017. @subsection Examples
  12018. @itemize
  12019. @item
  12020. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12021. @example
  12022. 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
  12023. @end example
  12024. @end itemize
  12025. @section readvitc
  12026. Read vertical interval timecode (VITC) information from the top lines of a
  12027. video frame.
  12028. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12029. timecode value, if a valid timecode has been detected. Further metadata key
  12030. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12031. timecode data has been found or not.
  12032. This filter accepts the following options:
  12033. @table @option
  12034. @item scan_max
  12035. Set the maximum number of lines to scan for VITC data. If the value is set to
  12036. @code{-1} the full video frame is scanned. Default is @code{45}.
  12037. @item thr_b
  12038. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12039. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12040. @item thr_w
  12041. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12042. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12043. @end table
  12044. @subsection Examples
  12045. @itemize
  12046. @item
  12047. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12048. draw @code{--:--:--:--} as a placeholder:
  12049. @example
  12050. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12051. @end example
  12052. @end itemize
  12053. @section remap
  12054. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12055. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12056. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12057. value for pixel will be used for destination pixel.
  12058. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12059. will have Xmap/Ymap video stream dimensions.
  12060. Xmap and Ymap input video streams are 16bit depth, single channel.
  12061. @table @option
  12062. @item format
  12063. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12064. Default is @code{color}.
  12065. @item fill
  12066. Specify the color of the unmapped pixels. For the syntax of this option,
  12067. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12068. manual,ffmpeg-utils}. Default color is @code{black}.
  12069. @end table
  12070. @section removegrain
  12071. The removegrain filter is a spatial denoiser for progressive video.
  12072. @table @option
  12073. @item m0
  12074. Set mode for the first plane.
  12075. @item m1
  12076. Set mode for the second plane.
  12077. @item m2
  12078. Set mode for the third plane.
  12079. @item m3
  12080. Set mode for the fourth plane.
  12081. @end table
  12082. Range of mode is from 0 to 24. Description of each mode follows:
  12083. @table @var
  12084. @item 0
  12085. Leave input plane unchanged. Default.
  12086. @item 1
  12087. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12088. @item 2
  12089. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12090. @item 3
  12091. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12092. @item 4
  12093. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12094. This is equivalent to a median filter.
  12095. @item 5
  12096. Line-sensitive clipping giving the minimal change.
  12097. @item 6
  12098. Line-sensitive clipping, intermediate.
  12099. @item 7
  12100. Line-sensitive clipping, intermediate.
  12101. @item 8
  12102. Line-sensitive clipping, intermediate.
  12103. @item 9
  12104. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12105. @item 10
  12106. Replaces the target pixel with the closest neighbour.
  12107. @item 11
  12108. [1 2 1] horizontal and vertical kernel blur.
  12109. @item 12
  12110. Same as mode 11.
  12111. @item 13
  12112. Bob mode, interpolates top field from the line where the neighbours
  12113. pixels are the closest.
  12114. @item 14
  12115. Bob mode, interpolates bottom field from the line where the neighbours
  12116. pixels are the closest.
  12117. @item 15
  12118. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12119. interpolation formula.
  12120. @item 16
  12121. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12122. interpolation formula.
  12123. @item 17
  12124. Clips the pixel with the minimum and maximum of respectively the maximum and
  12125. minimum of each pair of opposite neighbour pixels.
  12126. @item 18
  12127. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12128. the current pixel is minimal.
  12129. @item 19
  12130. Replaces the pixel with the average of its 8 neighbours.
  12131. @item 20
  12132. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12133. @item 21
  12134. Clips pixels using the averages of opposite neighbour.
  12135. @item 22
  12136. Same as mode 21 but simpler and faster.
  12137. @item 23
  12138. Small edge and halo removal, but reputed useless.
  12139. @item 24
  12140. Similar as 23.
  12141. @end table
  12142. @section removelogo
  12143. Suppress a TV station logo, using an image file to determine which
  12144. pixels comprise the logo. It works by filling in the pixels that
  12145. comprise the logo with neighboring pixels.
  12146. The filter accepts the following options:
  12147. @table @option
  12148. @item filename, f
  12149. Set the filter bitmap file, which can be any image format supported by
  12150. libavformat. The width and height of the image file must match those of the
  12151. video stream being processed.
  12152. @end table
  12153. Pixels in the provided bitmap image with a value of zero are not
  12154. considered part of the logo, non-zero pixels are considered part of
  12155. the logo. If you use white (255) for the logo and black (0) for the
  12156. rest, you will be safe. For making the filter bitmap, it is
  12157. recommended to take a screen capture of a black frame with the logo
  12158. visible, and then using a threshold filter followed by the erode
  12159. filter once or twice.
  12160. If needed, little splotches can be fixed manually. Remember that if
  12161. logo pixels are not covered, the filter quality will be much
  12162. reduced. Marking too many pixels as part of the logo does not hurt as
  12163. much, but it will increase the amount of blurring needed to cover over
  12164. the image and will destroy more information than necessary, and extra
  12165. pixels will slow things down on a large logo.
  12166. @section repeatfields
  12167. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12168. fields based on its value.
  12169. @section reverse
  12170. Reverse a video clip.
  12171. Warning: This filter requires memory to buffer the entire clip, so trimming
  12172. is suggested.
  12173. @subsection Examples
  12174. @itemize
  12175. @item
  12176. Take the first 5 seconds of a clip, and reverse it.
  12177. @example
  12178. trim=end=5,reverse
  12179. @end example
  12180. @end itemize
  12181. @section rgbashift
  12182. Shift R/G/B/A pixels horizontally and/or vertically.
  12183. The filter accepts the following options:
  12184. @table @option
  12185. @item rh
  12186. Set amount to shift red horizontally.
  12187. @item rv
  12188. Set amount to shift red vertically.
  12189. @item gh
  12190. Set amount to shift green horizontally.
  12191. @item gv
  12192. Set amount to shift green vertically.
  12193. @item bh
  12194. Set amount to shift blue horizontally.
  12195. @item bv
  12196. Set amount to shift blue vertically.
  12197. @item ah
  12198. Set amount to shift alpha horizontally.
  12199. @item av
  12200. Set amount to shift alpha vertically.
  12201. @item edge
  12202. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12203. @end table
  12204. @subsection Commands
  12205. This filter supports the all above options as @ref{commands}.
  12206. @section roberts
  12207. Apply roberts cross operator to input video stream.
  12208. The filter accepts the following option:
  12209. @table @option
  12210. @item planes
  12211. Set which planes will be processed, unprocessed planes will be copied.
  12212. By default value 0xf, all planes will be processed.
  12213. @item scale
  12214. Set value which will be multiplied with filtered result.
  12215. @item delta
  12216. Set value which will be added to filtered result.
  12217. @end table
  12218. @section rotate
  12219. Rotate video by an arbitrary angle expressed in radians.
  12220. The filter accepts the following options:
  12221. A description of the optional parameters follows.
  12222. @table @option
  12223. @item angle, a
  12224. Set an expression for the angle by which to rotate the input video
  12225. clockwise, expressed as a number of radians. A negative value will
  12226. result in a counter-clockwise rotation. By default it is set to "0".
  12227. This expression is evaluated for each frame.
  12228. @item out_w, ow
  12229. Set the output width expression, default value is "iw".
  12230. This expression is evaluated just once during configuration.
  12231. @item out_h, oh
  12232. Set the output height expression, default value is "ih".
  12233. This expression is evaluated just once during configuration.
  12234. @item bilinear
  12235. Enable bilinear interpolation if set to 1, a value of 0 disables
  12236. it. Default value is 1.
  12237. @item fillcolor, c
  12238. Set the color used to fill the output area not covered by the rotated
  12239. image. For the general syntax of this option, check the
  12240. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12241. If the special value "none" is selected then no
  12242. background is printed (useful for example if the background is never shown).
  12243. Default value is "black".
  12244. @end table
  12245. The expressions for the angle and the output size can contain the
  12246. following constants and functions:
  12247. @table @option
  12248. @item n
  12249. sequential number of the input frame, starting from 0. It is always NAN
  12250. before the first frame is filtered.
  12251. @item t
  12252. time in seconds of the input frame, it is set to 0 when the filter is
  12253. configured. It is always NAN before the first frame is filtered.
  12254. @item hsub
  12255. @item vsub
  12256. horizontal and vertical chroma subsample values. For example for the
  12257. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12258. @item in_w, iw
  12259. @item in_h, ih
  12260. the input video width and height
  12261. @item out_w, ow
  12262. @item out_h, oh
  12263. the output width and height, that is the size of the padded area as
  12264. specified by the @var{width} and @var{height} expressions
  12265. @item rotw(a)
  12266. @item roth(a)
  12267. the minimal width/height required for completely containing the input
  12268. video rotated by @var{a} radians.
  12269. These are only available when computing the @option{out_w} and
  12270. @option{out_h} expressions.
  12271. @end table
  12272. @subsection Examples
  12273. @itemize
  12274. @item
  12275. Rotate the input by PI/6 radians clockwise:
  12276. @example
  12277. rotate=PI/6
  12278. @end example
  12279. @item
  12280. Rotate the input by PI/6 radians counter-clockwise:
  12281. @example
  12282. rotate=-PI/6
  12283. @end example
  12284. @item
  12285. Rotate the input by 45 degrees clockwise:
  12286. @example
  12287. rotate=45*PI/180
  12288. @end example
  12289. @item
  12290. Apply a constant rotation with period T, starting from an angle of PI/3:
  12291. @example
  12292. rotate=PI/3+2*PI*t/T
  12293. @end example
  12294. @item
  12295. Make the input video rotation oscillating with a period of T
  12296. seconds and an amplitude of A radians:
  12297. @example
  12298. rotate=A*sin(2*PI/T*t)
  12299. @end example
  12300. @item
  12301. Rotate the video, output size is chosen so that the whole rotating
  12302. input video is always completely contained in the output:
  12303. @example
  12304. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12305. @end example
  12306. @item
  12307. Rotate the video, reduce the output size so that no background is ever
  12308. shown:
  12309. @example
  12310. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12311. @end example
  12312. @end itemize
  12313. @subsection Commands
  12314. The filter supports the following commands:
  12315. @table @option
  12316. @item a, angle
  12317. Set the angle expression.
  12318. The command accepts the same syntax of the corresponding option.
  12319. If the specified expression is not valid, it is kept at its current
  12320. value.
  12321. @end table
  12322. @section sab
  12323. Apply Shape Adaptive Blur.
  12324. The filter accepts the following options:
  12325. @table @option
  12326. @item luma_radius, lr
  12327. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12328. value is 1.0. A greater value will result in a more blurred image, and
  12329. in slower processing.
  12330. @item luma_pre_filter_radius, lpfr
  12331. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12332. value is 1.0.
  12333. @item luma_strength, ls
  12334. Set luma maximum difference between pixels to still be considered, must
  12335. be a value in the 0.1-100.0 range, default value is 1.0.
  12336. @item chroma_radius, cr
  12337. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12338. greater value will result in a more blurred image, and in slower
  12339. processing.
  12340. @item chroma_pre_filter_radius, cpfr
  12341. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12342. @item chroma_strength, cs
  12343. Set chroma maximum difference between pixels to still be considered,
  12344. must be a value in the -0.9-100.0 range.
  12345. @end table
  12346. Each chroma option value, if not explicitly specified, is set to the
  12347. corresponding luma option value.
  12348. @anchor{scale}
  12349. @section scale
  12350. Scale (resize) the input video, using the libswscale library.
  12351. The scale filter forces the output display aspect ratio to be the same
  12352. of the input, by changing the output sample aspect ratio.
  12353. If the input image format is different from the format requested by
  12354. the next filter, the scale filter will convert the input to the
  12355. requested format.
  12356. @subsection Options
  12357. The filter accepts the following options, or any of the options
  12358. supported by the libswscale scaler.
  12359. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12360. the complete list of scaler options.
  12361. @table @option
  12362. @item width, w
  12363. @item height, h
  12364. Set the output video dimension expression. Default value is the input
  12365. dimension.
  12366. If the @var{width} or @var{w} value is 0, the input width is used for
  12367. the output. If the @var{height} or @var{h} value is 0, the input height
  12368. is used for the output.
  12369. If one and only one of the values is -n with n >= 1, the scale filter
  12370. will use a value that maintains the aspect ratio of the input image,
  12371. calculated from the other specified dimension. After that it will,
  12372. however, make sure that the calculated dimension is divisible by n and
  12373. adjust the value if necessary.
  12374. If both values are -n with n >= 1, the behavior will be identical to
  12375. both values being set to 0 as previously detailed.
  12376. See below for the list of accepted constants for use in the dimension
  12377. expression.
  12378. @item eval
  12379. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12380. @table @samp
  12381. @item init
  12382. Only evaluate expressions once during the filter initialization or when a command is processed.
  12383. @item frame
  12384. Evaluate expressions for each incoming frame.
  12385. @end table
  12386. Default value is @samp{init}.
  12387. @item interl
  12388. Set the interlacing mode. It accepts the following values:
  12389. @table @samp
  12390. @item 1
  12391. Force interlaced aware scaling.
  12392. @item 0
  12393. Do not apply interlaced scaling.
  12394. @item -1
  12395. Select interlaced aware scaling depending on whether the source frames
  12396. are flagged as interlaced or not.
  12397. @end table
  12398. Default value is @samp{0}.
  12399. @item flags
  12400. Set libswscale scaling flags. See
  12401. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12402. complete list of values. If not explicitly specified the filter applies
  12403. the default flags.
  12404. @item param0, param1
  12405. Set libswscale input parameters for scaling algorithms that need them. See
  12406. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12407. complete documentation. If not explicitly specified the filter applies
  12408. empty parameters.
  12409. @item size, s
  12410. Set the video size. For the syntax of this option, check the
  12411. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12412. @item in_color_matrix
  12413. @item out_color_matrix
  12414. Set in/output YCbCr color space type.
  12415. This allows the autodetected value to be overridden as well as allows forcing
  12416. a specific value used for the output and encoder.
  12417. If not specified, the color space type depends on the pixel format.
  12418. Possible values:
  12419. @table @samp
  12420. @item auto
  12421. Choose automatically.
  12422. @item bt709
  12423. Format conforming to International Telecommunication Union (ITU)
  12424. Recommendation BT.709.
  12425. @item fcc
  12426. Set color space conforming to the United States Federal Communications
  12427. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12428. @item bt601
  12429. @item bt470
  12430. @item smpte170m
  12431. Set color space conforming to:
  12432. @itemize
  12433. @item
  12434. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12435. @item
  12436. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12437. @item
  12438. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12439. @end itemize
  12440. @item smpte240m
  12441. Set color space conforming to SMPTE ST 240:1999.
  12442. @item bt2020
  12443. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12444. @end table
  12445. @item in_range
  12446. @item out_range
  12447. Set in/output YCbCr sample range.
  12448. This allows the autodetected value to be overridden as well as allows forcing
  12449. a specific value used for the output and encoder. If not specified, the
  12450. range depends on the pixel format. Possible values:
  12451. @table @samp
  12452. @item auto/unknown
  12453. Choose automatically.
  12454. @item jpeg/full/pc
  12455. Set full range (0-255 in case of 8-bit luma).
  12456. @item mpeg/limited/tv
  12457. Set "MPEG" range (16-235 in case of 8-bit luma).
  12458. @end table
  12459. @item force_original_aspect_ratio
  12460. Enable decreasing or increasing output video width or height if necessary to
  12461. keep the original aspect ratio. Possible values:
  12462. @table @samp
  12463. @item disable
  12464. Scale the video as specified and disable this feature.
  12465. @item decrease
  12466. The output video dimensions will automatically be decreased if needed.
  12467. @item increase
  12468. The output video dimensions will automatically be increased if needed.
  12469. @end table
  12470. One useful instance of this option is that when you know a specific device's
  12471. maximum allowed resolution, you can use this to limit the output video to
  12472. that, while retaining the aspect ratio. For example, device A allows
  12473. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12474. decrease) and specifying 1280x720 to the command line makes the output
  12475. 1280x533.
  12476. Please note that this is a different thing than specifying -1 for @option{w}
  12477. or @option{h}, you still need to specify the output resolution for this option
  12478. to work.
  12479. @item force_divisible_by
  12480. Ensures that both the output dimensions, width and height, are divisible by the
  12481. given integer when used together with @option{force_original_aspect_ratio}. This
  12482. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12483. This option respects the value set for @option{force_original_aspect_ratio},
  12484. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12485. may be slightly modified.
  12486. This option can be handy if you need to have a video fit within or exceed
  12487. a defined resolution using @option{force_original_aspect_ratio} but also have
  12488. encoder restrictions on width or height divisibility.
  12489. @end table
  12490. The values of the @option{w} and @option{h} options are expressions
  12491. containing the following constants:
  12492. @table @var
  12493. @item in_w
  12494. @item in_h
  12495. The input width and height
  12496. @item iw
  12497. @item ih
  12498. These are the same as @var{in_w} and @var{in_h}.
  12499. @item out_w
  12500. @item out_h
  12501. The output (scaled) width and height
  12502. @item ow
  12503. @item oh
  12504. These are the same as @var{out_w} and @var{out_h}
  12505. @item a
  12506. The same as @var{iw} / @var{ih}
  12507. @item sar
  12508. input sample aspect ratio
  12509. @item dar
  12510. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12511. @item hsub
  12512. @item vsub
  12513. horizontal and vertical input chroma subsample values. For example for the
  12514. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12515. @item ohsub
  12516. @item ovsub
  12517. horizontal and vertical output chroma subsample values. For example for the
  12518. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12519. @item n
  12520. The (sequential) number of the input frame, starting from 0.
  12521. Only available with @code{eval=frame}.
  12522. @item t
  12523. The presentation timestamp of the input frame, expressed as a number of
  12524. seconds. Only available with @code{eval=frame}.
  12525. @item pos
  12526. The position (byte offset) of the frame in the input stream, or NaN if
  12527. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12528. Only available with @code{eval=frame}.
  12529. @end table
  12530. @subsection Examples
  12531. @itemize
  12532. @item
  12533. Scale the input video to a size of 200x100
  12534. @example
  12535. scale=w=200:h=100
  12536. @end example
  12537. This is equivalent to:
  12538. @example
  12539. scale=200:100
  12540. @end example
  12541. or:
  12542. @example
  12543. scale=200x100
  12544. @end example
  12545. @item
  12546. Specify a size abbreviation for the output size:
  12547. @example
  12548. scale=qcif
  12549. @end example
  12550. which can also be written as:
  12551. @example
  12552. scale=size=qcif
  12553. @end example
  12554. @item
  12555. Scale the input to 2x:
  12556. @example
  12557. scale=w=2*iw:h=2*ih
  12558. @end example
  12559. @item
  12560. The above is the same as:
  12561. @example
  12562. scale=2*in_w:2*in_h
  12563. @end example
  12564. @item
  12565. Scale the input to 2x with forced interlaced scaling:
  12566. @example
  12567. scale=2*iw:2*ih:interl=1
  12568. @end example
  12569. @item
  12570. Scale the input to half size:
  12571. @example
  12572. scale=w=iw/2:h=ih/2
  12573. @end example
  12574. @item
  12575. Increase the width, and set the height to the same size:
  12576. @example
  12577. scale=3/2*iw:ow
  12578. @end example
  12579. @item
  12580. Seek Greek harmony:
  12581. @example
  12582. scale=iw:1/PHI*iw
  12583. scale=ih*PHI:ih
  12584. @end example
  12585. @item
  12586. Increase the height, and set the width to 3/2 of the height:
  12587. @example
  12588. scale=w=3/2*oh:h=3/5*ih
  12589. @end example
  12590. @item
  12591. Increase the size, making the size a multiple of the chroma
  12592. subsample values:
  12593. @example
  12594. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12595. @end example
  12596. @item
  12597. Increase the width to a maximum of 500 pixels,
  12598. keeping the same aspect ratio as the input:
  12599. @example
  12600. scale=w='min(500\, iw*3/2):h=-1'
  12601. @end example
  12602. @item
  12603. Make pixels square by combining scale and setsar:
  12604. @example
  12605. scale='trunc(ih*dar):ih',setsar=1/1
  12606. @end example
  12607. @item
  12608. Make pixels square by combining scale and setsar,
  12609. making sure the resulting resolution is even (required by some codecs):
  12610. @example
  12611. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12612. @end example
  12613. @end itemize
  12614. @subsection Commands
  12615. This filter supports the following commands:
  12616. @table @option
  12617. @item width, w
  12618. @item height, h
  12619. Set the output video dimension expression.
  12620. The command accepts the same syntax of the corresponding option.
  12621. If the specified expression is not valid, it is kept at its current
  12622. value.
  12623. @end table
  12624. @section scale_npp
  12625. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12626. format conversion on CUDA video frames. Setting the output width and height
  12627. works in the same way as for the @var{scale} filter.
  12628. The following additional options are accepted:
  12629. @table @option
  12630. @item format
  12631. The pixel format of the output CUDA frames. If set to the string "same" (the
  12632. default), the input format will be kept. Note that automatic format negotiation
  12633. and conversion is not yet supported for hardware frames
  12634. @item interp_algo
  12635. The interpolation algorithm used for resizing. One of the following:
  12636. @table @option
  12637. @item nn
  12638. Nearest neighbour.
  12639. @item linear
  12640. @item cubic
  12641. @item cubic2p_bspline
  12642. 2-parameter cubic (B=1, C=0)
  12643. @item cubic2p_catmullrom
  12644. 2-parameter cubic (B=0, C=1/2)
  12645. @item cubic2p_b05c03
  12646. 2-parameter cubic (B=1/2, C=3/10)
  12647. @item super
  12648. Supersampling
  12649. @item lanczos
  12650. @end table
  12651. @item force_original_aspect_ratio
  12652. Enable decreasing or increasing output video width or height if necessary to
  12653. keep the original aspect ratio. Possible values:
  12654. @table @samp
  12655. @item disable
  12656. Scale the video as specified and disable this feature.
  12657. @item decrease
  12658. The output video dimensions will automatically be decreased if needed.
  12659. @item increase
  12660. The output video dimensions will automatically be increased if needed.
  12661. @end table
  12662. One useful instance of this option is that when you know a specific device's
  12663. maximum allowed resolution, you can use this to limit the output video to
  12664. that, while retaining the aspect ratio. For example, device A allows
  12665. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12666. decrease) and specifying 1280x720 to the command line makes the output
  12667. 1280x533.
  12668. Please note that this is a different thing than specifying -1 for @option{w}
  12669. or @option{h}, you still need to specify the output resolution for this option
  12670. to work.
  12671. @item force_divisible_by
  12672. Ensures that both the output dimensions, width and height, are divisible by the
  12673. given integer when used together with @option{force_original_aspect_ratio}. This
  12674. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12675. This option respects the value set for @option{force_original_aspect_ratio},
  12676. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12677. may be slightly modified.
  12678. This option can be handy if you need to have a video fit within or exceed
  12679. a defined resolution using @option{force_original_aspect_ratio} but also have
  12680. encoder restrictions on width or height divisibility.
  12681. @end table
  12682. @section scale2ref
  12683. Scale (resize) the input video, based on a reference video.
  12684. See the scale filter for available options, scale2ref supports the same but
  12685. uses the reference video instead of the main input as basis. scale2ref also
  12686. supports the following additional constants for the @option{w} and
  12687. @option{h} options:
  12688. @table @var
  12689. @item main_w
  12690. @item main_h
  12691. The main input video's width and height
  12692. @item main_a
  12693. The same as @var{main_w} / @var{main_h}
  12694. @item main_sar
  12695. The main input video's sample aspect ratio
  12696. @item main_dar, mdar
  12697. The main input video's display aspect ratio. Calculated from
  12698. @code{(main_w / main_h) * main_sar}.
  12699. @item main_hsub
  12700. @item main_vsub
  12701. The main input video's horizontal and vertical chroma subsample values.
  12702. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12703. is 1.
  12704. @item main_n
  12705. The (sequential) number of the main input frame, starting from 0.
  12706. Only available with @code{eval=frame}.
  12707. @item main_t
  12708. The presentation timestamp of the main input frame, expressed as a number of
  12709. seconds. Only available with @code{eval=frame}.
  12710. @item main_pos
  12711. The position (byte offset) of the frame in the main input stream, or NaN if
  12712. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12713. Only available with @code{eval=frame}.
  12714. @end table
  12715. @subsection Examples
  12716. @itemize
  12717. @item
  12718. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12719. @example
  12720. 'scale2ref[b][a];[a][b]overlay'
  12721. @end example
  12722. @item
  12723. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12724. @example
  12725. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12726. @end example
  12727. @end itemize
  12728. @subsection Commands
  12729. This filter supports the following commands:
  12730. @table @option
  12731. @item width, w
  12732. @item height, h
  12733. Set the output video dimension expression.
  12734. The command accepts the same syntax of the corresponding option.
  12735. If the specified expression is not valid, it is kept at its current
  12736. value.
  12737. @end table
  12738. @section scroll
  12739. Scroll input video horizontally and/or vertically by constant speed.
  12740. The filter accepts the following options:
  12741. @table @option
  12742. @item horizontal, h
  12743. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12744. Negative values changes scrolling direction.
  12745. @item vertical, v
  12746. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12747. Negative values changes scrolling direction.
  12748. @item hpos
  12749. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12750. @item vpos
  12751. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12752. @end table
  12753. @subsection Commands
  12754. This filter supports the following @ref{commands}:
  12755. @table @option
  12756. @item horizontal, h
  12757. Set the horizontal scrolling speed.
  12758. @item vertical, v
  12759. Set the vertical scrolling speed.
  12760. @end table
  12761. @anchor{scdet}
  12762. @section scdet
  12763. Detect video scene change.
  12764. This filter sets frame metadata with mafd between frame, the scene score, and
  12765. forward the frame to the next filter, so they can use these metadata to detect
  12766. scene change or others.
  12767. In addition, this filter logs a message and sets frame metadata when it detects
  12768. a scene change by @option{threshold}.
  12769. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  12770. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  12771. to detect scene change.
  12772. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  12773. detect scene change with @option{threshold}.
  12774. The filter accepts the following options:
  12775. @table @option
  12776. @item threshold, t
  12777. Set the scene change detection threshold as a percentage of maximum change. Good
  12778. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  12779. @code{[0., 100.]}.
  12780. Default value is @code{10.}.
  12781. @item sc_pass, s
  12782. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  12783. You can enable it if you want to get snapshot of scene change frames only.
  12784. @end table
  12785. @anchor{selectivecolor}
  12786. @section selectivecolor
  12787. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12788. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12789. by the "purity" of the color (that is, how saturated it already is).
  12790. This filter is similar to the Adobe Photoshop Selective Color tool.
  12791. The filter accepts the following options:
  12792. @table @option
  12793. @item correction_method
  12794. Select color correction method.
  12795. Available values are:
  12796. @table @samp
  12797. @item absolute
  12798. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12799. component value).
  12800. @item relative
  12801. Specified adjustments are relative to the original component value.
  12802. @end table
  12803. Default is @code{absolute}.
  12804. @item reds
  12805. Adjustments for red pixels (pixels where the red component is the maximum)
  12806. @item yellows
  12807. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12808. @item greens
  12809. Adjustments for green pixels (pixels where the green component is the maximum)
  12810. @item cyans
  12811. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12812. @item blues
  12813. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12814. @item magentas
  12815. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12816. @item whites
  12817. Adjustments for white pixels (pixels where all components are greater than 128)
  12818. @item neutrals
  12819. Adjustments for all pixels except pure black and pure white
  12820. @item blacks
  12821. Adjustments for black pixels (pixels where all components are lesser than 128)
  12822. @item psfile
  12823. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12824. @end table
  12825. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12826. 4 space separated floating point adjustment values in the [-1,1] range,
  12827. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12828. pixels of its range.
  12829. @subsection Examples
  12830. @itemize
  12831. @item
  12832. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12833. increase magenta by 27% in blue areas:
  12834. @example
  12835. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12836. @end example
  12837. @item
  12838. Use a Photoshop selective color preset:
  12839. @example
  12840. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12841. @end example
  12842. @end itemize
  12843. @anchor{separatefields}
  12844. @section separatefields
  12845. The @code{separatefields} takes a frame-based video input and splits
  12846. each frame into its components fields, producing a new half height clip
  12847. with twice the frame rate and twice the frame count.
  12848. This filter use field-dominance information in frame to decide which
  12849. of each pair of fields to place first in the output.
  12850. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12851. @section setdar, setsar
  12852. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12853. output video.
  12854. This is done by changing the specified Sample (aka Pixel) Aspect
  12855. Ratio, according to the following equation:
  12856. @example
  12857. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12858. @end example
  12859. Keep in mind that the @code{setdar} filter does not modify the pixel
  12860. dimensions of the video frame. Also, the display aspect ratio set by
  12861. this filter may be changed by later filters in the filterchain,
  12862. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12863. applied.
  12864. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12865. the filter output video.
  12866. Note that as a consequence of the application of this filter, the
  12867. output display aspect ratio will change according to the equation
  12868. above.
  12869. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12870. filter may be changed by later filters in the filterchain, e.g. if
  12871. another "setsar" or a "setdar" filter is applied.
  12872. It accepts the following parameters:
  12873. @table @option
  12874. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12875. Set the aspect ratio used by the filter.
  12876. The parameter can be a floating point number string, an expression, or
  12877. a string of the form @var{num}:@var{den}, where @var{num} and
  12878. @var{den} are the numerator and denominator of the aspect ratio. If
  12879. the parameter is not specified, it is assumed the value "0".
  12880. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12881. should be escaped.
  12882. @item max
  12883. Set the maximum integer value to use for expressing numerator and
  12884. denominator when reducing the expressed aspect ratio to a rational.
  12885. Default value is @code{100}.
  12886. @end table
  12887. The parameter @var{sar} is an expression containing
  12888. the following constants:
  12889. @table @option
  12890. @item E, PI, PHI
  12891. These are approximated values for the mathematical constants e
  12892. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12893. @item w, h
  12894. The input width and height.
  12895. @item a
  12896. These are the same as @var{w} / @var{h}.
  12897. @item sar
  12898. The input sample aspect ratio.
  12899. @item dar
  12900. The input display aspect ratio. It is the same as
  12901. (@var{w} / @var{h}) * @var{sar}.
  12902. @item hsub, vsub
  12903. Horizontal and vertical chroma subsample values. For example, for the
  12904. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12905. @end table
  12906. @subsection Examples
  12907. @itemize
  12908. @item
  12909. To change the display aspect ratio to 16:9, specify one of the following:
  12910. @example
  12911. setdar=dar=1.77777
  12912. setdar=dar=16/9
  12913. @end example
  12914. @item
  12915. To change the sample aspect ratio to 10:11, specify:
  12916. @example
  12917. setsar=sar=10/11
  12918. @end example
  12919. @item
  12920. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12921. 1000 in the aspect ratio reduction, use the command:
  12922. @example
  12923. setdar=ratio=16/9:max=1000
  12924. @end example
  12925. @end itemize
  12926. @anchor{setfield}
  12927. @section setfield
  12928. Force field for the output video frame.
  12929. The @code{setfield} filter marks the interlace type field for the
  12930. output frames. It does not change the input frame, but only sets the
  12931. corresponding property, which affects how the frame is treated by
  12932. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12933. The filter accepts the following options:
  12934. @table @option
  12935. @item mode
  12936. Available values are:
  12937. @table @samp
  12938. @item auto
  12939. Keep the same field property.
  12940. @item bff
  12941. Mark the frame as bottom-field-first.
  12942. @item tff
  12943. Mark the frame as top-field-first.
  12944. @item prog
  12945. Mark the frame as progressive.
  12946. @end table
  12947. @end table
  12948. @anchor{setparams}
  12949. @section setparams
  12950. Force frame parameter for the output video frame.
  12951. The @code{setparams} filter marks interlace and color range for the
  12952. output frames. It does not change the input frame, but only sets the
  12953. corresponding property, which affects how the frame is treated by
  12954. filters/encoders.
  12955. @table @option
  12956. @item field_mode
  12957. Available values are:
  12958. @table @samp
  12959. @item auto
  12960. Keep the same field property (default).
  12961. @item bff
  12962. Mark the frame as bottom-field-first.
  12963. @item tff
  12964. Mark the frame as top-field-first.
  12965. @item prog
  12966. Mark the frame as progressive.
  12967. @end table
  12968. @item range
  12969. Available values are:
  12970. @table @samp
  12971. @item auto
  12972. Keep the same color range property (default).
  12973. @item unspecified, unknown
  12974. Mark the frame as unspecified color range.
  12975. @item limited, tv, mpeg
  12976. Mark the frame as limited range.
  12977. @item full, pc, jpeg
  12978. Mark the frame as full range.
  12979. @end table
  12980. @item color_primaries
  12981. Set the color primaries.
  12982. Available values are:
  12983. @table @samp
  12984. @item auto
  12985. Keep the same color primaries property (default).
  12986. @item bt709
  12987. @item unknown
  12988. @item bt470m
  12989. @item bt470bg
  12990. @item smpte170m
  12991. @item smpte240m
  12992. @item film
  12993. @item bt2020
  12994. @item smpte428
  12995. @item smpte431
  12996. @item smpte432
  12997. @item jedec-p22
  12998. @end table
  12999. @item color_trc
  13000. Set the color transfer.
  13001. Available values are:
  13002. @table @samp
  13003. @item auto
  13004. Keep the same color trc property (default).
  13005. @item bt709
  13006. @item unknown
  13007. @item bt470m
  13008. @item bt470bg
  13009. @item smpte170m
  13010. @item smpte240m
  13011. @item linear
  13012. @item log100
  13013. @item log316
  13014. @item iec61966-2-4
  13015. @item bt1361e
  13016. @item iec61966-2-1
  13017. @item bt2020-10
  13018. @item bt2020-12
  13019. @item smpte2084
  13020. @item smpte428
  13021. @item arib-std-b67
  13022. @end table
  13023. @item colorspace
  13024. Set the colorspace.
  13025. Available values are:
  13026. @table @samp
  13027. @item auto
  13028. Keep the same colorspace property (default).
  13029. @item gbr
  13030. @item bt709
  13031. @item unknown
  13032. @item fcc
  13033. @item bt470bg
  13034. @item smpte170m
  13035. @item smpte240m
  13036. @item ycgco
  13037. @item bt2020nc
  13038. @item bt2020c
  13039. @item smpte2085
  13040. @item chroma-derived-nc
  13041. @item chroma-derived-c
  13042. @item ictcp
  13043. @end table
  13044. @end table
  13045. @section showinfo
  13046. Show a line containing various information for each input video frame.
  13047. The input video is not modified.
  13048. This filter supports the following options:
  13049. @table @option
  13050. @item checksum
  13051. Calculate checksums of each plane. By default enabled.
  13052. @end table
  13053. The shown line contains a sequence of key/value pairs of the form
  13054. @var{key}:@var{value}.
  13055. The following values are shown in the output:
  13056. @table @option
  13057. @item n
  13058. The (sequential) number of the input frame, starting from 0.
  13059. @item pts
  13060. The Presentation TimeStamp of the input frame, expressed as a number of
  13061. time base units. The time base unit depends on the filter input pad.
  13062. @item pts_time
  13063. The Presentation TimeStamp of the input frame, expressed as a number of
  13064. seconds.
  13065. @item pos
  13066. The position of the frame in the input stream, or -1 if this information is
  13067. unavailable and/or meaningless (for example in case of synthetic video).
  13068. @item fmt
  13069. The pixel format name.
  13070. @item sar
  13071. The sample aspect ratio of the input frame, expressed in the form
  13072. @var{num}/@var{den}.
  13073. @item s
  13074. The size of the input frame. For the syntax of this option, check the
  13075. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13076. @item i
  13077. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13078. for bottom field first).
  13079. @item iskey
  13080. This is 1 if the frame is a key frame, 0 otherwise.
  13081. @item type
  13082. The picture type of the input frame ("I" for an I-frame, "P" for a
  13083. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13084. Also refer to the documentation of the @code{AVPictureType} enum and of
  13085. the @code{av_get_picture_type_char} function defined in
  13086. @file{libavutil/avutil.h}.
  13087. @item checksum
  13088. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13089. @item plane_checksum
  13090. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13091. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13092. @item mean
  13093. The mean value of pixels in each plane of the input frame, expressed in the form
  13094. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13095. @item stdev
  13096. The standard deviation of pixel values in each plane of the input frame, expressed
  13097. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13098. @end table
  13099. @section showpalette
  13100. Displays the 256 colors palette of each frame. This filter is only relevant for
  13101. @var{pal8} pixel format frames.
  13102. It accepts the following option:
  13103. @table @option
  13104. @item s
  13105. Set the size of the box used to represent one palette color entry. Default is
  13106. @code{30} (for a @code{30x30} pixel box).
  13107. @end table
  13108. @section shuffleframes
  13109. Reorder and/or duplicate and/or drop video frames.
  13110. It accepts the following parameters:
  13111. @table @option
  13112. @item mapping
  13113. Set the destination indexes of input frames.
  13114. This is space or '|' separated list of indexes that maps input frames to output
  13115. frames. Number of indexes also sets maximal value that each index may have.
  13116. '-1' index have special meaning and that is to drop frame.
  13117. @end table
  13118. The first frame has the index 0. The default is to keep the input unchanged.
  13119. @subsection Examples
  13120. @itemize
  13121. @item
  13122. Swap second and third frame of every three frames of the input:
  13123. @example
  13124. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13125. @end example
  13126. @item
  13127. Swap 10th and 1st frame of every ten frames of the input:
  13128. @example
  13129. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13130. @end example
  13131. @end itemize
  13132. @section shuffleplanes
  13133. Reorder and/or duplicate video planes.
  13134. It accepts the following parameters:
  13135. @table @option
  13136. @item map0
  13137. The index of the input plane to be used as the first output plane.
  13138. @item map1
  13139. The index of the input plane to be used as the second output plane.
  13140. @item map2
  13141. The index of the input plane to be used as the third output plane.
  13142. @item map3
  13143. The index of the input plane to be used as the fourth output plane.
  13144. @end table
  13145. The first plane has the index 0. The default is to keep the input unchanged.
  13146. @subsection Examples
  13147. @itemize
  13148. @item
  13149. Swap the second and third planes of the input:
  13150. @example
  13151. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13152. @end example
  13153. @end itemize
  13154. @anchor{signalstats}
  13155. @section signalstats
  13156. Evaluate various visual metrics that assist in determining issues associated
  13157. with the digitization of analog video media.
  13158. By default the filter will log these metadata values:
  13159. @table @option
  13160. @item YMIN
  13161. Display the minimal Y value contained within the input frame. Expressed in
  13162. range of [0-255].
  13163. @item YLOW
  13164. Display the Y value at the 10% percentile within the input frame. Expressed in
  13165. range of [0-255].
  13166. @item YAVG
  13167. Display the average Y value within the input frame. Expressed in range of
  13168. [0-255].
  13169. @item YHIGH
  13170. Display the Y value at the 90% percentile within the input frame. Expressed in
  13171. range of [0-255].
  13172. @item YMAX
  13173. Display the maximum Y value contained within the input frame. Expressed in
  13174. range of [0-255].
  13175. @item UMIN
  13176. Display the minimal U value contained within the input frame. Expressed in
  13177. range of [0-255].
  13178. @item ULOW
  13179. Display the U value at the 10% percentile within the input frame. Expressed in
  13180. range of [0-255].
  13181. @item UAVG
  13182. Display the average U value within the input frame. Expressed in range of
  13183. [0-255].
  13184. @item UHIGH
  13185. Display the U value at the 90% percentile within the input frame. Expressed in
  13186. range of [0-255].
  13187. @item UMAX
  13188. Display the maximum U value contained within the input frame. Expressed in
  13189. range of [0-255].
  13190. @item VMIN
  13191. Display the minimal V value contained within the input frame. Expressed in
  13192. range of [0-255].
  13193. @item VLOW
  13194. Display the V value at the 10% percentile within the input frame. Expressed in
  13195. range of [0-255].
  13196. @item VAVG
  13197. Display the average V value within the input frame. Expressed in range of
  13198. [0-255].
  13199. @item VHIGH
  13200. Display the V value at the 90% percentile within the input frame. Expressed in
  13201. range of [0-255].
  13202. @item VMAX
  13203. Display the maximum V value contained within the input frame. Expressed in
  13204. range of [0-255].
  13205. @item SATMIN
  13206. Display the minimal saturation value contained within the input frame.
  13207. Expressed in range of [0-~181.02].
  13208. @item SATLOW
  13209. Display the saturation value at the 10% percentile within the input frame.
  13210. Expressed in range of [0-~181.02].
  13211. @item SATAVG
  13212. Display the average saturation value within the input frame. Expressed in range
  13213. of [0-~181.02].
  13214. @item SATHIGH
  13215. Display the saturation value at the 90% percentile within the input frame.
  13216. Expressed in range of [0-~181.02].
  13217. @item SATMAX
  13218. Display the maximum saturation value contained within the input frame.
  13219. Expressed in range of [0-~181.02].
  13220. @item HUEMED
  13221. Display the median value for hue within the input frame. Expressed in range of
  13222. [0-360].
  13223. @item HUEAVG
  13224. Display the average value for hue within the input frame. Expressed in range of
  13225. [0-360].
  13226. @item YDIF
  13227. Display the average of sample value difference between all values of the Y
  13228. plane in the current frame and corresponding values of the previous input frame.
  13229. Expressed in range of [0-255].
  13230. @item UDIF
  13231. Display the average of sample value difference between all values of the U
  13232. plane in the current frame and corresponding values of the previous input frame.
  13233. Expressed in range of [0-255].
  13234. @item VDIF
  13235. Display the average of sample value difference between all values of the V
  13236. plane in the current frame and corresponding values of the previous input frame.
  13237. Expressed in range of [0-255].
  13238. @item YBITDEPTH
  13239. Display bit depth of Y plane in current frame.
  13240. Expressed in range of [0-16].
  13241. @item UBITDEPTH
  13242. Display bit depth of U plane in current frame.
  13243. Expressed in range of [0-16].
  13244. @item VBITDEPTH
  13245. Display bit depth of V plane in current frame.
  13246. Expressed in range of [0-16].
  13247. @end table
  13248. The filter accepts the following options:
  13249. @table @option
  13250. @item stat
  13251. @item out
  13252. @option{stat} specify an additional form of image analysis.
  13253. @option{out} output video with the specified type of pixel highlighted.
  13254. Both options accept the following values:
  13255. @table @samp
  13256. @item tout
  13257. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13258. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13259. include the results of video dropouts, head clogs, or tape tracking issues.
  13260. @item vrep
  13261. Identify @var{vertical line repetition}. Vertical line repetition includes
  13262. similar rows of pixels within a frame. In born-digital video vertical line
  13263. repetition is common, but this pattern is uncommon in video digitized from an
  13264. analog source. When it occurs in video that results from the digitization of an
  13265. analog source it can indicate concealment from a dropout compensator.
  13266. @item brng
  13267. Identify pixels that fall outside of legal broadcast range.
  13268. @end table
  13269. @item color, c
  13270. Set the highlight color for the @option{out} option. The default color is
  13271. yellow.
  13272. @end table
  13273. @subsection Examples
  13274. @itemize
  13275. @item
  13276. Output data of various video metrics:
  13277. @example
  13278. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13279. @end example
  13280. @item
  13281. Output specific data about the minimum and maximum values of the Y plane per frame:
  13282. @example
  13283. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13284. @end example
  13285. @item
  13286. Playback video while highlighting pixels that are outside of broadcast range in red.
  13287. @example
  13288. ffplay example.mov -vf signalstats="out=brng:color=red"
  13289. @end example
  13290. @item
  13291. Playback video with signalstats metadata drawn over the frame.
  13292. @example
  13293. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13294. @end example
  13295. The contents of signalstat_drawtext.txt used in the command are:
  13296. @example
  13297. time %@{pts:hms@}
  13298. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13299. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13300. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13301. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13302. @end example
  13303. @end itemize
  13304. @anchor{signature}
  13305. @section signature
  13306. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13307. input. In this case the matching between the inputs can be calculated additionally.
  13308. The filter always passes through the first input. The signature of each stream can
  13309. be written into a file.
  13310. It accepts the following options:
  13311. @table @option
  13312. @item detectmode
  13313. Enable or disable the matching process.
  13314. Available values are:
  13315. @table @samp
  13316. @item off
  13317. Disable the calculation of a matching (default).
  13318. @item full
  13319. Calculate the matching for the whole video and output whether the whole video
  13320. matches or only parts.
  13321. @item fast
  13322. Calculate only until a matching is found or the video ends. Should be faster in
  13323. some cases.
  13324. @end table
  13325. @item nb_inputs
  13326. Set the number of inputs. The option value must be a non negative integer.
  13327. Default value is 1.
  13328. @item filename
  13329. Set the path to which the output is written. If there is more than one input,
  13330. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13331. integer), that will be replaced with the input number. If no filename is
  13332. specified, no output will be written. This is the default.
  13333. @item format
  13334. Choose the output format.
  13335. Available values are:
  13336. @table @samp
  13337. @item binary
  13338. Use the specified binary representation (default).
  13339. @item xml
  13340. Use the specified xml representation.
  13341. @end table
  13342. @item th_d
  13343. Set threshold to detect one word as similar. The option value must be an integer
  13344. greater than zero. The default value is 9000.
  13345. @item th_dc
  13346. Set threshold to detect all words as similar. The option value must be an integer
  13347. greater than zero. The default value is 60000.
  13348. @item th_xh
  13349. Set threshold to detect frames as similar. The option value must be an integer
  13350. greater than zero. The default value is 116.
  13351. @item th_di
  13352. Set the minimum length of a sequence in frames to recognize it as matching
  13353. sequence. The option value must be a non negative integer value.
  13354. The default value is 0.
  13355. @item th_it
  13356. Set the minimum relation, that matching frames to all frames must have.
  13357. The option value must be a double value between 0 and 1. The default value is 0.5.
  13358. @end table
  13359. @subsection Examples
  13360. @itemize
  13361. @item
  13362. To calculate the signature of an input video and store it in signature.bin:
  13363. @example
  13364. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13365. @end example
  13366. @item
  13367. To detect whether two videos match and store the signatures in XML format in
  13368. signature0.xml and signature1.xml:
  13369. @example
  13370. 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 -
  13371. @end example
  13372. @end itemize
  13373. @anchor{smartblur}
  13374. @section smartblur
  13375. Blur the input video without impacting the outlines.
  13376. It accepts the following options:
  13377. @table @option
  13378. @item luma_radius, lr
  13379. Set the luma radius. The option value must be a float number in
  13380. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13381. used to blur the image (slower if larger). Default value is 1.0.
  13382. @item luma_strength, ls
  13383. Set the luma strength. The option value must be a float number
  13384. in the range [-1.0,1.0] that configures the blurring. A value included
  13385. in [0.0,1.0] will blur the image whereas a value included in
  13386. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13387. @item luma_threshold, lt
  13388. Set the luma threshold used as a coefficient to determine
  13389. whether a pixel should be blurred or not. The option value must be an
  13390. integer in the range [-30,30]. A value of 0 will filter all the image,
  13391. a value included in [0,30] will filter flat areas and a value included
  13392. in [-30,0] will filter edges. Default value is 0.
  13393. @item chroma_radius, cr
  13394. Set the chroma radius. The option value must be a float number in
  13395. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13396. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13397. @item chroma_strength, cs
  13398. Set the chroma strength. The option value must be a float number
  13399. in the range [-1.0,1.0] that configures the blurring. A value included
  13400. in [0.0,1.0] will blur the image whereas a value included in
  13401. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13402. @item chroma_threshold, ct
  13403. Set the chroma threshold used as a coefficient to determine
  13404. whether a pixel should be blurred or not. The option value must be an
  13405. integer in the range [-30,30]. A value of 0 will filter all the image,
  13406. a value included in [0,30] will filter flat areas and a value included
  13407. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13408. @end table
  13409. If a chroma option is not explicitly set, the corresponding luma value
  13410. is set.
  13411. @section sobel
  13412. Apply sobel operator to input video stream.
  13413. The filter accepts the following option:
  13414. @table @option
  13415. @item planes
  13416. Set which planes will be processed, unprocessed planes will be copied.
  13417. By default value 0xf, all planes will be processed.
  13418. @item scale
  13419. Set value which will be multiplied with filtered result.
  13420. @item delta
  13421. Set value which will be added to filtered result.
  13422. @end table
  13423. @anchor{spp}
  13424. @section spp
  13425. Apply a simple postprocessing filter that compresses and decompresses the image
  13426. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13427. and average the results.
  13428. The filter accepts the following options:
  13429. @table @option
  13430. @item quality
  13431. Set quality. This option defines the number of levels for averaging. It accepts
  13432. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13433. effect. A value of @code{6} means the higher quality. For each increment of
  13434. that value the speed drops by a factor of approximately 2. Default value is
  13435. @code{3}.
  13436. @item qp
  13437. Force a constant quantization parameter. If not set, the filter will use the QP
  13438. from the video stream (if available).
  13439. @item mode
  13440. Set thresholding mode. Available modes are:
  13441. @table @samp
  13442. @item hard
  13443. Set hard thresholding (default).
  13444. @item soft
  13445. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13446. @end table
  13447. @item use_bframe_qp
  13448. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13449. option may cause flicker since the B-Frames have often larger QP. Default is
  13450. @code{0} (not enabled).
  13451. @end table
  13452. @subsection Commands
  13453. This filter supports the following commands:
  13454. @table @option
  13455. @item quality, level
  13456. Set quality level. The value @code{max} can be used to set the maximum level,
  13457. currently @code{6}.
  13458. @end table
  13459. @anchor{sr}
  13460. @section sr
  13461. Scale the input by applying one of the super-resolution methods based on
  13462. convolutional neural networks. Supported models:
  13463. @itemize
  13464. @item
  13465. Super-Resolution Convolutional Neural Network model (SRCNN).
  13466. See @url{https://arxiv.org/abs/1501.00092}.
  13467. @item
  13468. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13469. See @url{https://arxiv.org/abs/1609.05158}.
  13470. @end itemize
  13471. Training scripts as well as scripts for model file (.pb) saving can be found at
  13472. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13473. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13474. Native model files (.model) can be generated from TensorFlow model
  13475. files (.pb) by using tools/python/convert.py
  13476. The filter accepts the following options:
  13477. @table @option
  13478. @item dnn_backend
  13479. Specify which DNN backend to use for model loading and execution. This option accepts
  13480. the following values:
  13481. @table @samp
  13482. @item native
  13483. Native implementation of DNN loading and execution.
  13484. @item tensorflow
  13485. TensorFlow backend. To enable this backend you
  13486. need to install the TensorFlow for C library (see
  13487. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13488. @code{--enable-libtensorflow}
  13489. @end table
  13490. Default value is @samp{native}.
  13491. @item model
  13492. Set path to model file specifying network architecture and its parameters.
  13493. Note that different backends use different file formats. TensorFlow backend
  13494. can load files for both formats, while native backend can load files for only
  13495. its format.
  13496. @item scale_factor
  13497. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13498. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13499. input upscaled using bicubic upscaling with proper scale factor.
  13500. @end table
  13501. This feature can also be finished with @ref{dnn_processing} filter.
  13502. @section ssim
  13503. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13504. This filter takes in input two input videos, the first input is
  13505. considered the "main" source and is passed unchanged to the
  13506. output. The second input is used as a "reference" video for computing
  13507. the SSIM.
  13508. Both video inputs must have the same resolution and pixel format for
  13509. this filter to work correctly. Also it assumes that both inputs
  13510. have the same number of frames, which are compared one by one.
  13511. The filter stores the calculated SSIM of each frame.
  13512. The description of the accepted parameters follows.
  13513. @table @option
  13514. @item stats_file, f
  13515. If specified the filter will use the named file to save the SSIM of
  13516. each individual frame. When filename equals "-" the data is sent to
  13517. standard output.
  13518. @end table
  13519. The file printed if @var{stats_file} is selected, contains a sequence of
  13520. key/value pairs of the form @var{key}:@var{value} for each compared
  13521. couple of frames.
  13522. A description of each shown parameter follows:
  13523. @table @option
  13524. @item n
  13525. sequential number of the input frame, starting from 1
  13526. @item Y, U, V, R, G, B
  13527. SSIM of the compared frames for the component specified by the suffix.
  13528. @item All
  13529. SSIM of the compared frames for the whole frame.
  13530. @item dB
  13531. Same as above but in dB representation.
  13532. @end table
  13533. This filter also supports the @ref{framesync} options.
  13534. @subsection Examples
  13535. @itemize
  13536. @item
  13537. For example:
  13538. @example
  13539. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13540. [main][ref] ssim="stats_file=stats.log" [out]
  13541. @end example
  13542. On this example the input file being processed is compared with the
  13543. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13544. is stored in @file{stats.log}.
  13545. @item
  13546. Another example with both psnr and ssim at same time:
  13547. @example
  13548. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13549. @end example
  13550. @item
  13551. Another example with different containers:
  13552. @example
  13553. 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 -
  13554. @end example
  13555. @end itemize
  13556. @section stereo3d
  13557. Convert between different stereoscopic image formats.
  13558. The filters accept the following options:
  13559. @table @option
  13560. @item in
  13561. Set stereoscopic image format of input.
  13562. Available values for input image formats are:
  13563. @table @samp
  13564. @item sbsl
  13565. side by side parallel (left eye left, right eye right)
  13566. @item sbsr
  13567. side by side crosseye (right eye left, left eye right)
  13568. @item sbs2l
  13569. side by side parallel with half width resolution
  13570. (left eye left, right eye right)
  13571. @item sbs2r
  13572. side by side crosseye with half width resolution
  13573. (right eye left, left eye right)
  13574. @item abl
  13575. @item tbl
  13576. above-below (left eye above, right eye below)
  13577. @item abr
  13578. @item tbr
  13579. above-below (right eye above, left eye below)
  13580. @item ab2l
  13581. @item tb2l
  13582. above-below with half height resolution
  13583. (left eye above, right eye below)
  13584. @item ab2r
  13585. @item tb2r
  13586. above-below with half height resolution
  13587. (right eye above, left eye below)
  13588. @item al
  13589. alternating frames (left eye first, right eye second)
  13590. @item ar
  13591. alternating frames (right eye first, left eye second)
  13592. @item irl
  13593. interleaved rows (left eye has top row, right eye starts on next row)
  13594. @item irr
  13595. interleaved rows (right eye has top row, left eye starts on next row)
  13596. @item icl
  13597. interleaved columns, left eye first
  13598. @item icr
  13599. interleaved columns, right eye first
  13600. Default value is @samp{sbsl}.
  13601. @end table
  13602. @item out
  13603. Set stereoscopic image format of output.
  13604. @table @samp
  13605. @item sbsl
  13606. side by side parallel (left eye left, right eye right)
  13607. @item sbsr
  13608. side by side crosseye (right eye left, left eye right)
  13609. @item sbs2l
  13610. side by side parallel with half width resolution
  13611. (left eye left, right eye right)
  13612. @item sbs2r
  13613. side by side crosseye with half width resolution
  13614. (right eye left, left eye right)
  13615. @item abl
  13616. @item tbl
  13617. above-below (left eye above, right eye below)
  13618. @item abr
  13619. @item tbr
  13620. above-below (right eye above, left eye below)
  13621. @item ab2l
  13622. @item tb2l
  13623. above-below with half height resolution
  13624. (left eye above, right eye below)
  13625. @item ab2r
  13626. @item tb2r
  13627. above-below with half height resolution
  13628. (right eye above, left eye below)
  13629. @item al
  13630. alternating frames (left eye first, right eye second)
  13631. @item ar
  13632. alternating frames (right eye first, left eye second)
  13633. @item irl
  13634. interleaved rows (left eye has top row, right eye starts on next row)
  13635. @item irr
  13636. interleaved rows (right eye has top row, left eye starts on next row)
  13637. @item arbg
  13638. anaglyph red/blue gray
  13639. (red filter on left eye, blue filter on right eye)
  13640. @item argg
  13641. anaglyph red/green gray
  13642. (red filter on left eye, green filter on right eye)
  13643. @item arcg
  13644. anaglyph red/cyan gray
  13645. (red filter on left eye, cyan filter on right eye)
  13646. @item arch
  13647. anaglyph red/cyan half colored
  13648. (red filter on left eye, cyan filter on right eye)
  13649. @item arcc
  13650. anaglyph red/cyan color
  13651. (red filter on left eye, cyan filter on right eye)
  13652. @item arcd
  13653. anaglyph red/cyan color optimized with the least squares projection of dubois
  13654. (red filter on left eye, cyan filter on right eye)
  13655. @item agmg
  13656. anaglyph green/magenta gray
  13657. (green filter on left eye, magenta filter on right eye)
  13658. @item agmh
  13659. anaglyph green/magenta half colored
  13660. (green filter on left eye, magenta filter on right eye)
  13661. @item agmc
  13662. anaglyph green/magenta colored
  13663. (green filter on left eye, magenta filter on right eye)
  13664. @item agmd
  13665. anaglyph green/magenta color optimized with the least squares projection of dubois
  13666. (green filter on left eye, magenta filter on right eye)
  13667. @item aybg
  13668. anaglyph yellow/blue gray
  13669. (yellow filter on left eye, blue filter on right eye)
  13670. @item aybh
  13671. anaglyph yellow/blue half colored
  13672. (yellow filter on left eye, blue filter on right eye)
  13673. @item aybc
  13674. anaglyph yellow/blue colored
  13675. (yellow filter on left eye, blue filter on right eye)
  13676. @item aybd
  13677. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13678. (yellow filter on left eye, blue filter on right eye)
  13679. @item ml
  13680. mono output (left eye only)
  13681. @item mr
  13682. mono output (right eye only)
  13683. @item chl
  13684. checkerboard, left eye first
  13685. @item chr
  13686. checkerboard, right eye first
  13687. @item icl
  13688. interleaved columns, left eye first
  13689. @item icr
  13690. interleaved columns, right eye first
  13691. @item hdmi
  13692. HDMI frame pack
  13693. @end table
  13694. Default value is @samp{arcd}.
  13695. @end table
  13696. @subsection Examples
  13697. @itemize
  13698. @item
  13699. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13700. @example
  13701. stereo3d=sbsl:aybd
  13702. @end example
  13703. @item
  13704. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13705. @example
  13706. stereo3d=abl:sbsr
  13707. @end example
  13708. @end itemize
  13709. @section streamselect, astreamselect
  13710. Select video or audio streams.
  13711. The filter accepts the following options:
  13712. @table @option
  13713. @item inputs
  13714. Set number of inputs. Default is 2.
  13715. @item map
  13716. Set input indexes to remap to outputs.
  13717. @end table
  13718. @subsection Commands
  13719. The @code{streamselect} and @code{astreamselect} filter supports the following
  13720. commands:
  13721. @table @option
  13722. @item map
  13723. Set input indexes to remap to outputs.
  13724. @end table
  13725. @subsection Examples
  13726. @itemize
  13727. @item
  13728. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13729. @example
  13730. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13731. @end example
  13732. @item
  13733. Same as above, but for audio:
  13734. @example
  13735. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13736. @end example
  13737. @end itemize
  13738. @anchor{subtitles}
  13739. @section subtitles
  13740. Draw subtitles on top of input video using the libass library.
  13741. To enable compilation of this filter you need to configure FFmpeg with
  13742. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13743. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13744. Alpha) subtitles format.
  13745. The filter accepts the following options:
  13746. @table @option
  13747. @item filename, f
  13748. Set the filename of the subtitle file to read. It must be specified.
  13749. @item original_size
  13750. Specify the size of the original video, the video for which the ASS file
  13751. was composed. For the syntax of this option, check the
  13752. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13753. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13754. correctly scale the fonts if the aspect ratio has been changed.
  13755. @item fontsdir
  13756. Set a directory path containing fonts that can be used by the filter.
  13757. These fonts will be used in addition to whatever the font provider uses.
  13758. @item alpha
  13759. Process alpha channel, by default alpha channel is untouched.
  13760. @item charenc
  13761. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13762. useful if not UTF-8.
  13763. @item stream_index, si
  13764. Set subtitles stream index. @code{subtitles} filter only.
  13765. @item force_style
  13766. Override default style or script info parameters of the subtitles. It accepts a
  13767. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13768. @end table
  13769. If the first key is not specified, it is assumed that the first value
  13770. specifies the @option{filename}.
  13771. For example, to render the file @file{sub.srt} on top of the input
  13772. video, use the command:
  13773. @example
  13774. subtitles=sub.srt
  13775. @end example
  13776. which is equivalent to:
  13777. @example
  13778. subtitles=filename=sub.srt
  13779. @end example
  13780. To render the default subtitles stream from file @file{video.mkv}, use:
  13781. @example
  13782. subtitles=video.mkv
  13783. @end example
  13784. To render the second subtitles stream from that file, use:
  13785. @example
  13786. subtitles=video.mkv:si=1
  13787. @end example
  13788. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13789. @code{DejaVu Serif}, use:
  13790. @example
  13791. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13792. @end example
  13793. @section super2xsai
  13794. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13795. Interpolate) pixel art scaling algorithm.
  13796. Useful for enlarging pixel art images without reducing sharpness.
  13797. @section swaprect
  13798. Swap two rectangular objects in video.
  13799. This filter accepts the following options:
  13800. @table @option
  13801. @item w
  13802. Set object width.
  13803. @item h
  13804. Set object height.
  13805. @item x1
  13806. Set 1st rect x coordinate.
  13807. @item y1
  13808. Set 1st rect y coordinate.
  13809. @item x2
  13810. Set 2nd rect x coordinate.
  13811. @item y2
  13812. Set 2nd rect y coordinate.
  13813. All expressions are evaluated once for each frame.
  13814. @end table
  13815. The all options are expressions containing the following constants:
  13816. @table @option
  13817. @item w
  13818. @item h
  13819. The input width and height.
  13820. @item a
  13821. same as @var{w} / @var{h}
  13822. @item sar
  13823. input sample aspect ratio
  13824. @item dar
  13825. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13826. @item n
  13827. The number of the input frame, starting from 0.
  13828. @item t
  13829. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13830. @item pos
  13831. the position in the file of the input frame, NAN if unknown
  13832. @end table
  13833. @section swapuv
  13834. Swap U & V plane.
  13835. @section tblend
  13836. Blend successive video frames.
  13837. See @ref{blend}
  13838. @section telecine
  13839. Apply telecine process to the video.
  13840. This filter accepts the following options:
  13841. @table @option
  13842. @item first_field
  13843. @table @samp
  13844. @item top, t
  13845. top field first
  13846. @item bottom, b
  13847. bottom field first
  13848. The default value is @code{top}.
  13849. @end table
  13850. @item pattern
  13851. A string of numbers representing the pulldown pattern you wish to apply.
  13852. The default value is @code{23}.
  13853. @end table
  13854. @example
  13855. Some typical patterns:
  13856. NTSC output (30i):
  13857. 27.5p: 32222
  13858. 24p: 23 (classic)
  13859. 24p: 2332 (preferred)
  13860. 20p: 33
  13861. 18p: 334
  13862. 16p: 3444
  13863. PAL output (25i):
  13864. 27.5p: 12222
  13865. 24p: 222222222223 ("Euro pulldown")
  13866. 16.67p: 33
  13867. 16p: 33333334
  13868. @end example
  13869. @section thistogram
  13870. Compute and draw a color distribution histogram for the input video across time.
  13871. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13872. at certain time, this filter shows also past histograms of number of frames defined
  13873. by @code{width} option.
  13874. The computed histogram is a representation of the color component
  13875. distribution in an image.
  13876. The filter accepts the following options:
  13877. @table @option
  13878. @item width, w
  13879. Set width of single color component output. Default value is @code{0}.
  13880. Value of @code{0} means width will be picked from input video.
  13881. This also set number of passed histograms to keep.
  13882. Allowed range is [0, 8192].
  13883. @item display_mode, d
  13884. Set display mode.
  13885. It accepts the following values:
  13886. @table @samp
  13887. @item stack
  13888. Per color component graphs are placed below each other.
  13889. @item parade
  13890. Per color component graphs are placed side by side.
  13891. @item overlay
  13892. Presents information identical to that in the @code{parade}, except
  13893. that the graphs representing color components are superimposed directly
  13894. over one another.
  13895. @end table
  13896. Default is @code{stack}.
  13897. @item levels_mode, m
  13898. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  13899. Default is @code{linear}.
  13900. @item components, c
  13901. Set what color components to display.
  13902. Default is @code{7}.
  13903. @item bgopacity, b
  13904. Set background opacity. Default is @code{0.9}.
  13905. @item envelope, e
  13906. Show envelope. Default is disabled.
  13907. @item ecolor, ec
  13908. Set envelope color. Default is @code{gold}.
  13909. @item slide
  13910. Set slide mode.
  13911. Available values for slide is:
  13912. @table @samp
  13913. @item frame
  13914. Draw new frame when right border is reached.
  13915. @item replace
  13916. Replace old columns with new ones.
  13917. @item scroll
  13918. Scroll from right to left.
  13919. @item rscroll
  13920. Scroll from left to right.
  13921. @item picture
  13922. Draw single picture.
  13923. @end table
  13924. Default is @code{replace}.
  13925. @end table
  13926. @section threshold
  13927. Apply threshold effect to video stream.
  13928. This filter needs four video streams to perform thresholding.
  13929. First stream is stream we are filtering.
  13930. Second stream is holding threshold values, third stream is holding min values,
  13931. and last, fourth stream is holding max values.
  13932. The filter accepts the following option:
  13933. @table @option
  13934. @item planes
  13935. Set which planes will be processed, unprocessed planes will be copied.
  13936. By default value 0xf, all planes will be processed.
  13937. @end table
  13938. For example if first stream pixel's component value is less then threshold value
  13939. of pixel component from 2nd threshold stream, third stream value will picked,
  13940. otherwise fourth stream pixel component value will be picked.
  13941. Using color source filter one can perform various types of thresholding:
  13942. @subsection Examples
  13943. @itemize
  13944. @item
  13945. Binary threshold, using gray color as threshold:
  13946. @example
  13947. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13948. @end example
  13949. @item
  13950. Inverted binary threshold, using gray color as threshold:
  13951. @example
  13952. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13953. @end example
  13954. @item
  13955. Truncate binary threshold, using gray color as threshold:
  13956. @example
  13957. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13958. @end example
  13959. @item
  13960. Threshold to zero, using gray color as threshold:
  13961. @example
  13962. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13963. @end example
  13964. @item
  13965. Inverted threshold to zero, using gray color as threshold:
  13966. @example
  13967. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13968. @end example
  13969. @end itemize
  13970. @section thumbnail
  13971. Select the most representative frame in a given sequence of consecutive frames.
  13972. The filter accepts the following options:
  13973. @table @option
  13974. @item n
  13975. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13976. will pick one of them, and then handle the next batch of @var{n} frames until
  13977. the end. Default is @code{100}.
  13978. @end table
  13979. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13980. value will result in a higher memory usage, so a high value is not recommended.
  13981. @subsection Examples
  13982. @itemize
  13983. @item
  13984. Extract one picture each 50 frames:
  13985. @example
  13986. thumbnail=50
  13987. @end example
  13988. @item
  13989. Complete example of a thumbnail creation with @command{ffmpeg}:
  13990. @example
  13991. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13992. @end example
  13993. @end itemize
  13994. @anchor{tile}
  13995. @section tile
  13996. Tile several successive frames together.
  13997. The @ref{untile} filter can do the reverse.
  13998. The filter accepts the following options:
  13999. @table @option
  14000. @item layout
  14001. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14002. this option, check the
  14003. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14004. @item nb_frames
  14005. Set the maximum number of frames to render in the given area. It must be less
  14006. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14007. the area will be used.
  14008. @item margin
  14009. Set the outer border margin in pixels.
  14010. @item padding
  14011. Set the inner border thickness (i.e. the number of pixels between frames). For
  14012. more advanced padding options (such as having different values for the edges),
  14013. refer to the pad video filter.
  14014. @item color
  14015. Specify the color of the unused area. For the syntax of this option, check the
  14016. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14017. The default value of @var{color} is "black".
  14018. @item overlap
  14019. Set the number of frames to overlap when tiling several successive frames together.
  14020. The value must be between @code{0} and @var{nb_frames - 1}.
  14021. @item init_padding
  14022. Set the number of frames to initially be empty before displaying first output frame.
  14023. This controls how soon will one get first output frame.
  14024. The value must be between @code{0} and @var{nb_frames - 1}.
  14025. @end table
  14026. @subsection Examples
  14027. @itemize
  14028. @item
  14029. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14030. @example
  14031. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14032. @end example
  14033. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14034. duplicating each output frame to accommodate the originally detected frame
  14035. rate.
  14036. @item
  14037. Display @code{5} pictures in an area of @code{3x2} frames,
  14038. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14039. mixed flat and named options:
  14040. @example
  14041. tile=3x2:nb_frames=5:padding=7:margin=2
  14042. @end example
  14043. @end itemize
  14044. @section tinterlace
  14045. Perform various types of temporal field interlacing.
  14046. Frames are counted starting from 1, so the first input frame is
  14047. considered odd.
  14048. The filter accepts the following options:
  14049. @table @option
  14050. @item mode
  14051. Specify the mode of the interlacing. This option can also be specified
  14052. as a value alone. See below for a list of values for this option.
  14053. Available values are:
  14054. @table @samp
  14055. @item merge, 0
  14056. Move odd frames into the upper field, even into the lower field,
  14057. generating a double height frame at half frame rate.
  14058. @example
  14059. ------> time
  14060. Input:
  14061. Frame 1 Frame 2 Frame 3 Frame 4
  14062. 11111 22222 33333 44444
  14063. 11111 22222 33333 44444
  14064. 11111 22222 33333 44444
  14065. 11111 22222 33333 44444
  14066. Output:
  14067. 11111 33333
  14068. 22222 44444
  14069. 11111 33333
  14070. 22222 44444
  14071. 11111 33333
  14072. 22222 44444
  14073. 11111 33333
  14074. 22222 44444
  14075. @end example
  14076. @item drop_even, 1
  14077. Only output odd frames, even frames are dropped, generating a frame with
  14078. unchanged height at half frame rate.
  14079. @example
  14080. ------> time
  14081. Input:
  14082. Frame 1 Frame 2 Frame 3 Frame 4
  14083. 11111 22222 33333 44444
  14084. 11111 22222 33333 44444
  14085. 11111 22222 33333 44444
  14086. 11111 22222 33333 44444
  14087. Output:
  14088. 11111 33333
  14089. 11111 33333
  14090. 11111 33333
  14091. 11111 33333
  14092. @end example
  14093. @item drop_odd, 2
  14094. Only output even frames, odd frames are dropped, generating a frame with
  14095. unchanged height at half frame rate.
  14096. @example
  14097. ------> time
  14098. Input:
  14099. Frame 1 Frame 2 Frame 3 Frame 4
  14100. 11111 22222 33333 44444
  14101. 11111 22222 33333 44444
  14102. 11111 22222 33333 44444
  14103. 11111 22222 33333 44444
  14104. Output:
  14105. 22222 44444
  14106. 22222 44444
  14107. 22222 44444
  14108. 22222 44444
  14109. @end example
  14110. @item pad, 3
  14111. Expand each frame to full height, but pad alternate lines with black,
  14112. generating a frame with double height at the same input frame rate.
  14113. @example
  14114. ------> time
  14115. Input:
  14116. Frame 1 Frame 2 Frame 3 Frame 4
  14117. 11111 22222 33333 44444
  14118. 11111 22222 33333 44444
  14119. 11111 22222 33333 44444
  14120. 11111 22222 33333 44444
  14121. Output:
  14122. 11111 ..... 33333 .....
  14123. ..... 22222 ..... 44444
  14124. 11111 ..... 33333 .....
  14125. ..... 22222 ..... 44444
  14126. 11111 ..... 33333 .....
  14127. ..... 22222 ..... 44444
  14128. 11111 ..... 33333 .....
  14129. ..... 22222 ..... 44444
  14130. @end example
  14131. @item interleave_top, 4
  14132. Interleave the upper field from odd frames with the lower field from
  14133. even frames, generating a frame with unchanged height at half frame rate.
  14134. @example
  14135. ------> time
  14136. Input:
  14137. Frame 1 Frame 2 Frame 3 Frame 4
  14138. 11111<- 22222 33333<- 44444
  14139. 11111 22222<- 33333 44444<-
  14140. 11111<- 22222 33333<- 44444
  14141. 11111 22222<- 33333 44444<-
  14142. Output:
  14143. 11111 33333
  14144. 22222 44444
  14145. 11111 33333
  14146. 22222 44444
  14147. @end example
  14148. @item interleave_bottom, 5
  14149. Interleave the lower field from odd frames with the upper field from
  14150. even frames, generating a frame with unchanged height at half frame rate.
  14151. @example
  14152. ------> time
  14153. Input:
  14154. Frame 1 Frame 2 Frame 3 Frame 4
  14155. 11111 22222<- 33333 44444<-
  14156. 11111<- 22222 33333<- 44444
  14157. 11111 22222<- 33333 44444<-
  14158. 11111<- 22222 33333<- 44444
  14159. Output:
  14160. 22222 44444
  14161. 11111 33333
  14162. 22222 44444
  14163. 11111 33333
  14164. @end example
  14165. @item interlacex2, 6
  14166. Double frame rate with unchanged height. Frames are inserted each
  14167. containing the second temporal field from the previous input frame and
  14168. the first temporal field from the next input frame. This mode relies on
  14169. the top_field_first flag. Useful for interlaced video displays with no
  14170. field synchronisation.
  14171. @example
  14172. ------> time
  14173. Input:
  14174. Frame 1 Frame 2 Frame 3 Frame 4
  14175. 11111 22222 33333 44444
  14176. 11111 22222 33333 44444
  14177. 11111 22222 33333 44444
  14178. 11111 22222 33333 44444
  14179. Output:
  14180. 11111 22222 22222 33333 33333 44444 44444
  14181. 11111 11111 22222 22222 33333 33333 44444
  14182. 11111 22222 22222 33333 33333 44444 44444
  14183. 11111 11111 22222 22222 33333 33333 44444
  14184. @end example
  14185. @item mergex2, 7
  14186. Move odd frames into the upper field, even into the lower field,
  14187. generating a double height frame at same frame rate.
  14188. @example
  14189. ------> time
  14190. Input:
  14191. Frame 1 Frame 2 Frame 3 Frame 4
  14192. 11111 22222 33333 44444
  14193. 11111 22222 33333 44444
  14194. 11111 22222 33333 44444
  14195. 11111 22222 33333 44444
  14196. Output:
  14197. 11111 33333 33333 55555
  14198. 22222 22222 44444 44444
  14199. 11111 33333 33333 55555
  14200. 22222 22222 44444 44444
  14201. 11111 33333 33333 55555
  14202. 22222 22222 44444 44444
  14203. 11111 33333 33333 55555
  14204. 22222 22222 44444 44444
  14205. @end example
  14206. @end table
  14207. Numeric values are deprecated but are accepted for backward
  14208. compatibility reasons.
  14209. Default mode is @code{merge}.
  14210. @item flags
  14211. Specify flags influencing the filter process.
  14212. Available value for @var{flags} is:
  14213. @table @option
  14214. @item low_pass_filter, vlpf
  14215. Enable linear vertical low-pass filtering in the filter.
  14216. Vertical low-pass filtering is required when creating an interlaced
  14217. destination from a progressive source which contains high-frequency
  14218. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14219. patterning.
  14220. @item complex_filter, cvlpf
  14221. Enable complex vertical low-pass filtering.
  14222. This will slightly less reduce interlace 'twitter' and Moire
  14223. patterning but better retain detail and subjective sharpness impression.
  14224. @item bypass_il
  14225. Bypass already interlaced frames, only adjust the frame rate.
  14226. @end table
  14227. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14228. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14229. @end table
  14230. @section tmedian
  14231. Pick median pixels from several successive input video frames.
  14232. The filter accepts the following options:
  14233. @table @option
  14234. @item radius
  14235. Set radius of median filter.
  14236. Default is 1. Allowed range is from 1 to 127.
  14237. @item planes
  14238. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14239. @item percentile
  14240. Set median percentile. Default value is @code{0.5}.
  14241. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14242. minimum values, and @code{1} maximum values.
  14243. @end table
  14244. @section tmix
  14245. Mix successive video frames.
  14246. A description of the accepted options follows.
  14247. @table @option
  14248. @item frames
  14249. The number of successive frames to mix. If unspecified, it defaults to 3.
  14250. @item weights
  14251. Specify weight of each input video frame.
  14252. Each weight is separated by space. If number of weights is smaller than
  14253. number of @var{frames} last specified weight will be used for all remaining
  14254. unset weights.
  14255. @item scale
  14256. Specify scale, if it is set it will be multiplied with sum
  14257. of each weight multiplied with pixel values to give final destination
  14258. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14259. @end table
  14260. @subsection Examples
  14261. @itemize
  14262. @item
  14263. Average 7 successive frames:
  14264. @example
  14265. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14266. @end example
  14267. @item
  14268. Apply simple temporal convolution:
  14269. @example
  14270. tmix=frames=3:weights="-1 3 -1"
  14271. @end example
  14272. @item
  14273. Similar as above but only showing temporal differences:
  14274. @example
  14275. tmix=frames=3:weights="-1 2 -1":scale=1
  14276. @end example
  14277. @end itemize
  14278. @anchor{tonemap}
  14279. @section tonemap
  14280. Tone map colors from different dynamic ranges.
  14281. This filter expects data in single precision floating point, as it needs to
  14282. operate on (and can output) out-of-range values. Another filter, such as
  14283. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14284. The tonemapping algorithms implemented only work on linear light, so input
  14285. data should be linearized beforehand (and possibly correctly tagged).
  14286. @example
  14287. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14288. @end example
  14289. @subsection Options
  14290. The filter accepts the following options.
  14291. @table @option
  14292. @item tonemap
  14293. Set the tone map algorithm to use.
  14294. Possible values are:
  14295. @table @var
  14296. @item none
  14297. Do not apply any tone map, only desaturate overbright pixels.
  14298. @item clip
  14299. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14300. in-range values, while distorting out-of-range values.
  14301. @item linear
  14302. Stretch the entire reference gamut to a linear multiple of the display.
  14303. @item gamma
  14304. Fit a logarithmic transfer between the tone curves.
  14305. @item reinhard
  14306. Preserve overall image brightness with a simple curve, using nonlinear
  14307. contrast, which results in flattening details and degrading color accuracy.
  14308. @item hable
  14309. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14310. of slightly darkening everything. Use it when detail preservation is more
  14311. important than color and brightness accuracy.
  14312. @item mobius
  14313. Smoothly map out-of-range values, while retaining contrast and colors for
  14314. in-range material as much as possible. Use it when color accuracy is more
  14315. important than detail preservation.
  14316. @end table
  14317. Default is none.
  14318. @item param
  14319. Tune the tone mapping algorithm.
  14320. This affects the following algorithms:
  14321. @table @var
  14322. @item none
  14323. Ignored.
  14324. @item linear
  14325. Specifies the scale factor to use while stretching.
  14326. Default to 1.0.
  14327. @item gamma
  14328. Specifies the exponent of the function.
  14329. Default to 1.8.
  14330. @item clip
  14331. Specify an extra linear coefficient to multiply into the signal before clipping.
  14332. Default to 1.0.
  14333. @item reinhard
  14334. Specify the local contrast coefficient at the display peak.
  14335. Default to 0.5, which means that in-gamut values will be about half as bright
  14336. as when clipping.
  14337. @item hable
  14338. Ignored.
  14339. @item mobius
  14340. Specify the transition point from linear to mobius transform. Every value
  14341. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14342. more accurate the result will be, at the cost of losing bright details.
  14343. Default to 0.3, which due to the steep initial slope still preserves in-range
  14344. colors fairly accurately.
  14345. @end table
  14346. @item desat
  14347. Apply desaturation for highlights that exceed this level of brightness. The
  14348. higher the parameter, the more color information will be preserved. This
  14349. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14350. (smoothly) turning into white instead. This makes images feel more natural,
  14351. at the cost of reducing information about out-of-range colors.
  14352. The default of 2.0 is somewhat conservative and will mostly just apply to
  14353. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14354. This option works only if the input frame has a supported color tag.
  14355. @item peak
  14356. Override signal/nominal/reference peak with this value. Useful when the
  14357. embedded peak information in display metadata is not reliable or when tone
  14358. mapping from a lower range to a higher range.
  14359. @end table
  14360. @section tpad
  14361. Temporarily pad video frames.
  14362. The filter accepts the following options:
  14363. @table @option
  14364. @item start
  14365. Specify number of delay frames before input video stream. Default is 0.
  14366. @item stop
  14367. Specify number of padding frames after input video stream.
  14368. Set to -1 to pad indefinitely. Default is 0.
  14369. @item start_mode
  14370. Set kind of frames added to beginning of stream.
  14371. Can be either @var{add} or @var{clone}.
  14372. With @var{add} frames of solid-color are added.
  14373. With @var{clone} frames are clones of first frame.
  14374. Default is @var{add}.
  14375. @item stop_mode
  14376. Set kind of frames added to end of stream.
  14377. Can be either @var{add} or @var{clone}.
  14378. With @var{add} frames of solid-color are added.
  14379. With @var{clone} frames are clones of last frame.
  14380. Default is @var{add}.
  14381. @item start_duration, stop_duration
  14382. Specify the duration of the start/stop delay. See
  14383. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14384. for the accepted syntax.
  14385. These options override @var{start} and @var{stop}. Default is 0.
  14386. @item color
  14387. Specify the color of the padded area. For the syntax of this option,
  14388. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14389. manual,ffmpeg-utils}.
  14390. The default value of @var{color} is "black".
  14391. @end table
  14392. @anchor{transpose}
  14393. @section transpose
  14394. Transpose rows with columns in the input video and optionally flip it.
  14395. It accepts the following parameters:
  14396. @table @option
  14397. @item dir
  14398. Specify the transposition direction.
  14399. Can assume the following values:
  14400. @table @samp
  14401. @item 0, 4, cclock_flip
  14402. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14403. @example
  14404. L.R L.l
  14405. . . -> . .
  14406. l.r R.r
  14407. @end example
  14408. @item 1, 5, clock
  14409. Rotate by 90 degrees clockwise, that is:
  14410. @example
  14411. L.R l.L
  14412. . . -> . .
  14413. l.r r.R
  14414. @end example
  14415. @item 2, 6, cclock
  14416. Rotate by 90 degrees counterclockwise, that is:
  14417. @example
  14418. L.R R.r
  14419. . . -> . .
  14420. l.r L.l
  14421. @end example
  14422. @item 3, 7, clock_flip
  14423. Rotate by 90 degrees clockwise and vertically flip, that is:
  14424. @example
  14425. L.R r.R
  14426. . . -> . .
  14427. l.r l.L
  14428. @end example
  14429. @end table
  14430. For values between 4-7, the transposition is only done if the input
  14431. video geometry is portrait and not landscape. These values are
  14432. deprecated, the @code{passthrough} option should be used instead.
  14433. Numerical values are deprecated, and should be dropped in favor of
  14434. symbolic constants.
  14435. @item passthrough
  14436. Do not apply the transposition if the input geometry matches the one
  14437. specified by the specified value. It accepts the following values:
  14438. @table @samp
  14439. @item none
  14440. Always apply transposition.
  14441. @item portrait
  14442. Preserve portrait geometry (when @var{height} >= @var{width}).
  14443. @item landscape
  14444. Preserve landscape geometry (when @var{width} >= @var{height}).
  14445. @end table
  14446. Default value is @code{none}.
  14447. @end table
  14448. For example to rotate by 90 degrees clockwise and preserve portrait
  14449. layout:
  14450. @example
  14451. transpose=dir=1:passthrough=portrait
  14452. @end example
  14453. The command above can also be specified as:
  14454. @example
  14455. transpose=1:portrait
  14456. @end example
  14457. @section transpose_npp
  14458. Transpose rows with columns in the input video and optionally flip it.
  14459. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14460. It accepts the following parameters:
  14461. @table @option
  14462. @item dir
  14463. Specify the transposition direction.
  14464. Can assume the following values:
  14465. @table @samp
  14466. @item cclock_flip
  14467. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14468. @item clock
  14469. Rotate by 90 degrees clockwise.
  14470. @item cclock
  14471. Rotate by 90 degrees counterclockwise.
  14472. @item clock_flip
  14473. Rotate by 90 degrees clockwise and vertically flip.
  14474. @end table
  14475. @item passthrough
  14476. Do not apply the transposition if the input geometry matches the one
  14477. specified by the specified value. It accepts the following values:
  14478. @table @samp
  14479. @item none
  14480. Always apply transposition. (default)
  14481. @item portrait
  14482. Preserve portrait geometry (when @var{height} >= @var{width}).
  14483. @item landscape
  14484. Preserve landscape geometry (when @var{width} >= @var{height}).
  14485. @end table
  14486. @end table
  14487. @section trim
  14488. Trim the input so that the output contains one continuous subpart of the input.
  14489. It accepts the following parameters:
  14490. @table @option
  14491. @item start
  14492. Specify the time of the start of the kept section, i.e. the frame with the
  14493. timestamp @var{start} will be the first frame in the output.
  14494. @item end
  14495. Specify the time of the first frame that will be dropped, i.e. the frame
  14496. immediately preceding the one with the timestamp @var{end} will be the last
  14497. frame in the output.
  14498. @item start_pts
  14499. This is the same as @var{start}, except this option sets the start timestamp
  14500. in timebase units instead of seconds.
  14501. @item end_pts
  14502. This is the same as @var{end}, except this option sets the end timestamp
  14503. in timebase units instead of seconds.
  14504. @item duration
  14505. The maximum duration of the output in seconds.
  14506. @item start_frame
  14507. The number of the first frame that should be passed to the output.
  14508. @item end_frame
  14509. The number of the first frame that should be dropped.
  14510. @end table
  14511. @option{start}, @option{end}, and @option{duration} are expressed as time
  14512. duration specifications; see
  14513. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14514. for the accepted syntax.
  14515. Note that the first two sets of the start/end options and the @option{duration}
  14516. option look at the frame timestamp, while the _frame variants simply count the
  14517. frames that pass through the filter. Also note that this filter does not modify
  14518. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14519. setpts filter after the trim filter.
  14520. If multiple start or end options are set, this filter tries to be greedy and
  14521. keep all the frames that match at least one of the specified constraints. To keep
  14522. only the part that matches all the constraints at once, chain multiple trim
  14523. filters.
  14524. The defaults are such that all the input is kept. So it is possible to set e.g.
  14525. just the end values to keep everything before the specified time.
  14526. Examples:
  14527. @itemize
  14528. @item
  14529. Drop everything except the second minute of input:
  14530. @example
  14531. ffmpeg -i INPUT -vf trim=60:120
  14532. @end example
  14533. @item
  14534. Keep only the first second:
  14535. @example
  14536. ffmpeg -i INPUT -vf trim=duration=1
  14537. @end example
  14538. @end itemize
  14539. @section unpremultiply
  14540. Apply alpha unpremultiply effect to input video stream using first plane
  14541. of second stream as alpha.
  14542. Both streams must have same dimensions and same pixel format.
  14543. The filter accepts the following option:
  14544. @table @option
  14545. @item planes
  14546. Set which planes will be processed, unprocessed planes will be copied.
  14547. By default value 0xf, all planes will be processed.
  14548. If the format has 1 or 2 components, then luma is bit 0.
  14549. If the format has 3 or 4 components:
  14550. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14551. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14552. If present, the alpha channel is always the last bit.
  14553. @item inplace
  14554. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14555. @end table
  14556. @anchor{unsharp}
  14557. @section unsharp
  14558. Sharpen or blur the input video.
  14559. It accepts the following parameters:
  14560. @table @option
  14561. @item luma_msize_x, lx
  14562. Set the luma matrix horizontal size. It must be an odd integer between
  14563. 3 and 23. The default value is 5.
  14564. @item luma_msize_y, ly
  14565. Set the luma matrix vertical size. It must be an odd integer between 3
  14566. and 23. The default value is 5.
  14567. @item luma_amount, la
  14568. Set the luma effect strength. It must be a floating point number, reasonable
  14569. values lay between -1.5 and 1.5.
  14570. Negative values will blur the input video, while positive values will
  14571. sharpen it, a value of zero will disable the effect.
  14572. Default value is 1.0.
  14573. @item chroma_msize_x, cx
  14574. Set the chroma matrix horizontal size. It must be an odd integer
  14575. between 3 and 23. The default value is 5.
  14576. @item chroma_msize_y, cy
  14577. Set the chroma matrix vertical size. It must be an odd integer
  14578. between 3 and 23. The default value is 5.
  14579. @item chroma_amount, ca
  14580. Set the chroma effect strength. It must be a floating point number, reasonable
  14581. values lay between -1.5 and 1.5.
  14582. Negative values will blur the input video, while positive values will
  14583. sharpen it, a value of zero will disable the effect.
  14584. Default value is 0.0.
  14585. @end table
  14586. All parameters are optional and default to the equivalent of the
  14587. string '5:5:1.0:5:5:0.0'.
  14588. @subsection Examples
  14589. @itemize
  14590. @item
  14591. Apply strong luma sharpen effect:
  14592. @example
  14593. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14594. @end example
  14595. @item
  14596. Apply a strong blur of both luma and chroma parameters:
  14597. @example
  14598. unsharp=7:7:-2:7:7:-2
  14599. @end example
  14600. @end itemize
  14601. @anchor{untile}
  14602. @section untile
  14603. Decompose a video made of tiled images into the individual images.
  14604. The frame rate of the output video is the frame rate of the input video
  14605. multiplied by the number of tiles.
  14606. This filter does the reverse of @ref{tile}.
  14607. The filter accepts the following options:
  14608. @table @option
  14609. @item layout
  14610. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14611. this option, check the
  14612. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14613. @end table
  14614. @subsection Examples
  14615. @itemize
  14616. @item
  14617. Produce a 1-second video from a still image file made of 25 frames stacked
  14618. vertically, like an analogic film reel:
  14619. @example
  14620. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  14621. @end example
  14622. @end itemize
  14623. @section uspp
  14624. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14625. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14626. shifts and average the results.
  14627. The way this differs from the behavior of spp is that uspp actually encodes &
  14628. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14629. DCT similar to MJPEG.
  14630. The filter accepts the following options:
  14631. @table @option
  14632. @item quality
  14633. Set quality. This option defines the number of levels for averaging. It accepts
  14634. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14635. effect. A value of @code{8} means the higher quality. For each increment of
  14636. that value the speed drops by a factor of approximately 2. Default value is
  14637. @code{3}.
  14638. @item qp
  14639. Force a constant quantization parameter. If not set, the filter will use the QP
  14640. from the video stream (if available).
  14641. @end table
  14642. @section v360
  14643. Convert 360 videos between various formats.
  14644. The filter accepts the following options:
  14645. @table @option
  14646. @item input
  14647. @item output
  14648. Set format of the input/output video.
  14649. Available formats:
  14650. @table @samp
  14651. @item e
  14652. @item equirect
  14653. Equirectangular projection.
  14654. @item c3x2
  14655. @item c6x1
  14656. @item c1x6
  14657. Cubemap with 3x2/6x1/1x6 layout.
  14658. Format specific options:
  14659. @table @option
  14660. @item in_pad
  14661. @item out_pad
  14662. Set padding proportion for the input/output cubemap. Values in decimals.
  14663. Example values:
  14664. @table @samp
  14665. @item 0
  14666. No padding.
  14667. @item 0.01
  14668. 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)
  14669. @end table
  14670. Default value is @b{@samp{0}}.
  14671. Maximum value is @b{@samp{0.1}}.
  14672. @item fin_pad
  14673. @item fout_pad
  14674. Set fixed padding for the input/output cubemap. Values in pixels.
  14675. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14676. @item in_forder
  14677. @item out_forder
  14678. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14679. Designation of directions:
  14680. @table @samp
  14681. @item r
  14682. right
  14683. @item l
  14684. left
  14685. @item u
  14686. up
  14687. @item d
  14688. down
  14689. @item f
  14690. forward
  14691. @item b
  14692. back
  14693. @end table
  14694. Default value is @b{@samp{rludfb}}.
  14695. @item in_frot
  14696. @item out_frot
  14697. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14698. Designation of angles:
  14699. @table @samp
  14700. @item 0
  14701. 0 degrees clockwise
  14702. @item 1
  14703. 90 degrees clockwise
  14704. @item 2
  14705. 180 degrees clockwise
  14706. @item 3
  14707. 270 degrees clockwise
  14708. @end table
  14709. Default value is @b{@samp{000000}}.
  14710. @end table
  14711. @item eac
  14712. Equi-Angular Cubemap.
  14713. @item flat
  14714. @item gnomonic
  14715. @item rectilinear
  14716. Regular video.
  14717. Format specific options:
  14718. @table @option
  14719. @item h_fov
  14720. @item v_fov
  14721. @item d_fov
  14722. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14723. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14724. @item ih_fov
  14725. @item iv_fov
  14726. @item id_fov
  14727. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14728. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14729. @end table
  14730. @item dfisheye
  14731. Dual fisheye.
  14732. Format specific options:
  14733. @table @option
  14734. @item h_fov
  14735. @item v_fov
  14736. @item d_fov
  14737. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14738. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14739. @item ih_fov
  14740. @item iv_fov
  14741. @item id_fov
  14742. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14743. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14744. @end table
  14745. @item barrel
  14746. @item fb
  14747. @item barrelsplit
  14748. Facebook's 360 formats.
  14749. @item sg
  14750. Stereographic format.
  14751. Format specific options:
  14752. @table @option
  14753. @item h_fov
  14754. @item v_fov
  14755. @item d_fov
  14756. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14757. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14758. @item ih_fov
  14759. @item iv_fov
  14760. @item id_fov
  14761. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14762. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14763. @end table
  14764. @item mercator
  14765. Mercator format.
  14766. @item ball
  14767. Ball format, gives significant distortion toward the back.
  14768. @item hammer
  14769. Hammer-Aitoff map projection format.
  14770. @item sinusoidal
  14771. Sinusoidal map projection format.
  14772. @item fisheye
  14773. Fisheye projection.
  14774. Format specific options:
  14775. @table @option
  14776. @item h_fov
  14777. @item v_fov
  14778. @item d_fov
  14779. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14780. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14781. @item ih_fov
  14782. @item iv_fov
  14783. @item id_fov
  14784. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14785. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14786. @end table
  14787. @item pannini
  14788. Pannini projection.
  14789. Format specific options:
  14790. @table @option
  14791. @item h_fov
  14792. Set output pannini parameter.
  14793. @item ih_fov
  14794. Set input pannini parameter.
  14795. @end table
  14796. @item cylindrical
  14797. Cylindrical projection.
  14798. Format specific options:
  14799. @table @option
  14800. @item h_fov
  14801. @item v_fov
  14802. @item d_fov
  14803. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14804. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14805. @item ih_fov
  14806. @item iv_fov
  14807. @item id_fov
  14808. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14809. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14810. @end table
  14811. @item perspective
  14812. Perspective projection. @i{(output only)}
  14813. Format specific options:
  14814. @table @option
  14815. @item v_fov
  14816. Set perspective parameter.
  14817. @end table
  14818. @item tetrahedron
  14819. Tetrahedron projection.
  14820. @item tsp
  14821. Truncated square pyramid projection.
  14822. @item he
  14823. @item hequirect
  14824. Half equirectangular projection.
  14825. @item equisolid
  14826. Equisolid format.
  14827. Format specific options:
  14828. @table @option
  14829. @item h_fov
  14830. @item v_fov
  14831. @item d_fov
  14832. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14833. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14834. @item ih_fov
  14835. @item iv_fov
  14836. @item id_fov
  14837. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14838. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14839. @end table
  14840. @item og
  14841. Orthographic format.
  14842. Format specific options:
  14843. @table @option
  14844. @item h_fov
  14845. @item v_fov
  14846. @item d_fov
  14847. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14848. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14849. @item ih_fov
  14850. @item iv_fov
  14851. @item id_fov
  14852. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14853. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14854. @end table
  14855. @item octahedron
  14856. Octahedron projection.
  14857. @end table
  14858. @item interp
  14859. Set interpolation method.@*
  14860. @i{Note: more complex interpolation methods require much more memory to run.}
  14861. Available methods:
  14862. @table @samp
  14863. @item near
  14864. @item nearest
  14865. Nearest neighbour.
  14866. @item line
  14867. @item linear
  14868. Bilinear interpolation.
  14869. @item lagrange9
  14870. Lagrange9 interpolation.
  14871. @item cube
  14872. @item cubic
  14873. Bicubic interpolation.
  14874. @item lanc
  14875. @item lanczos
  14876. Lanczos interpolation.
  14877. @item sp16
  14878. @item spline16
  14879. Spline16 interpolation.
  14880. @item gauss
  14881. @item gaussian
  14882. Gaussian interpolation.
  14883. @item mitchell
  14884. Mitchell interpolation.
  14885. @end table
  14886. Default value is @b{@samp{line}}.
  14887. @item w
  14888. @item h
  14889. Set the output video resolution.
  14890. Default resolution depends on formats.
  14891. @item in_stereo
  14892. @item out_stereo
  14893. Set the input/output stereo format.
  14894. @table @samp
  14895. @item 2d
  14896. 2D mono
  14897. @item sbs
  14898. Side by side
  14899. @item tb
  14900. Top bottom
  14901. @end table
  14902. Default value is @b{@samp{2d}} for input and output format.
  14903. @item yaw
  14904. @item pitch
  14905. @item roll
  14906. Set rotation for the output video. Values in degrees.
  14907. @item rorder
  14908. Set rotation order for the output video. Choose one item for each position.
  14909. @table @samp
  14910. @item y, Y
  14911. yaw
  14912. @item p, P
  14913. pitch
  14914. @item r, R
  14915. roll
  14916. @end table
  14917. Default value is @b{@samp{ypr}}.
  14918. @item h_flip
  14919. @item v_flip
  14920. @item d_flip
  14921. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14922. @item ih_flip
  14923. @item iv_flip
  14924. Set if input video is flipped horizontally/vertically. Boolean values.
  14925. @item in_trans
  14926. Set if input video is transposed. Boolean value, by default disabled.
  14927. @item out_trans
  14928. Set if output video needs to be transposed. Boolean value, by default disabled.
  14929. @item alpha_mask
  14930. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  14931. @end table
  14932. @subsection Examples
  14933. @itemize
  14934. @item
  14935. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14936. @example
  14937. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14938. @end example
  14939. @item
  14940. Extract back view of Equi-Angular Cubemap:
  14941. @example
  14942. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14943. @end example
  14944. @item
  14945. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14946. @example
  14947. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14948. @end example
  14949. @end itemize
  14950. @subsection Commands
  14951. This filter supports subset of above options as @ref{commands}.
  14952. @section vaguedenoiser
  14953. Apply a wavelet based denoiser.
  14954. It transforms each frame from the video input into the wavelet domain,
  14955. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14956. the obtained coefficients. It does an inverse wavelet transform after.
  14957. Due to wavelet properties, it should give a nice smoothed result, and
  14958. reduced noise, without blurring picture features.
  14959. This filter accepts the following options:
  14960. @table @option
  14961. @item threshold
  14962. The filtering strength. The higher, the more filtered the video will be.
  14963. Hard thresholding can use a higher threshold than soft thresholding
  14964. before the video looks overfiltered. Default value is 2.
  14965. @item method
  14966. The filtering method the filter will use.
  14967. It accepts the following values:
  14968. @table @samp
  14969. @item hard
  14970. All values under the threshold will be zeroed.
  14971. @item soft
  14972. All values under the threshold will be zeroed. All values above will be
  14973. reduced by the threshold.
  14974. @item garrote
  14975. Scales or nullifies coefficients - intermediary between (more) soft and
  14976. (less) hard thresholding.
  14977. @end table
  14978. Default is garrote.
  14979. @item nsteps
  14980. Number of times, the wavelet will decompose the picture. Picture can't
  14981. be decomposed beyond a particular point (typically, 8 for a 640x480
  14982. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14983. @item percent
  14984. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14985. @item planes
  14986. A list of the planes to process. By default all planes are processed.
  14987. @item type
  14988. The threshold type the filter will use.
  14989. It accepts the following values:
  14990. @table @samp
  14991. @item universal
  14992. Threshold used is same for all decompositions.
  14993. @item bayes
  14994. Threshold used depends also on each decomposition coefficients.
  14995. @end table
  14996. Default is universal.
  14997. @end table
  14998. @section vectorscope
  14999. Display 2 color component values in the two dimensional graph (which is called
  15000. a vectorscope).
  15001. This filter accepts the following options:
  15002. @table @option
  15003. @item mode, m
  15004. Set vectorscope mode.
  15005. It accepts the following values:
  15006. @table @samp
  15007. @item gray
  15008. @item tint
  15009. Gray values are displayed on graph, higher brightness means more pixels have
  15010. same component color value on location in graph. This is the default mode.
  15011. @item color
  15012. Gray values are displayed on graph. Surrounding pixels values which are not
  15013. present in video frame are drawn in gradient of 2 color components which are
  15014. set by option @code{x} and @code{y}. The 3rd color component is static.
  15015. @item color2
  15016. Actual color components values present in video frame are displayed on graph.
  15017. @item color3
  15018. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15019. on graph increases value of another color component, which is luminance by
  15020. default values of @code{x} and @code{y}.
  15021. @item color4
  15022. Actual colors present in video frame are displayed on graph. If two different
  15023. colors map to same position on graph then color with higher value of component
  15024. not present in graph is picked.
  15025. @item color5
  15026. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15027. component picked from radial gradient.
  15028. @end table
  15029. @item x
  15030. Set which color component will be represented on X-axis. Default is @code{1}.
  15031. @item y
  15032. Set which color component will be represented on Y-axis. Default is @code{2}.
  15033. @item intensity, i
  15034. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15035. of color component which represents frequency of (X, Y) location in graph.
  15036. @item envelope, e
  15037. @table @samp
  15038. @item none
  15039. No envelope, this is default.
  15040. @item instant
  15041. Instant envelope, even darkest single pixel will be clearly highlighted.
  15042. @item peak
  15043. Hold maximum and minimum values presented in graph over time. This way you
  15044. can still spot out of range values without constantly looking at vectorscope.
  15045. @item peak+instant
  15046. Peak and instant envelope combined together.
  15047. @end table
  15048. @item graticule, g
  15049. Set what kind of graticule to draw.
  15050. @table @samp
  15051. @item none
  15052. @item green
  15053. @item color
  15054. @item invert
  15055. @end table
  15056. @item opacity, o
  15057. Set graticule opacity.
  15058. @item flags, f
  15059. Set graticule flags.
  15060. @table @samp
  15061. @item white
  15062. Draw graticule for white point.
  15063. @item black
  15064. Draw graticule for black point.
  15065. @item name
  15066. Draw color points short names.
  15067. @end table
  15068. @item bgopacity, b
  15069. Set background opacity.
  15070. @item lthreshold, l
  15071. Set low threshold for color component not represented on X or Y axis.
  15072. Values lower than this value will be ignored. Default is 0.
  15073. Note this value is multiplied with actual max possible value one pixel component
  15074. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15075. is 0.1 * 255 = 25.
  15076. @item hthreshold, h
  15077. Set high threshold for color component not represented on X or Y axis.
  15078. Values higher than this value will be ignored. Default is 1.
  15079. Note this value is multiplied with actual max possible value one pixel component
  15080. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15081. is 0.9 * 255 = 230.
  15082. @item colorspace, c
  15083. Set what kind of colorspace to use when drawing graticule.
  15084. @table @samp
  15085. @item auto
  15086. @item 601
  15087. @item 709
  15088. @end table
  15089. Default is auto.
  15090. @item tint0, t0
  15091. @item tint1, t1
  15092. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15093. This means no tint, and output will remain gray.
  15094. @end table
  15095. @anchor{vidstabdetect}
  15096. @section vidstabdetect
  15097. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15098. @ref{vidstabtransform} for pass 2.
  15099. This filter generates a file with relative translation and rotation
  15100. transform information about subsequent frames, which is then used by
  15101. the @ref{vidstabtransform} filter.
  15102. To enable compilation of this filter you need to configure FFmpeg with
  15103. @code{--enable-libvidstab}.
  15104. This filter accepts the following options:
  15105. @table @option
  15106. @item result
  15107. Set the path to the file used to write the transforms information.
  15108. Default value is @file{transforms.trf}.
  15109. @item shakiness
  15110. Set how shaky the video is and how quick the camera is. It accepts an
  15111. integer in the range 1-10, a value of 1 means little shakiness, a
  15112. value of 10 means strong shakiness. Default value is 5.
  15113. @item accuracy
  15114. Set the accuracy of the detection process. It must be a value in the
  15115. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15116. accuracy. Default value is 15.
  15117. @item stepsize
  15118. Set stepsize of the search process. The region around minimum is
  15119. scanned with 1 pixel resolution. Default value is 6.
  15120. @item mincontrast
  15121. Set minimum contrast. Below this value a local measurement field is
  15122. discarded. Must be a floating point value in the range 0-1. Default
  15123. value is 0.3.
  15124. @item tripod
  15125. Set reference frame number for tripod mode.
  15126. If enabled, the motion of the frames is compared to a reference frame
  15127. in the filtered stream, identified by the specified number. The idea
  15128. is to compensate all movements in a more-or-less static scene and keep
  15129. the camera view absolutely still.
  15130. If set to 0, it is disabled. The frames are counted starting from 1.
  15131. @item show
  15132. Show fields and transforms in the resulting frames. It accepts an
  15133. integer in the range 0-2. Default value is 0, which disables any
  15134. visualization.
  15135. @end table
  15136. @subsection Examples
  15137. @itemize
  15138. @item
  15139. Use default values:
  15140. @example
  15141. vidstabdetect
  15142. @end example
  15143. @item
  15144. Analyze strongly shaky movie and put the results in file
  15145. @file{mytransforms.trf}:
  15146. @example
  15147. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15148. @end example
  15149. @item
  15150. Visualize the result of internal transformations in the resulting
  15151. video:
  15152. @example
  15153. vidstabdetect=show=1
  15154. @end example
  15155. @item
  15156. Analyze a video with medium shakiness using @command{ffmpeg}:
  15157. @example
  15158. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15159. @end example
  15160. @end itemize
  15161. @anchor{vidstabtransform}
  15162. @section vidstabtransform
  15163. Video stabilization/deshaking: pass 2 of 2,
  15164. see @ref{vidstabdetect} for pass 1.
  15165. Read a file with transform information for each frame and
  15166. apply/compensate them. Together with the @ref{vidstabdetect}
  15167. filter this can be used to deshake videos. See also
  15168. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15169. the @ref{unsharp} filter, see below.
  15170. To enable compilation of this filter you need to configure FFmpeg with
  15171. @code{--enable-libvidstab}.
  15172. @subsection Options
  15173. @table @option
  15174. @item input
  15175. Set path to the file used to read the transforms. Default value is
  15176. @file{transforms.trf}.
  15177. @item smoothing
  15178. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15179. camera movements. Default value is 10.
  15180. For example a number of 10 means that 21 frames are used (10 in the
  15181. past and 10 in the future) to smoothen the motion in the video. A
  15182. larger value leads to a smoother video, but limits the acceleration of
  15183. the camera (pan/tilt movements). 0 is a special case where a static
  15184. camera is simulated.
  15185. @item optalgo
  15186. Set the camera path optimization algorithm.
  15187. Accepted values are:
  15188. @table @samp
  15189. @item gauss
  15190. gaussian kernel low-pass filter on camera motion (default)
  15191. @item avg
  15192. averaging on transformations
  15193. @end table
  15194. @item maxshift
  15195. Set maximal number of pixels to translate frames. Default value is -1,
  15196. meaning no limit.
  15197. @item maxangle
  15198. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15199. value is -1, meaning no limit.
  15200. @item crop
  15201. Specify how to deal with borders that may be visible due to movement
  15202. compensation.
  15203. Available values are:
  15204. @table @samp
  15205. @item keep
  15206. keep image information from previous frame (default)
  15207. @item black
  15208. fill the border black
  15209. @end table
  15210. @item invert
  15211. Invert transforms if set to 1. Default value is 0.
  15212. @item relative
  15213. Consider transforms as relative to previous frame if set to 1,
  15214. absolute if set to 0. Default value is 0.
  15215. @item zoom
  15216. Set percentage to zoom. A positive value will result in a zoom-in
  15217. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15218. zoom).
  15219. @item optzoom
  15220. Set optimal zooming to avoid borders.
  15221. Accepted values are:
  15222. @table @samp
  15223. @item 0
  15224. disabled
  15225. @item 1
  15226. optimal static zoom value is determined (only very strong movements
  15227. will lead to visible borders) (default)
  15228. @item 2
  15229. optimal adaptive zoom value is determined (no borders will be
  15230. visible), see @option{zoomspeed}
  15231. @end table
  15232. Note that the value given at zoom is added to the one calculated here.
  15233. @item zoomspeed
  15234. Set percent to zoom maximally each frame (enabled when
  15235. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15236. 0.25.
  15237. @item interpol
  15238. Specify type of interpolation.
  15239. Available values are:
  15240. @table @samp
  15241. @item no
  15242. no interpolation
  15243. @item linear
  15244. linear only horizontal
  15245. @item bilinear
  15246. linear in both directions (default)
  15247. @item bicubic
  15248. cubic in both directions (slow)
  15249. @end table
  15250. @item tripod
  15251. Enable virtual tripod mode if set to 1, which is equivalent to
  15252. @code{relative=0:smoothing=0}. Default value is 0.
  15253. Use also @code{tripod} option of @ref{vidstabdetect}.
  15254. @item debug
  15255. Increase log verbosity if set to 1. Also the detected global motions
  15256. are written to the temporary file @file{global_motions.trf}. Default
  15257. value is 0.
  15258. @end table
  15259. @subsection Examples
  15260. @itemize
  15261. @item
  15262. Use @command{ffmpeg} for a typical stabilization with default values:
  15263. @example
  15264. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15265. @end example
  15266. Note the use of the @ref{unsharp} filter which is always recommended.
  15267. @item
  15268. Zoom in a bit more and load transform data from a given file:
  15269. @example
  15270. vidstabtransform=zoom=5:input="mytransforms.trf"
  15271. @end example
  15272. @item
  15273. Smoothen the video even more:
  15274. @example
  15275. vidstabtransform=smoothing=30
  15276. @end example
  15277. @end itemize
  15278. @section vflip
  15279. Flip the input video vertically.
  15280. For example, to vertically flip a video with @command{ffmpeg}:
  15281. @example
  15282. ffmpeg -i in.avi -vf "vflip" out.avi
  15283. @end example
  15284. @section vfrdet
  15285. Detect variable frame rate video.
  15286. This filter tries to detect if the input is variable or constant frame rate.
  15287. At end it will output number of frames detected as having variable delta pts,
  15288. and ones with constant delta pts.
  15289. If there was frames with variable delta, than it will also show min, max and
  15290. average delta encountered.
  15291. @section vibrance
  15292. Boost or alter saturation.
  15293. The filter accepts the following options:
  15294. @table @option
  15295. @item intensity
  15296. Set strength of boost if positive value or strength of alter if negative value.
  15297. Default is 0. Allowed range is from -2 to 2.
  15298. @item rbal
  15299. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15300. @item gbal
  15301. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15302. @item bbal
  15303. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15304. @item rlum
  15305. Set the red luma coefficient.
  15306. @item glum
  15307. Set the green luma coefficient.
  15308. @item blum
  15309. Set the blue luma coefficient.
  15310. @item alternate
  15311. If @code{intensity} is negative and this is set to 1, colors will change,
  15312. otherwise colors will be less saturated, more towards gray.
  15313. @end table
  15314. @subsection Commands
  15315. This filter supports the all above options as @ref{commands}.
  15316. @anchor{vignette}
  15317. @section vignette
  15318. Make or reverse a natural vignetting effect.
  15319. The filter accepts the following options:
  15320. @table @option
  15321. @item angle, a
  15322. Set lens angle expression as a number of radians.
  15323. The value is clipped in the @code{[0,PI/2]} range.
  15324. Default value: @code{"PI/5"}
  15325. @item x0
  15326. @item y0
  15327. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15328. by default.
  15329. @item mode
  15330. Set forward/backward mode.
  15331. Available modes are:
  15332. @table @samp
  15333. @item forward
  15334. The larger the distance from the central point, the darker the image becomes.
  15335. @item backward
  15336. The larger the distance from the central point, the brighter the image becomes.
  15337. This can be used to reverse a vignette effect, though there is no automatic
  15338. detection to extract the lens @option{angle} and other settings (yet). It can
  15339. also be used to create a burning effect.
  15340. @end table
  15341. Default value is @samp{forward}.
  15342. @item eval
  15343. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15344. It accepts the following values:
  15345. @table @samp
  15346. @item init
  15347. Evaluate expressions only once during the filter initialization.
  15348. @item frame
  15349. Evaluate expressions for each incoming frame. This is way slower than the
  15350. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15351. allows advanced dynamic expressions.
  15352. @end table
  15353. Default value is @samp{init}.
  15354. @item dither
  15355. Set dithering to reduce the circular banding effects. Default is @code{1}
  15356. (enabled).
  15357. @item aspect
  15358. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15359. Setting this value to the SAR of the input will make a rectangular vignetting
  15360. following the dimensions of the video.
  15361. Default is @code{1/1}.
  15362. @end table
  15363. @subsection Expressions
  15364. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15365. following parameters.
  15366. @table @option
  15367. @item w
  15368. @item h
  15369. input width and height
  15370. @item n
  15371. the number of input frame, starting from 0
  15372. @item pts
  15373. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15374. @var{TB} units, NAN if undefined
  15375. @item r
  15376. frame rate of the input video, NAN if the input frame rate is unknown
  15377. @item t
  15378. the PTS (Presentation TimeStamp) of the filtered video frame,
  15379. expressed in seconds, NAN if undefined
  15380. @item tb
  15381. time base of the input video
  15382. @end table
  15383. @subsection Examples
  15384. @itemize
  15385. @item
  15386. Apply simple strong vignetting effect:
  15387. @example
  15388. vignette=PI/4
  15389. @end example
  15390. @item
  15391. Make a flickering vignetting:
  15392. @example
  15393. vignette='PI/4+random(1)*PI/50':eval=frame
  15394. @end example
  15395. @end itemize
  15396. @section vmafmotion
  15397. Obtain the average VMAF motion score of a video.
  15398. It is one of the component metrics of VMAF.
  15399. The obtained average motion score is printed through the logging system.
  15400. The filter accepts the following options:
  15401. @table @option
  15402. @item stats_file
  15403. If specified, the filter will use the named file to save the motion score of
  15404. each frame with respect to the previous frame.
  15405. When filename equals "-" the data is sent to standard output.
  15406. @end table
  15407. Example:
  15408. @example
  15409. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15410. @end example
  15411. @section vstack
  15412. Stack input videos vertically.
  15413. All streams must be of same pixel format and of same width.
  15414. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15415. to create same output.
  15416. The filter accepts the following options:
  15417. @table @option
  15418. @item inputs
  15419. Set number of input streams. Default is 2.
  15420. @item shortest
  15421. If set to 1, force the output to terminate when the shortest input
  15422. terminates. Default value is 0.
  15423. @end table
  15424. @section w3fdif
  15425. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15426. Deinterlacing Filter").
  15427. Based on the process described by Martin Weston for BBC R&D, and
  15428. implemented based on the de-interlace algorithm written by Jim
  15429. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15430. uses filter coefficients calculated by BBC R&D.
  15431. This filter uses field-dominance information in frame to decide which
  15432. of each pair of fields to place first in the output.
  15433. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15434. There are two sets of filter coefficients, so called "simple"
  15435. and "complex". Which set of filter coefficients is used can
  15436. be set by passing an optional parameter:
  15437. @table @option
  15438. @item filter
  15439. Set the interlacing filter coefficients. Accepts one of the following values:
  15440. @table @samp
  15441. @item simple
  15442. Simple filter coefficient set.
  15443. @item complex
  15444. More-complex filter coefficient set.
  15445. @end table
  15446. Default value is @samp{complex}.
  15447. @item deint
  15448. Specify which frames to deinterlace. Accepts one of the following values:
  15449. @table @samp
  15450. @item all
  15451. Deinterlace all frames,
  15452. @item interlaced
  15453. Only deinterlace frames marked as interlaced.
  15454. @end table
  15455. Default value is @samp{all}.
  15456. @end table
  15457. @section waveform
  15458. Video waveform monitor.
  15459. The waveform monitor plots color component intensity. By default luminance
  15460. only. Each column of the waveform corresponds to a column of pixels in the
  15461. source video.
  15462. It accepts the following options:
  15463. @table @option
  15464. @item mode, m
  15465. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15466. In row mode, the graph on the left side represents color component value 0 and
  15467. the right side represents value = 255. In column mode, the top side represents
  15468. color component value = 0 and bottom side represents value = 255.
  15469. @item intensity, i
  15470. Set intensity. Smaller values are useful to find out how many values of the same
  15471. luminance are distributed across input rows/columns.
  15472. Default value is @code{0.04}. Allowed range is [0, 1].
  15473. @item mirror, r
  15474. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15475. In mirrored mode, higher values will be represented on the left
  15476. side for @code{row} mode and at the top for @code{column} mode. Default is
  15477. @code{1} (mirrored).
  15478. @item display, d
  15479. Set display mode.
  15480. It accepts the following values:
  15481. @table @samp
  15482. @item overlay
  15483. Presents information identical to that in the @code{parade}, except
  15484. that the graphs representing color components are superimposed directly
  15485. over one another.
  15486. This display mode makes it easier to spot relative differences or similarities
  15487. in overlapping areas of the color components that are supposed to be identical,
  15488. such as neutral whites, grays, or blacks.
  15489. @item stack
  15490. Display separate graph for the color components side by side in
  15491. @code{row} mode or one below the other in @code{column} mode.
  15492. @item parade
  15493. Display separate graph for the color components side by side in
  15494. @code{column} mode or one below the other in @code{row} mode.
  15495. Using this display mode makes it easy to spot color casts in the highlights
  15496. and shadows of an image, by comparing the contours of the top and the bottom
  15497. graphs of each waveform. Since whites, grays, and blacks are characterized
  15498. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15499. should display three waveforms of roughly equal width/height. If not, the
  15500. correction is easy to perform by making level adjustments the three waveforms.
  15501. @end table
  15502. Default is @code{stack}.
  15503. @item components, c
  15504. Set which color components to display. Default is 1, which means only luminance
  15505. or red color component if input is in RGB colorspace. If is set for example to
  15506. 7 it will display all 3 (if) available color components.
  15507. @item envelope, e
  15508. @table @samp
  15509. @item none
  15510. No envelope, this is default.
  15511. @item instant
  15512. Instant envelope, minimum and maximum values presented in graph will be easily
  15513. visible even with small @code{step} value.
  15514. @item peak
  15515. Hold minimum and maximum values presented in graph across time. This way you
  15516. can still spot out of range values without constantly looking at waveforms.
  15517. @item peak+instant
  15518. Peak and instant envelope combined together.
  15519. @end table
  15520. @item filter, f
  15521. @table @samp
  15522. @item lowpass
  15523. No filtering, this is default.
  15524. @item flat
  15525. Luma and chroma combined together.
  15526. @item aflat
  15527. Similar as above, but shows difference between blue and red chroma.
  15528. @item xflat
  15529. Similar as above, but use different colors.
  15530. @item yflat
  15531. Similar as above, but again with different colors.
  15532. @item chroma
  15533. Displays only chroma.
  15534. @item color
  15535. Displays actual color value on waveform.
  15536. @item acolor
  15537. Similar as above, but with luma showing frequency of chroma values.
  15538. @end table
  15539. @item graticule, g
  15540. Set which graticule to display.
  15541. @table @samp
  15542. @item none
  15543. Do not display graticule.
  15544. @item green
  15545. Display green graticule showing legal broadcast ranges.
  15546. @item orange
  15547. Display orange graticule showing legal broadcast ranges.
  15548. @item invert
  15549. Display invert graticule showing legal broadcast ranges.
  15550. @end table
  15551. @item opacity, o
  15552. Set graticule opacity.
  15553. @item flags, fl
  15554. Set graticule flags.
  15555. @table @samp
  15556. @item numbers
  15557. Draw numbers above lines. By default enabled.
  15558. @item dots
  15559. Draw dots instead of lines.
  15560. @end table
  15561. @item scale, s
  15562. Set scale used for displaying graticule.
  15563. @table @samp
  15564. @item digital
  15565. @item millivolts
  15566. @item ire
  15567. @end table
  15568. Default is digital.
  15569. @item bgopacity, b
  15570. Set background opacity.
  15571. @item tint0, t0
  15572. @item tint1, t1
  15573. Set tint for output.
  15574. Only used with lowpass filter and when display is not overlay and input
  15575. pixel formats are not RGB.
  15576. @end table
  15577. @section weave, doubleweave
  15578. The @code{weave} takes a field-based video input and join
  15579. each two sequential fields into single frame, producing a new double
  15580. height clip with half the frame rate and half the frame count.
  15581. The @code{doubleweave} works same as @code{weave} but without
  15582. halving frame rate and frame count.
  15583. It accepts the following option:
  15584. @table @option
  15585. @item first_field
  15586. Set first field. Available values are:
  15587. @table @samp
  15588. @item top, t
  15589. Set the frame as top-field-first.
  15590. @item bottom, b
  15591. Set the frame as bottom-field-first.
  15592. @end table
  15593. @end table
  15594. @subsection Examples
  15595. @itemize
  15596. @item
  15597. Interlace video using @ref{select} and @ref{separatefields} filter:
  15598. @example
  15599. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15600. @end example
  15601. @end itemize
  15602. @section xbr
  15603. Apply the xBR high-quality magnification filter which is designed for pixel
  15604. art. It follows a set of edge-detection rules, see
  15605. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15606. It accepts the following option:
  15607. @table @option
  15608. @item n
  15609. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15610. @code{3xBR} and @code{4} for @code{4xBR}.
  15611. Default is @code{3}.
  15612. @end table
  15613. @section xfade
  15614. Apply cross fade from one input video stream to another input video stream.
  15615. The cross fade is applied for specified duration.
  15616. The filter accepts the following options:
  15617. @table @option
  15618. @item transition
  15619. Set one of available transition effects:
  15620. @table @samp
  15621. @item custom
  15622. @item fade
  15623. @item wipeleft
  15624. @item wiperight
  15625. @item wipeup
  15626. @item wipedown
  15627. @item slideleft
  15628. @item slideright
  15629. @item slideup
  15630. @item slidedown
  15631. @item circlecrop
  15632. @item rectcrop
  15633. @item distance
  15634. @item fadeblack
  15635. @item fadewhite
  15636. @item radial
  15637. @item smoothleft
  15638. @item smoothright
  15639. @item smoothup
  15640. @item smoothdown
  15641. @item circleopen
  15642. @item circleclose
  15643. @item vertopen
  15644. @item vertclose
  15645. @item horzopen
  15646. @item horzclose
  15647. @item dissolve
  15648. @item pixelize
  15649. @item diagtl
  15650. @item diagtr
  15651. @item diagbl
  15652. @item diagbr
  15653. @item hlslice
  15654. @item hrslice
  15655. @item vuslice
  15656. @item vdslice
  15657. @item hblur
  15658. @item fadegrays
  15659. @item wipetl
  15660. @item wipetr
  15661. @item wipebl
  15662. @item wipebr
  15663. @end table
  15664. Default transition effect is fade.
  15665. @item duration
  15666. Set cross fade duration in seconds.
  15667. Default duration is 1 second.
  15668. @item offset
  15669. Set cross fade start relative to first input stream in seconds.
  15670. Default offset is 0.
  15671. @item expr
  15672. Set expression for custom transition effect.
  15673. The expressions can use the following variables and functions:
  15674. @table @option
  15675. @item X
  15676. @item Y
  15677. The coordinates of the current sample.
  15678. @item W
  15679. @item H
  15680. The width and height of the image.
  15681. @item P
  15682. Progress of transition effect.
  15683. @item PLANE
  15684. Currently processed plane.
  15685. @item A
  15686. Return value of first input at current location and plane.
  15687. @item B
  15688. Return value of second input at current location and plane.
  15689. @item a0(x, y)
  15690. @item a1(x, y)
  15691. @item a2(x, y)
  15692. @item a3(x, y)
  15693. Return the value of the pixel at location (@var{x},@var{y}) of the
  15694. first/second/third/fourth component of first input.
  15695. @item b0(x, y)
  15696. @item b1(x, y)
  15697. @item b2(x, y)
  15698. @item b3(x, y)
  15699. Return the value of the pixel at location (@var{x},@var{y}) of the
  15700. first/second/third/fourth component of second input.
  15701. @end table
  15702. @end table
  15703. @subsection Examples
  15704. @itemize
  15705. @item
  15706. Cross fade from one input video to another input video, with fade transition and duration of transition
  15707. of 2 seconds starting at offset of 5 seconds:
  15708. @example
  15709. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15710. @end example
  15711. @end itemize
  15712. @section xmedian
  15713. Pick median pixels from several input videos.
  15714. The filter accepts the following options:
  15715. @table @option
  15716. @item inputs
  15717. Set number of inputs.
  15718. Default is 3. Allowed range is from 3 to 255.
  15719. If number of inputs is even number, than result will be mean value between two median values.
  15720. @item planes
  15721. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15722. @item percentile
  15723. Set median percentile. Default value is @code{0.5}.
  15724. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15725. minimum values, and @code{1} maximum values.
  15726. @end table
  15727. @section xstack
  15728. Stack video inputs into custom layout.
  15729. All streams must be of same pixel format.
  15730. The filter accepts the following options:
  15731. @table @option
  15732. @item inputs
  15733. Set number of input streams. Default is 2.
  15734. @item layout
  15735. Specify layout of inputs.
  15736. This option requires the desired layout configuration to be explicitly set by the user.
  15737. This sets position of each video input in output. Each input
  15738. is separated by '|'.
  15739. The first number represents the column, and the second number represents the row.
  15740. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15741. where X is video input from which to take width or height.
  15742. Multiple values can be used when separated by '+'. In such
  15743. case values are summed together.
  15744. Note that if inputs are of different sizes gaps may appear, as not all of
  15745. the output video frame will be filled. Similarly, videos can overlap each
  15746. other if their position doesn't leave enough space for the full frame of
  15747. adjoining videos.
  15748. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15749. a layout must be set by the user.
  15750. @item shortest
  15751. If set to 1, force the output to terminate when the shortest input
  15752. terminates. Default value is 0.
  15753. @item fill
  15754. If set to valid color, all unused pixels will be filled with that color.
  15755. By default fill is set to none, so it is disabled.
  15756. @end table
  15757. @subsection Examples
  15758. @itemize
  15759. @item
  15760. Display 4 inputs into 2x2 grid.
  15761. Layout:
  15762. @example
  15763. input1(0, 0) | input3(w0, 0)
  15764. input2(0, h0) | input4(w0, h0)
  15765. @end example
  15766. @example
  15767. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15768. @end example
  15769. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15770. @item
  15771. Display 4 inputs into 1x4 grid.
  15772. Layout:
  15773. @example
  15774. input1(0, 0)
  15775. input2(0, h0)
  15776. input3(0, h0+h1)
  15777. input4(0, h0+h1+h2)
  15778. @end example
  15779. @example
  15780. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15781. @end example
  15782. Note that if inputs are of different widths, unused space will appear.
  15783. @item
  15784. Display 9 inputs into 3x3 grid.
  15785. Layout:
  15786. @example
  15787. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15788. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15789. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15790. @end example
  15791. @example
  15792. 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
  15793. @end example
  15794. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15795. @item
  15796. Display 16 inputs into 4x4 grid.
  15797. Layout:
  15798. @example
  15799. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15800. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15801. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15802. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15803. @end example
  15804. @example
  15805. 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|
  15806. 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
  15807. @end example
  15808. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15809. @end itemize
  15810. @anchor{yadif}
  15811. @section yadif
  15812. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15813. filter").
  15814. It accepts the following parameters:
  15815. @table @option
  15816. @item mode
  15817. The interlacing mode to adopt. It accepts one of the following values:
  15818. @table @option
  15819. @item 0, send_frame
  15820. Output one frame for each frame.
  15821. @item 1, send_field
  15822. Output one frame for each field.
  15823. @item 2, send_frame_nospatial
  15824. Like @code{send_frame}, but it skips the spatial interlacing check.
  15825. @item 3, send_field_nospatial
  15826. Like @code{send_field}, but it skips the spatial interlacing check.
  15827. @end table
  15828. The default value is @code{send_frame}.
  15829. @item parity
  15830. The picture field parity assumed for the input interlaced video. It accepts one
  15831. of the following values:
  15832. @table @option
  15833. @item 0, tff
  15834. Assume the top field is first.
  15835. @item 1, bff
  15836. Assume the bottom field is first.
  15837. @item -1, auto
  15838. Enable automatic detection of field parity.
  15839. @end table
  15840. The default value is @code{auto}.
  15841. If the interlacing is unknown or the decoder does not export this information,
  15842. top field first will be assumed.
  15843. @item deint
  15844. Specify which frames to deinterlace. Accepts one of the following
  15845. values:
  15846. @table @option
  15847. @item 0, all
  15848. Deinterlace all frames.
  15849. @item 1, interlaced
  15850. Only deinterlace frames marked as interlaced.
  15851. @end table
  15852. The default value is @code{all}.
  15853. @end table
  15854. @section yadif_cuda
  15855. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15856. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15857. and/or nvenc.
  15858. It accepts the following parameters:
  15859. @table @option
  15860. @item mode
  15861. The interlacing mode to adopt. It accepts one of the following values:
  15862. @table @option
  15863. @item 0, send_frame
  15864. Output one frame for each frame.
  15865. @item 1, send_field
  15866. Output one frame for each field.
  15867. @item 2, send_frame_nospatial
  15868. Like @code{send_frame}, but it skips the spatial interlacing check.
  15869. @item 3, send_field_nospatial
  15870. Like @code{send_field}, but it skips the spatial interlacing check.
  15871. @end table
  15872. The default value is @code{send_frame}.
  15873. @item parity
  15874. The picture field parity assumed for the input interlaced video. It accepts one
  15875. of the following values:
  15876. @table @option
  15877. @item 0, tff
  15878. Assume the top field is first.
  15879. @item 1, bff
  15880. Assume the bottom field is first.
  15881. @item -1, auto
  15882. Enable automatic detection of field parity.
  15883. @end table
  15884. The default value is @code{auto}.
  15885. If the interlacing is unknown or the decoder does not export this information,
  15886. top field first will be assumed.
  15887. @item deint
  15888. Specify which frames to deinterlace. Accepts one of the following
  15889. values:
  15890. @table @option
  15891. @item 0, all
  15892. Deinterlace all frames.
  15893. @item 1, interlaced
  15894. Only deinterlace frames marked as interlaced.
  15895. @end table
  15896. The default value is @code{all}.
  15897. @end table
  15898. @section yaepblur
  15899. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15900. The algorithm is described in
  15901. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15902. It accepts the following parameters:
  15903. @table @option
  15904. @item radius, r
  15905. Set the window radius. Default value is 3.
  15906. @item planes, p
  15907. Set which planes to filter. Default is only the first plane.
  15908. @item sigma, s
  15909. Set blur strength. Default value is 128.
  15910. @end table
  15911. @subsection Commands
  15912. This filter supports same @ref{commands} as options.
  15913. @section zoompan
  15914. Apply Zoom & Pan effect.
  15915. This filter accepts the following options:
  15916. @table @option
  15917. @item zoom, z
  15918. Set the zoom expression. Range is 1-10. Default is 1.
  15919. @item x
  15920. @item y
  15921. Set the x and y expression. Default is 0.
  15922. @item d
  15923. Set the duration expression in number of frames.
  15924. This sets for how many number of frames effect will last for
  15925. single input image.
  15926. @item s
  15927. Set the output image size, default is 'hd720'.
  15928. @item fps
  15929. Set the output frame rate, default is '25'.
  15930. @end table
  15931. Each expression can contain the following constants:
  15932. @table @option
  15933. @item in_w, iw
  15934. Input width.
  15935. @item in_h, ih
  15936. Input height.
  15937. @item out_w, ow
  15938. Output width.
  15939. @item out_h, oh
  15940. Output height.
  15941. @item in
  15942. Input frame count.
  15943. @item on
  15944. Output frame count.
  15945. @item in_time, it
  15946. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  15947. @item out_time, time, ot
  15948. The output timestamp expressed in seconds.
  15949. @item x
  15950. @item y
  15951. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15952. for current input frame.
  15953. @item px
  15954. @item py
  15955. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15956. not yet such frame (first input frame).
  15957. @item zoom
  15958. Last calculated zoom from 'z' expression for current input frame.
  15959. @item pzoom
  15960. Last calculated zoom of last output frame of previous input frame.
  15961. @item duration
  15962. Number of output frames for current input frame. Calculated from 'd' expression
  15963. for each input frame.
  15964. @item pduration
  15965. number of output frames created for previous input frame
  15966. @item a
  15967. Rational number: input width / input height
  15968. @item sar
  15969. sample aspect ratio
  15970. @item dar
  15971. display aspect ratio
  15972. @end table
  15973. @subsection Examples
  15974. @itemize
  15975. @item
  15976. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  15977. @example
  15978. 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
  15979. @end example
  15980. @item
  15981. Zoom in up to 1.5x and pan always at center of picture:
  15982. @example
  15983. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15984. @end example
  15985. @item
  15986. Same as above but without pausing:
  15987. @example
  15988. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15989. @end example
  15990. @item
  15991. Zoom in 2x into center of picture only for the first second of the input video:
  15992. @example
  15993. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15994. @end example
  15995. @end itemize
  15996. @anchor{zscale}
  15997. @section zscale
  15998. Scale (resize) the input video, using the z.lib library:
  15999. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16000. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16001. The zscale filter forces the output display aspect ratio to be the same
  16002. as the input, by changing the output sample aspect ratio.
  16003. If the input image format is different from the format requested by
  16004. the next filter, the zscale filter will convert the input to the
  16005. requested format.
  16006. @subsection Options
  16007. The filter accepts the following options.
  16008. @table @option
  16009. @item width, w
  16010. @item height, h
  16011. Set the output video dimension expression. Default value is the input
  16012. dimension.
  16013. If the @var{width} or @var{w} value is 0, the input width is used for
  16014. the output. If the @var{height} or @var{h} value is 0, the input height
  16015. is used for the output.
  16016. If one and only one of the values is -n with n >= 1, the zscale filter
  16017. will use a value that maintains the aspect ratio of the input image,
  16018. calculated from the other specified dimension. After that it will,
  16019. however, make sure that the calculated dimension is divisible by n and
  16020. adjust the value if necessary.
  16021. If both values are -n with n >= 1, the behavior will be identical to
  16022. both values being set to 0 as previously detailed.
  16023. See below for the list of accepted constants for use in the dimension
  16024. expression.
  16025. @item size, s
  16026. Set the video size. For the syntax of this option, check the
  16027. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16028. @item dither, d
  16029. Set the dither type.
  16030. Possible values are:
  16031. @table @var
  16032. @item none
  16033. @item ordered
  16034. @item random
  16035. @item error_diffusion
  16036. @end table
  16037. Default is none.
  16038. @item filter, f
  16039. Set the resize filter type.
  16040. Possible values are:
  16041. @table @var
  16042. @item point
  16043. @item bilinear
  16044. @item bicubic
  16045. @item spline16
  16046. @item spline36
  16047. @item lanczos
  16048. @end table
  16049. Default is bilinear.
  16050. @item range, r
  16051. Set the color range.
  16052. Possible values are:
  16053. @table @var
  16054. @item input
  16055. @item limited
  16056. @item full
  16057. @end table
  16058. Default is same as input.
  16059. @item primaries, p
  16060. Set the color primaries.
  16061. Possible values are:
  16062. @table @var
  16063. @item input
  16064. @item 709
  16065. @item unspecified
  16066. @item 170m
  16067. @item 240m
  16068. @item 2020
  16069. @end table
  16070. Default is same as input.
  16071. @item transfer, t
  16072. Set the transfer characteristics.
  16073. Possible values are:
  16074. @table @var
  16075. @item input
  16076. @item 709
  16077. @item unspecified
  16078. @item 601
  16079. @item linear
  16080. @item 2020_10
  16081. @item 2020_12
  16082. @item smpte2084
  16083. @item iec61966-2-1
  16084. @item arib-std-b67
  16085. @end table
  16086. Default is same as input.
  16087. @item matrix, m
  16088. Set the colorspace matrix.
  16089. Possible value are:
  16090. @table @var
  16091. @item input
  16092. @item 709
  16093. @item unspecified
  16094. @item 470bg
  16095. @item 170m
  16096. @item 2020_ncl
  16097. @item 2020_cl
  16098. @end table
  16099. Default is same as input.
  16100. @item rangein, rin
  16101. Set the input color range.
  16102. Possible values are:
  16103. @table @var
  16104. @item input
  16105. @item limited
  16106. @item full
  16107. @end table
  16108. Default is same as input.
  16109. @item primariesin, pin
  16110. Set the input color primaries.
  16111. Possible values are:
  16112. @table @var
  16113. @item input
  16114. @item 709
  16115. @item unspecified
  16116. @item 170m
  16117. @item 240m
  16118. @item 2020
  16119. @end table
  16120. Default is same as input.
  16121. @item transferin, tin
  16122. Set the input transfer characteristics.
  16123. Possible values are:
  16124. @table @var
  16125. @item input
  16126. @item 709
  16127. @item unspecified
  16128. @item 601
  16129. @item linear
  16130. @item 2020_10
  16131. @item 2020_12
  16132. @end table
  16133. Default is same as input.
  16134. @item matrixin, min
  16135. Set the input colorspace matrix.
  16136. Possible value are:
  16137. @table @var
  16138. @item input
  16139. @item 709
  16140. @item unspecified
  16141. @item 470bg
  16142. @item 170m
  16143. @item 2020_ncl
  16144. @item 2020_cl
  16145. @end table
  16146. @item chromal, c
  16147. Set the output chroma location.
  16148. Possible values are:
  16149. @table @var
  16150. @item input
  16151. @item left
  16152. @item center
  16153. @item topleft
  16154. @item top
  16155. @item bottomleft
  16156. @item bottom
  16157. @end table
  16158. @item chromalin, cin
  16159. Set the input chroma location.
  16160. Possible values are:
  16161. @table @var
  16162. @item input
  16163. @item left
  16164. @item center
  16165. @item topleft
  16166. @item top
  16167. @item bottomleft
  16168. @item bottom
  16169. @end table
  16170. @item npl
  16171. Set the nominal peak luminance.
  16172. @end table
  16173. The values of the @option{w} and @option{h} options are expressions
  16174. containing the following constants:
  16175. @table @var
  16176. @item in_w
  16177. @item in_h
  16178. The input width and height
  16179. @item iw
  16180. @item ih
  16181. These are the same as @var{in_w} and @var{in_h}.
  16182. @item out_w
  16183. @item out_h
  16184. The output (scaled) width and height
  16185. @item ow
  16186. @item oh
  16187. These are the same as @var{out_w} and @var{out_h}
  16188. @item a
  16189. The same as @var{iw} / @var{ih}
  16190. @item sar
  16191. input sample aspect ratio
  16192. @item dar
  16193. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16194. @item hsub
  16195. @item vsub
  16196. horizontal and vertical input chroma subsample values. For example for the
  16197. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16198. @item ohsub
  16199. @item ovsub
  16200. horizontal and vertical output chroma subsample values. For example for the
  16201. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16202. @end table
  16203. @subsection Commands
  16204. This filter supports the following commands:
  16205. @table @option
  16206. @item width, w
  16207. @item height, h
  16208. Set the output video dimension expression.
  16209. The command accepts the same syntax of the corresponding option.
  16210. If the specified expression is not valid, it is kept at its current
  16211. value.
  16212. @end table
  16213. @c man end VIDEO FILTERS
  16214. @chapter OpenCL Video Filters
  16215. @c man begin OPENCL VIDEO FILTERS
  16216. Below is a description of the currently available OpenCL video filters.
  16217. To enable compilation of these filters you need to configure FFmpeg with
  16218. @code{--enable-opencl}.
  16219. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16220. @table @option
  16221. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16222. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16223. given device parameters.
  16224. @item -filter_hw_device @var{name}
  16225. Pass the hardware device called @var{name} to all filters in any filter graph.
  16226. @end table
  16227. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16228. @itemize
  16229. @item
  16230. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16231. @example
  16232. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16233. @end example
  16234. @end itemize
  16235. 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.
  16236. @section avgblur_opencl
  16237. Apply average blur filter.
  16238. The filter accepts the following options:
  16239. @table @option
  16240. @item sizeX
  16241. Set horizontal radius size.
  16242. Range is @code{[1, 1024]} and default value is @code{1}.
  16243. @item planes
  16244. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16245. @item sizeY
  16246. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16247. @end table
  16248. @subsection Example
  16249. @itemize
  16250. @item
  16251. 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.
  16252. @example
  16253. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16254. @end example
  16255. @end itemize
  16256. @section boxblur_opencl
  16257. Apply a boxblur algorithm to the input video.
  16258. It accepts the following parameters:
  16259. @table @option
  16260. @item luma_radius, lr
  16261. @item luma_power, lp
  16262. @item chroma_radius, cr
  16263. @item chroma_power, cp
  16264. @item alpha_radius, ar
  16265. @item alpha_power, ap
  16266. @end table
  16267. A description of the accepted options follows.
  16268. @table @option
  16269. @item luma_radius, lr
  16270. @item chroma_radius, cr
  16271. @item alpha_radius, ar
  16272. Set an expression for the box radius in pixels used for blurring the
  16273. corresponding input plane.
  16274. The radius value must be a non-negative number, and must not be
  16275. greater than the value of the expression @code{min(w,h)/2} for the
  16276. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16277. planes.
  16278. Default value for @option{luma_radius} is "2". If not specified,
  16279. @option{chroma_radius} and @option{alpha_radius} default to the
  16280. corresponding value set for @option{luma_radius}.
  16281. The expressions can contain the following constants:
  16282. @table @option
  16283. @item w
  16284. @item h
  16285. The input width and height in pixels.
  16286. @item cw
  16287. @item ch
  16288. The input chroma image width and height in pixels.
  16289. @item hsub
  16290. @item vsub
  16291. The horizontal and vertical chroma subsample values. For example, for the
  16292. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16293. @end table
  16294. @item luma_power, lp
  16295. @item chroma_power, cp
  16296. @item alpha_power, ap
  16297. Specify how many times the boxblur filter is applied to the
  16298. corresponding plane.
  16299. Default value for @option{luma_power} is 2. If not specified,
  16300. @option{chroma_power} and @option{alpha_power} default to the
  16301. corresponding value set for @option{luma_power}.
  16302. A value of 0 will disable the effect.
  16303. @end table
  16304. @subsection Examples
  16305. 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.
  16306. @itemize
  16307. @item
  16308. Apply a boxblur filter with the luma, chroma, and alpha radius
  16309. 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.
  16310. @example
  16311. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16312. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16313. @end example
  16314. @item
  16315. 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.
  16316. For the luma plane, a 2x2 box radius will be run once.
  16317. For the chroma plane, a 4x4 box radius will be run 5 times.
  16318. For the alpha plane, a 3x3 box radius will be run 7 times.
  16319. @example
  16320. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16321. @end example
  16322. @end itemize
  16323. @section colorkey_opencl
  16324. RGB colorspace color keying.
  16325. The filter accepts the following options:
  16326. @table @option
  16327. @item color
  16328. The color which will be replaced with transparency.
  16329. @item similarity
  16330. Similarity percentage with the key color.
  16331. 0.01 matches only the exact key color, while 1.0 matches everything.
  16332. @item blend
  16333. Blend percentage.
  16334. 0.0 makes pixels either fully transparent, or not transparent at all.
  16335. Higher values result in semi-transparent pixels, with a higher transparency
  16336. the more similar the pixels color is to the key color.
  16337. @end table
  16338. @subsection Examples
  16339. @itemize
  16340. @item
  16341. Make every semi-green pixel in the input transparent with some slight blending:
  16342. @example
  16343. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16344. @end example
  16345. @end itemize
  16346. @section convolution_opencl
  16347. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16348. The filter accepts the following options:
  16349. @table @option
  16350. @item 0m
  16351. @item 1m
  16352. @item 2m
  16353. @item 3m
  16354. Set matrix for each plane.
  16355. Matrix is sequence of 9, 25 or 49 signed numbers.
  16356. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16357. @item 0rdiv
  16358. @item 1rdiv
  16359. @item 2rdiv
  16360. @item 3rdiv
  16361. Set multiplier for calculated value for each plane.
  16362. If unset or 0, it will be sum of all matrix elements.
  16363. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16364. @item 0bias
  16365. @item 1bias
  16366. @item 2bias
  16367. @item 3bias
  16368. Set bias for each plane. This value is added to the result of the multiplication.
  16369. Useful for making the overall image brighter or darker.
  16370. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16371. @end table
  16372. @subsection Examples
  16373. @itemize
  16374. @item
  16375. Apply sharpen:
  16376. @example
  16377. -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
  16378. @end example
  16379. @item
  16380. Apply blur:
  16381. @example
  16382. -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
  16383. @end example
  16384. @item
  16385. Apply edge enhance:
  16386. @example
  16387. -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
  16388. @end example
  16389. @item
  16390. Apply edge detect:
  16391. @example
  16392. -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
  16393. @end example
  16394. @item
  16395. Apply laplacian edge detector which includes diagonals:
  16396. @example
  16397. -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
  16398. @end example
  16399. @item
  16400. Apply emboss:
  16401. @example
  16402. -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
  16403. @end example
  16404. @end itemize
  16405. @section erosion_opencl
  16406. Apply erosion effect to the video.
  16407. This filter replaces the pixel by the local(3x3) minimum.
  16408. It accepts the following options:
  16409. @table @option
  16410. @item threshold0
  16411. @item threshold1
  16412. @item threshold2
  16413. @item threshold3
  16414. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16415. If @code{0}, plane will remain unchanged.
  16416. @item coordinates
  16417. Flag which specifies the pixel to refer to.
  16418. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16419. Flags to local 3x3 coordinates region centered on @code{x}:
  16420. 1 2 3
  16421. 4 x 5
  16422. 6 7 8
  16423. @end table
  16424. @subsection Example
  16425. @itemize
  16426. @item
  16427. 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.
  16428. @example
  16429. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16430. @end example
  16431. @end itemize
  16432. @section deshake_opencl
  16433. Feature-point based video stabilization filter.
  16434. The filter accepts the following options:
  16435. @table @option
  16436. @item tripod
  16437. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16438. @item debug
  16439. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16440. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16441. Viewing point matches in the output video is only supported for RGB input.
  16442. Defaults to @code{0}.
  16443. @item adaptive_crop
  16444. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16445. Defaults to @code{1}.
  16446. @item refine_features
  16447. Whether or not feature points should be refined at a sub-pixel level.
  16448. This can be turned off for a slight performance gain at the cost of precision.
  16449. Defaults to @code{1}.
  16450. @item smooth_strength
  16451. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16452. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16453. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16454. Defaults to @code{0.0}.
  16455. @item smooth_window_multiplier
  16456. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16457. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16458. Acceptable values range from @code{0.1} to @code{10.0}.
  16459. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16460. potentially improving smoothness, but also increase latency and memory usage.
  16461. Defaults to @code{2.0}.
  16462. @end table
  16463. @subsection Examples
  16464. @itemize
  16465. @item
  16466. Stabilize a video with a fixed, medium smoothing strength:
  16467. @example
  16468. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16469. @end example
  16470. @item
  16471. Stabilize a video with debugging (both in console and in rendered video):
  16472. @example
  16473. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16474. @end example
  16475. @end itemize
  16476. @section dilation_opencl
  16477. Apply dilation effect to the video.
  16478. This filter replaces the pixel by the local(3x3) maximum.
  16479. It accepts the following options:
  16480. @table @option
  16481. @item threshold0
  16482. @item threshold1
  16483. @item threshold2
  16484. @item threshold3
  16485. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16486. If @code{0}, plane will remain unchanged.
  16487. @item coordinates
  16488. Flag which specifies the pixel to refer to.
  16489. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16490. Flags to local 3x3 coordinates region centered on @code{x}:
  16491. 1 2 3
  16492. 4 x 5
  16493. 6 7 8
  16494. @end table
  16495. @subsection Example
  16496. @itemize
  16497. @item
  16498. 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.
  16499. @example
  16500. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16501. @end example
  16502. @end itemize
  16503. @section nlmeans_opencl
  16504. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16505. @section overlay_opencl
  16506. Overlay one video on top of another.
  16507. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16508. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16509. The filter accepts the following options:
  16510. @table @option
  16511. @item x
  16512. Set the x coordinate of the overlaid video on the main video.
  16513. Default value is @code{0}.
  16514. @item y
  16515. Set the y coordinate of the overlaid video on the main video.
  16516. Default value is @code{0}.
  16517. @end table
  16518. @subsection Examples
  16519. @itemize
  16520. @item
  16521. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16522. @example
  16523. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16524. @end example
  16525. @item
  16526. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16527. @example
  16528. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16529. @end example
  16530. @end itemize
  16531. @section pad_opencl
  16532. Add paddings to the input image, and place the original input at the
  16533. provided @var{x}, @var{y} coordinates.
  16534. It accepts the following options:
  16535. @table @option
  16536. @item width, w
  16537. @item height, h
  16538. Specify an expression for the size of the output image with the
  16539. paddings added. If the value for @var{width} or @var{height} is 0, the
  16540. corresponding input size is used for the output.
  16541. The @var{width} expression can reference the value set by the
  16542. @var{height} expression, and vice versa.
  16543. The default value of @var{width} and @var{height} is 0.
  16544. @item x
  16545. @item y
  16546. Specify the offsets to place the input image at within the padded area,
  16547. with respect to the top/left border of the output image.
  16548. The @var{x} expression can reference the value set by the @var{y}
  16549. expression, and vice versa.
  16550. The default value of @var{x} and @var{y} is 0.
  16551. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16552. so the input image is centered on the padded area.
  16553. @item color
  16554. Specify the color of the padded area. For the syntax of this option,
  16555. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16556. manual,ffmpeg-utils}.
  16557. @item aspect
  16558. Pad to an aspect instead to a resolution.
  16559. @end table
  16560. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16561. options are expressions containing the following constants:
  16562. @table @option
  16563. @item in_w
  16564. @item in_h
  16565. The input video width and height.
  16566. @item iw
  16567. @item ih
  16568. These are the same as @var{in_w} and @var{in_h}.
  16569. @item out_w
  16570. @item out_h
  16571. The output width and height (the size of the padded area), as
  16572. specified by the @var{width} and @var{height} expressions.
  16573. @item ow
  16574. @item oh
  16575. These are the same as @var{out_w} and @var{out_h}.
  16576. @item x
  16577. @item y
  16578. The x and y offsets as specified by the @var{x} and @var{y}
  16579. expressions, or NAN if not yet specified.
  16580. @item a
  16581. same as @var{iw} / @var{ih}
  16582. @item sar
  16583. input sample aspect ratio
  16584. @item dar
  16585. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16586. @end table
  16587. @section prewitt_opencl
  16588. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16589. The filter accepts the following option:
  16590. @table @option
  16591. @item planes
  16592. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16593. @item scale
  16594. Set value which will be multiplied with filtered result.
  16595. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16596. @item delta
  16597. Set value which will be added to filtered result.
  16598. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16599. @end table
  16600. @subsection Example
  16601. @itemize
  16602. @item
  16603. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16604. @example
  16605. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16606. @end example
  16607. @end itemize
  16608. @anchor{program_opencl}
  16609. @section program_opencl
  16610. Filter video using an OpenCL program.
  16611. @table @option
  16612. @item source
  16613. OpenCL program source file.
  16614. @item kernel
  16615. Kernel name in program.
  16616. @item inputs
  16617. Number of inputs to the filter. Defaults to 1.
  16618. @item size, s
  16619. Size of output frames. Defaults to the same as the first input.
  16620. @end table
  16621. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16622. The program source file must contain a kernel function with the given name,
  16623. which will be run once for each plane of the output. Each run on a plane
  16624. gets enqueued as a separate 2D global NDRange with one work-item for each
  16625. pixel to be generated. The global ID offset for each work-item is therefore
  16626. the coordinates of a pixel in the destination image.
  16627. The kernel function needs to take the following arguments:
  16628. @itemize
  16629. @item
  16630. Destination image, @var{__write_only image2d_t}.
  16631. This image will become the output; the kernel should write all of it.
  16632. @item
  16633. Frame index, @var{unsigned int}.
  16634. This is a counter starting from zero and increasing by one for each frame.
  16635. @item
  16636. Source images, @var{__read_only image2d_t}.
  16637. These are the most recent images on each input. The kernel may read from
  16638. them to generate the output, but they can't be written to.
  16639. @end itemize
  16640. Example programs:
  16641. @itemize
  16642. @item
  16643. Copy the input to the output (output must be the same size as the input).
  16644. @verbatim
  16645. __kernel void copy(__write_only image2d_t destination,
  16646. unsigned int index,
  16647. __read_only image2d_t source)
  16648. {
  16649. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16650. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16651. float4 value = read_imagef(source, sampler, location);
  16652. write_imagef(destination, location, value);
  16653. }
  16654. @end verbatim
  16655. @item
  16656. Apply a simple transformation, rotating the input by an amount increasing
  16657. with the index counter. Pixel values are linearly interpolated by the
  16658. sampler, and the output need not have the same dimensions as the input.
  16659. @verbatim
  16660. __kernel void rotate_image(__write_only image2d_t dst,
  16661. unsigned int index,
  16662. __read_only image2d_t src)
  16663. {
  16664. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16665. CLK_FILTER_LINEAR);
  16666. float angle = (float)index / 100.0f;
  16667. float2 dst_dim = convert_float2(get_image_dim(dst));
  16668. float2 src_dim = convert_float2(get_image_dim(src));
  16669. float2 dst_cen = dst_dim / 2.0f;
  16670. float2 src_cen = src_dim / 2.0f;
  16671. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16672. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16673. float2 src_pos = {
  16674. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16675. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16676. };
  16677. src_pos = src_pos * src_dim / dst_dim;
  16678. float2 src_loc = src_pos + src_cen;
  16679. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16680. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16681. write_imagef(dst, dst_loc, 0.5f);
  16682. else
  16683. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16684. }
  16685. @end verbatim
  16686. @item
  16687. Blend two inputs together, with the amount of each input used varying
  16688. with the index counter.
  16689. @verbatim
  16690. __kernel void blend_images(__write_only image2d_t dst,
  16691. unsigned int index,
  16692. __read_only image2d_t src1,
  16693. __read_only image2d_t src2)
  16694. {
  16695. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16696. CLK_FILTER_LINEAR);
  16697. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16698. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16699. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16700. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16701. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16702. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16703. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16704. }
  16705. @end verbatim
  16706. @end itemize
  16707. @section roberts_opencl
  16708. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16709. The filter accepts the following option:
  16710. @table @option
  16711. @item planes
  16712. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16713. @item scale
  16714. Set value which will be multiplied with filtered result.
  16715. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16716. @item delta
  16717. Set value which will be added to filtered result.
  16718. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16719. @end table
  16720. @subsection Example
  16721. @itemize
  16722. @item
  16723. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16724. @example
  16725. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16726. @end example
  16727. @end itemize
  16728. @section sobel_opencl
  16729. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16730. The filter accepts the following option:
  16731. @table @option
  16732. @item planes
  16733. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16734. @item scale
  16735. Set value which will be multiplied with filtered result.
  16736. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16737. @item delta
  16738. Set value which will be added to filtered result.
  16739. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16740. @end table
  16741. @subsection Example
  16742. @itemize
  16743. @item
  16744. Apply sobel operator with scale set to 2 and delta set to 10
  16745. @example
  16746. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16747. @end example
  16748. @end itemize
  16749. @section tonemap_opencl
  16750. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16751. It accepts the following parameters:
  16752. @table @option
  16753. @item tonemap
  16754. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16755. @item param
  16756. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16757. @item desat
  16758. Apply desaturation for highlights that exceed this level of brightness. The
  16759. higher the parameter, the more color information will be preserved. This
  16760. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16761. (smoothly) turning into white instead. This makes images feel more natural,
  16762. at the cost of reducing information about out-of-range colors.
  16763. The default value is 0.5, and the algorithm here is a little different from
  16764. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16765. @item threshold
  16766. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16767. is used to detect whether the scene has changed or not. If the distance between
  16768. the current frame average brightness and the current running average exceeds
  16769. a threshold value, we would re-calculate scene average and peak brightness.
  16770. The default value is 0.2.
  16771. @item format
  16772. Specify the output pixel format.
  16773. Currently supported formats are:
  16774. @table @var
  16775. @item p010
  16776. @item nv12
  16777. @end table
  16778. @item range, r
  16779. Set the output color range.
  16780. Possible values are:
  16781. @table @var
  16782. @item tv/mpeg
  16783. @item pc/jpeg
  16784. @end table
  16785. Default is same as input.
  16786. @item primaries, p
  16787. Set the output color primaries.
  16788. Possible values are:
  16789. @table @var
  16790. @item bt709
  16791. @item bt2020
  16792. @end table
  16793. Default is same as input.
  16794. @item transfer, t
  16795. Set the output transfer characteristics.
  16796. Possible values are:
  16797. @table @var
  16798. @item bt709
  16799. @item bt2020
  16800. @end table
  16801. Default is bt709.
  16802. @item matrix, m
  16803. Set the output colorspace matrix.
  16804. Possible value are:
  16805. @table @var
  16806. @item bt709
  16807. @item bt2020
  16808. @end table
  16809. Default is same as input.
  16810. @end table
  16811. @subsection Example
  16812. @itemize
  16813. @item
  16814. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16815. @example
  16816. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16817. @end example
  16818. @end itemize
  16819. @section unsharp_opencl
  16820. Sharpen or blur the input video.
  16821. It accepts the following parameters:
  16822. @table @option
  16823. @item luma_msize_x, lx
  16824. Set the luma matrix horizontal size.
  16825. Range is @code{[1, 23]} and default value is @code{5}.
  16826. @item luma_msize_y, ly
  16827. Set the luma matrix vertical size.
  16828. Range is @code{[1, 23]} and default value is @code{5}.
  16829. @item luma_amount, la
  16830. Set the luma effect strength.
  16831. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16832. Negative values will blur the input video, while positive values will
  16833. sharpen it, a value of zero will disable the effect.
  16834. @item chroma_msize_x, cx
  16835. Set the chroma matrix horizontal size.
  16836. Range is @code{[1, 23]} and default value is @code{5}.
  16837. @item chroma_msize_y, cy
  16838. Set the chroma matrix vertical size.
  16839. Range is @code{[1, 23]} and default value is @code{5}.
  16840. @item chroma_amount, ca
  16841. Set the chroma effect strength.
  16842. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16843. Negative values will blur the input video, while positive values will
  16844. sharpen it, a value of zero will disable the effect.
  16845. @end table
  16846. All parameters are optional and default to the equivalent of the
  16847. string '5:5:1.0:5:5:0.0'.
  16848. @subsection Examples
  16849. @itemize
  16850. @item
  16851. Apply strong luma sharpen effect:
  16852. @example
  16853. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16854. @end example
  16855. @item
  16856. Apply a strong blur of both luma and chroma parameters:
  16857. @example
  16858. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16859. @end example
  16860. @end itemize
  16861. @section xfade_opencl
  16862. Cross fade two videos with custom transition effect by using OpenCL.
  16863. It accepts the following options:
  16864. @table @option
  16865. @item transition
  16866. Set one of possible transition effects.
  16867. @table @option
  16868. @item custom
  16869. Select custom transition effect, the actual transition description
  16870. will be picked from source and kernel options.
  16871. @item fade
  16872. @item wipeleft
  16873. @item wiperight
  16874. @item wipeup
  16875. @item wipedown
  16876. @item slideleft
  16877. @item slideright
  16878. @item slideup
  16879. @item slidedown
  16880. Default transition is fade.
  16881. @end table
  16882. @item source
  16883. OpenCL program source file for custom transition.
  16884. @item kernel
  16885. Set name of kernel to use for custom transition from program source file.
  16886. @item duration
  16887. Set duration of video transition.
  16888. @item offset
  16889. Set time of start of transition relative to first video.
  16890. @end table
  16891. The program source file must contain a kernel function with the given name,
  16892. which will be run once for each plane of the output. Each run on a plane
  16893. gets enqueued as a separate 2D global NDRange with one work-item for each
  16894. pixel to be generated. The global ID offset for each work-item is therefore
  16895. the coordinates of a pixel in the destination image.
  16896. The kernel function needs to take the following arguments:
  16897. @itemize
  16898. @item
  16899. Destination image, @var{__write_only image2d_t}.
  16900. This image will become the output; the kernel should write all of it.
  16901. @item
  16902. First Source image, @var{__read_only image2d_t}.
  16903. Second Source image, @var{__read_only image2d_t}.
  16904. These are the most recent images on each input. The kernel may read from
  16905. them to generate the output, but they can't be written to.
  16906. @item
  16907. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  16908. @end itemize
  16909. Example programs:
  16910. @itemize
  16911. @item
  16912. Apply dots curtain transition effect:
  16913. @verbatim
  16914. __kernel void blend_images(__write_only image2d_t dst,
  16915. __read_only image2d_t src1,
  16916. __read_only image2d_t src2,
  16917. float progress)
  16918. {
  16919. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16920. CLK_FILTER_LINEAR);
  16921. int2 p = (int2)(get_global_id(0), get_global_id(1));
  16922. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  16923. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  16924. rp = rp / dim;
  16925. float2 dots = (float2)(20.0, 20.0);
  16926. float2 center = (float2)(0,0);
  16927. float2 unused;
  16928. float4 val1 = read_imagef(src1, sampler, p);
  16929. float4 val2 = read_imagef(src2, sampler, p);
  16930. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  16931. write_imagef(dst, p, next ? val1 : val2);
  16932. }
  16933. @end verbatim
  16934. @end itemize
  16935. @c man end OPENCL VIDEO FILTERS
  16936. @chapter VAAPI Video Filters
  16937. @c man begin VAAPI VIDEO FILTERS
  16938. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  16939. To enable compilation of these filters you need to configure FFmpeg with
  16940. @code{--enable-vaapi}.
  16941. 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}
  16942. @section tonemap_vaapi
  16943. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  16944. It maps the dynamic range of HDR10 content to the SDR content.
  16945. It currently only accepts HDR10 as input.
  16946. It accepts the following parameters:
  16947. @table @option
  16948. @item format
  16949. Specify the output pixel format.
  16950. Currently supported formats are:
  16951. @table @var
  16952. @item p010
  16953. @item nv12
  16954. @end table
  16955. Default is nv12.
  16956. @item primaries, p
  16957. Set the output color primaries.
  16958. Default is same as input.
  16959. @item transfer, t
  16960. Set the output transfer characteristics.
  16961. Default is bt709.
  16962. @item matrix, m
  16963. Set the output colorspace matrix.
  16964. Default is same as input.
  16965. @end table
  16966. @subsection Example
  16967. @itemize
  16968. @item
  16969. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  16970. @example
  16971. tonemap_vaapi=format=p010:t=bt2020-10
  16972. @end example
  16973. @end itemize
  16974. @c man end VAAPI VIDEO FILTERS
  16975. @chapter Video Sources
  16976. @c man begin VIDEO SOURCES
  16977. Below is a description of the currently available video sources.
  16978. @section buffer
  16979. Buffer video frames, and make them available to the filter chain.
  16980. This source is mainly intended for a programmatic use, in particular
  16981. through the interface defined in @file{libavfilter/buffersrc.h}.
  16982. It accepts the following parameters:
  16983. @table @option
  16984. @item video_size
  16985. Specify the size (width and height) of the buffered video frames. For the
  16986. syntax of this option, check the
  16987. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16988. @item width
  16989. The input video width.
  16990. @item height
  16991. The input video height.
  16992. @item pix_fmt
  16993. A string representing the pixel format of the buffered video frames.
  16994. It may be a number corresponding to a pixel format, or a pixel format
  16995. name.
  16996. @item time_base
  16997. Specify the timebase assumed by the timestamps of the buffered frames.
  16998. @item frame_rate
  16999. Specify the frame rate expected for the video stream.
  17000. @item pixel_aspect, sar
  17001. The sample (pixel) aspect ratio of the input video.
  17002. @item sws_param
  17003. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17004. to the filtergraph description to specify swscale flags for automatically
  17005. inserted scalers. See @ref{Filtergraph syntax}.
  17006. @item hw_frames_ctx
  17007. When using a hardware pixel format, this should be a reference to an
  17008. AVHWFramesContext describing input frames.
  17009. @end table
  17010. For example:
  17011. @example
  17012. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17013. @end example
  17014. will instruct the source to accept video frames with size 320x240 and
  17015. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17016. square pixels (1:1 sample aspect ratio).
  17017. Since the pixel format with name "yuv410p" corresponds to the number 6
  17018. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17019. this example corresponds to:
  17020. @example
  17021. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17022. @end example
  17023. Alternatively, the options can be specified as a flat string, but this
  17024. syntax is deprecated:
  17025. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17026. @section cellauto
  17027. Create a pattern generated by an elementary cellular automaton.
  17028. The initial state of the cellular automaton can be defined through the
  17029. @option{filename} and @option{pattern} options. If such options are
  17030. not specified an initial state is created randomly.
  17031. At each new frame a new row in the video is filled with the result of
  17032. the cellular automaton next generation. The behavior when the whole
  17033. frame is filled is defined by the @option{scroll} option.
  17034. This source accepts the following options:
  17035. @table @option
  17036. @item filename, f
  17037. Read the initial cellular automaton state, i.e. the starting row, from
  17038. the specified file.
  17039. In the file, each non-whitespace character is considered an alive
  17040. cell, a newline will terminate the row, and further characters in the
  17041. file will be ignored.
  17042. @item pattern, p
  17043. Read the initial cellular automaton state, i.e. the starting row, from
  17044. the specified string.
  17045. Each non-whitespace character in the string is considered an alive
  17046. cell, a newline will terminate the row, and further characters in the
  17047. string will be ignored.
  17048. @item rate, r
  17049. Set the video rate, that is the number of frames generated per second.
  17050. Default is 25.
  17051. @item random_fill_ratio, ratio
  17052. Set the random fill ratio for the initial cellular automaton row. It
  17053. is a floating point number value ranging from 0 to 1, defaults to
  17054. 1/PHI.
  17055. This option is ignored when a file or a pattern is specified.
  17056. @item random_seed, seed
  17057. Set the seed for filling randomly the initial row, must be an integer
  17058. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17059. set to -1, the filter will try to use a good random seed on a best
  17060. effort basis.
  17061. @item rule
  17062. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17063. Default value is 110.
  17064. @item size, s
  17065. Set the size of the output video. For the syntax of this option, check the
  17066. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17067. If @option{filename} or @option{pattern} is specified, the size is set
  17068. by default to the width of the specified initial state row, and the
  17069. height is set to @var{width} * PHI.
  17070. If @option{size} is set, it must contain the width of the specified
  17071. pattern string, and the specified pattern will be centered in the
  17072. larger row.
  17073. If a filename or a pattern string is not specified, the size value
  17074. defaults to "320x518" (used for a randomly generated initial state).
  17075. @item scroll
  17076. If set to 1, scroll the output upward when all the rows in the output
  17077. have been already filled. If set to 0, the new generated row will be
  17078. written over the top row just after the bottom row is filled.
  17079. Defaults to 1.
  17080. @item start_full, full
  17081. If set to 1, completely fill the output with generated rows before
  17082. outputting the first frame.
  17083. This is the default behavior, for disabling set the value to 0.
  17084. @item stitch
  17085. If set to 1, stitch the left and right row edges together.
  17086. This is the default behavior, for disabling set the value to 0.
  17087. @end table
  17088. @subsection Examples
  17089. @itemize
  17090. @item
  17091. Read the initial state from @file{pattern}, and specify an output of
  17092. size 200x400.
  17093. @example
  17094. cellauto=f=pattern:s=200x400
  17095. @end example
  17096. @item
  17097. Generate a random initial row with a width of 200 cells, with a fill
  17098. ratio of 2/3:
  17099. @example
  17100. cellauto=ratio=2/3:s=200x200
  17101. @end example
  17102. @item
  17103. Create a pattern generated by rule 18 starting by a single alive cell
  17104. centered on an initial row with width 100:
  17105. @example
  17106. cellauto=p=@@:s=100x400:full=0:rule=18
  17107. @end example
  17108. @item
  17109. Specify a more elaborated initial pattern:
  17110. @example
  17111. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17112. @end example
  17113. @end itemize
  17114. @anchor{coreimagesrc}
  17115. @section coreimagesrc
  17116. Video source generated on GPU using Apple's CoreImage API on OSX.
  17117. This video source is a specialized version of the @ref{coreimage} video filter.
  17118. Use a core image generator at the beginning of the applied filterchain to
  17119. generate the content.
  17120. The coreimagesrc video source accepts the following options:
  17121. @table @option
  17122. @item list_generators
  17123. List all available generators along with all their respective options as well as
  17124. possible minimum and maximum values along with the default values.
  17125. @example
  17126. list_generators=true
  17127. @end example
  17128. @item size, s
  17129. Specify the size of the sourced video. For the syntax of this option, check the
  17130. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17131. The default value is @code{320x240}.
  17132. @item rate, r
  17133. Specify the frame rate of the sourced video, as the number of frames
  17134. generated per second. It has to be a string in the format
  17135. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17136. number or a valid video frame rate abbreviation. The default value is
  17137. "25".
  17138. @item sar
  17139. Set the sample aspect ratio of the sourced video.
  17140. @item duration, d
  17141. Set the duration of the sourced video. See
  17142. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17143. for the accepted syntax.
  17144. If not specified, or the expressed duration is negative, the video is
  17145. supposed to be generated forever.
  17146. @end table
  17147. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17148. A complete filterchain can be used for further processing of the
  17149. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17150. and examples for details.
  17151. @subsection Examples
  17152. @itemize
  17153. @item
  17154. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17155. given as complete and escaped command-line for Apple's standard bash shell:
  17156. @example
  17157. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17158. @end example
  17159. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17160. need for a nullsrc video source.
  17161. @end itemize
  17162. @section gradients
  17163. Generate several gradients.
  17164. @table @option
  17165. @item size, s
  17166. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17167. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17168. @item rate, r
  17169. Set frame rate, expressed as number of frames per second. Default
  17170. value is "25".
  17171. @item c0, c1, c2, c3, c4, c5, c6, c7
  17172. Set 8 colors. Default values for colors is to pick random one.
  17173. @item x0, y0, y0, y1
  17174. Set gradient line source and destination points. If negative or out of range, random ones
  17175. are picked.
  17176. @item nb_colors, n
  17177. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17178. @item seed
  17179. Set seed for picking gradient line points.
  17180. @item duration, d
  17181. Set the duration of the sourced video. See
  17182. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17183. for the accepted syntax.
  17184. If not specified, or the expressed duration is negative, the video is
  17185. supposed to be generated forever.
  17186. @item speed
  17187. Set speed of gradients rotation.
  17188. @end table
  17189. @section mandelbrot
  17190. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17191. point specified with @var{start_x} and @var{start_y}.
  17192. This source accepts the following options:
  17193. @table @option
  17194. @item end_pts
  17195. Set the terminal pts value. Default value is 400.
  17196. @item end_scale
  17197. Set the terminal scale value.
  17198. Must be a floating point value. Default value is 0.3.
  17199. @item inner
  17200. Set the inner coloring mode, that is the algorithm used to draw the
  17201. Mandelbrot fractal internal region.
  17202. It shall assume one of the following values:
  17203. @table @option
  17204. @item black
  17205. Set black mode.
  17206. @item convergence
  17207. Show time until convergence.
  17208. @item mincol
  17209. Set color based on point closest to the origin of the iterations.
  17210. @item period
  17211. Set period mode.
  17212. @end table
  17213. Default value is @var{mincol}.
  17214. @item bailout
  17215. Set the bailout value. Default value is 10.0.
  17216. @item maxiter
  17217. Set the maximum of iterations performed by the rendering
  17218. algorithm. Default value is 7189.
  17219. @item outer
  17220. Set outer coloring mode.
  17221. It shall assume one of following values:
  17222. @table @option
  17223. @item iteration_count
  17224. Set iteration count mode.
  17225. @item normalized_iteration_count
  17226. set normalized iteration count mode.
  17227. @end table
  17228. Default value is @var{normalized_iteration_count}.
  17229. @item rate, r
  17230. Set frame rate, expressed as number of frames per second. Default
  17231. value is "25".
  17232. @item size, s
  17233. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17234. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17235. @item start_scale
  17236. Set the initial scale value. Default value is 3.0.
  17237. @item start_x
  17238. Set the initial x position. Must be a floating point value between
  17239. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17240. @item start_y
  17241. Set the initial y position. Must be a floating point value between
  17242. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17243. @end table
  17244. @section mptestsrc
  17245. Generate various test patterns, as generated by the MPlayer test filter.
  17246. The size of the generated video is fixed, and is 256x256.
  17247. This source is useful in particular for testing encoding features.
  17248. This source accepts the following options:
  17249. @table @option
  17250. @item rate, r
  17251. Specify the frame rate of the sourced video, as the number of frames
  17252. generated per second. It has to be a string in the format
  17253. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17254. number or a valid video frame rate abbreviation. The default value is
  17255. "25".
  17256. @item duration, d
  17257. Set the duration of the sourced video. See
  17258. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17259. for the accepted syntax.
  17260. If not specified, or the expressed duration is negative, the video is
  17261. supposed to be generated forever.
  17262. @item test, t
  17263. Set the number or the name of the test to perform. Supported tests are:
  17264. @table @option
  17265. @item dc_luma
  17266. @item dc_chroma
  17267. @item freq_luma
  17268. @item freq_chroma
  17269. @item amp_luma
  17270. @item amp_chroma
  17271. @item cbp
  17272. @item mv
  17273. @item ring1
  17274. @item ring2
  17275. @item all
  17276. @item max_frames, m
  17277. Set the maximum number of frames generated for each test, default value is 30.
  17278. @end table
  17279. Default value is "all", which will cycle through the list of all tests.
  17280. @end table
  17281. Some examples:
  17282. @example
  17283. mptestsrc=t=dc_luma
  17284. @end example
  17285. will generate a "dc_luma" test pattern.
  17286. @section frei0r_src
  17287. Provide a frei0r source.
  17288. To enable compilation of this filter you need to install the frei0r
  17289. header and configure FFmpeg with @code{--enable-frei0r}.
  17290. This source accepts the following parameters:
  17291. @table @option
  17292. @item size
  17293. The size of the video to generate. For the syntax of this option, check the
  17294. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17295. @item framerate
  17296. The framerate of the generated video. It may be a string of the form
  17297. @var{num}/@var{den} or a frame rate abbreviation.
  17298. @item filter_name
  17299. The name to the frei0r source to load. For more information regarding frei0r and
  17300. how to set the parameters, read the @ref{frei0r} section in the video filters
  17301. documentation.
  17302. @item filter_params
  17303. A '|'-separated list of parameters to pass to the frei0r source.
  17304. @end table
  17305. For example, to generate a frei0r partik0l source with size 200x200
  17306. and frame rate 10 which is overlaid on the overlay filter main input:
  17307. @example
  17308. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17309. @end example
  17310. @section life
  17311. Generate a life pattern.
  17312. This source is based on a generalization of John Conway's life game.
  17313. The sourced input represents a life grid, each pixel represents a cell
  17314. which can be in one of two possible states, alive or dead. Every cell
  17315. interacts with its eight neighbours, which are the cells that are
  17316. horizontally, vertically, or diagonally adjacent.
  17317. At each interaction the grid evolves according to the adopted rule,
  17318. which specifies the number of neighbor alive cells which will make a
  17319. cell stay alive or born. The @option{rule} option allows one to specify
  17320. the rule to adopt.
  17321. This source accepts the following options:
  17322. @table @option
  17323. @item filename, f
  17324. Set the file from which to read the initial grid state. In the file,
  17325. each non-whitespace character is considered an alive cell, and newline
  17326. is used to delimit the end of each row.
  17327. If this option is not specified, the initial grid is generated
  17328. randomly.
  17329. @item rate, r
  17330. Set the video rate, that is the number of frames generated per second.
  17331. Default is 25.
  17332. @item random_fill_ratio, ratio
  17333. Set the random fill ratio for the initial random grid. It is a
  17334. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17335. It is ignored when a file is specified.
  17336. @item random_seed, seed
  17337. Set the seed for filling the initial random grid, must be an integer
  17338. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17339. set to -1, the filter will try to use a good random seed on a best
  17340. effort basis.
  17341. @item rule
  17342. Set the life rule.
  17343. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17344. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17345. @var{NS} specifies the number of alive neighbor cells which make a
  17346. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17347. which make a dead cell to become alive (i.e. to "born").
  17348. "s" and "b" can be used in place of "S" and "B", respectively.
  17349. Alternatively a rule can be specified by an 18-bits integer. The 9
  17350. high order bits are used to encode the next cell state if it is alive
  17351. for each number of neighbor alive cells, the low order bits specify
  17352. the rule for "borning" new cells. Higher order bits encode for an
  17353. higher number of neighbor cells.
  17354. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17355. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17356. Default value is "S23/B3", which is the original Conway's game of life
  17357. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17358. cells, and will born a new cell if there are three alive cells around
  17359. a dead cell.
  17360. @item size, s
  17361. Set the size of the output video. For the syntax of this option, check the
  17362. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17363. If @option{filename} is specified, the size is set by default to the
  17364. same size of the input file. If @option{size} is set, it must contain
  17365. the size specified in the input file, and the initial grid defined in
  17366. that file is centered in the larger resulting area.
  17367. If a filename is not specified, the size value defaults to "320x240"
  17368. (used for a randomly generated initial grid).
  17369. @item stitch
  17370. If set to 1, stitch the left and right grid edges together, and the
  17371. top and bottom edges also. Defaults to 1.
  17372. @item mold
  17373. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17374. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17375. value from 0 to 255.
  17376. @item life_color
  17377. Set the color of living (or new born) cells.
  17378. @item death_color
  17379. Set the color of dead cells. If @option{mold} is set, this is the first color
  17380. used to represent a dead cell.
  17381. @item mold_color
  17382. Set mold color, for definitely dead and moldy cells.
  17383. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17384. ffmpeg-utils manual,ffmpeg-utils}.
  17385. @end table
  17386. @subsection Examples
  17387. @itemize
  17388. @item
  17389. Read a grid from @file{pattern}, and center it on a grid of size
  17390. 300x300 pixels:
  17391. @example
  17392. life=f=pattern:s=300x300
  17393. @end example
  17394. @item
  17395. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17396. @example
  17397. life=ratio=2/3:s=200x200
  17398. @end example
  17399. @item
  17400. Specify a custom rule for evolving a randomly generated grid:
  17401. @example
  17402. life=rule=S14/B34
  17403. @end example
  17404. @item
  17405. Full example with slow death effect (mold) using @command{ffplay}:
  17406. @example
  17407. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17408. @end example
  17409. @end itemize
  17410. @anchor{allrgb}
  17411. @anchor{allyuv}
  17412. @anchor{color}
  17413. @anchor{haldclutsrc}
  17414. @anchor{nullsrc}
  17415. @anchor{pal75bars}
  17416. @anchor{pal100bars}
  17417. @anchor{rgbtestsrc}
  17418. @anchor{smptebars}
  17419. @anchor{smptehdbars}
  17420. @anchor{testsrc}
  17421. @anchor{testsrc2}
  17422. @anchor{yuvtestsrc}
  17423. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17424. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17425. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17426. The @code{color} source provides an uniformly colored input.
  17427. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17428. @ref{haldclut} filter.
  17429. The @code{nullsrc} source returns unprocessed video frames. It is
  17430. mainly useful to be employed in analysis / debugging tools, or as the
  17431. source for filters which ignore the input data.
  17432. The @code{pal75bars} source generates a color bars pattern, based on
  17433. EBU PAL recommendations with 75% color levels.
  17434. The @code{pal100bars} source generates a color bars pattern, based on
  17435. EBU PAL recommendations with 100% color levels.
  17436. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17437. detecting RGB vs BGR issues. You should see a red, green and blue
  17438. stripe from top to bottom.
  17439. The @code{smptebars} source generates a color bars pattern, based on
  17440. the SMPTE Engineering Guideline EG 1-1990.
  17441. The @code{smptehdbars} source generates a color bars pattern, based on
  17442. the SMPTE RP 219-2002.
  17443. The @code{testsrc} source generates a test video pattern, showing a
  17444. color pattern, a scrolling gradient and a timestamp. This is mainly
  17445. intended for testing purposes.
  17446. The @code{testsrc2} source is similar to testsrc, but supports more
  17447. pixel formats instead of just @code{rgb24}. This allows using it as an
  17448. input for other tests without requiring a format conversion.
  17449. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17450. see a y, cb and cr stripe from top to bottom.
  17451. The sources accept the following parameters:
  17452. @table @option
  17453. @item level
  17454. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17455. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17456. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17457. coded on a @code{1/(N*N)} scale.
  17458. @item color, c
  17459. Specify the color of the source, only available in the @code{color}
  17460. source. For the syntax of this option, check the
  17461. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17462. @item size, s
  17463. Specify the size of the sourced video. For the syntax of this option, check the
  17464. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17465. The default value is @code{320x240}.
  17466. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17467. @code{haldclutsrc} filters.
  17468. @item rate, r
  17469. Specify the frame rate of the sourced video, as the number of frames
  17470. generated per second. It has to be a string in the format
  17471. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17472. number or a valid video frame rate abbreviation. The default value is
  17473. "25".
  17474. @item duration, d
  17475. Set the duration of the sourced video. See
  17476. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17477. for the accepted syntax.
  17478. If not specified, or the expressed duration is negative, the video is
  17479. supposed to be generated forever.
  17480. Since the frame rate is used as time base, all frames including the last one
  17481. will have their full duration. If the specified duration is not a multiple
  17482. of the frame duration, it will be rounded up.
  17483. @item sar
  17484. Set the sample aspect ratio of the sourced video.
  17485. @item alpha
  17486. Specify the alpha (opacity) of the background, only available in the
  17487. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17488. 255 (fully opaque, the default).
  17489. @item decimals, n
  17490. Set the number of decimals to show in the timestamp, only available in the
  17491. @code{testsrc} source.
  17492. The displayed timestamp value will correspond to the original
  17493. timestamp value multiplied by the power of 10 of the specified
  17494. value. Default value is 0.
  17495. @end table
  17496. @subsection Examples
  17497. @itemize
  17498. @item
  17499. Generate a video with a duration of 5.3 seconds, with size
  17500. 176x144 and a frame rate of 10 frames per second:
  17501. @example
  17502. testsrc=duration=5.3:size=qcif:rate=10
  17503. @end example
  17504. @item
  17505. The following graph description will generate a red source
  17506. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17507. frames per second:
  17508. @example
  17509. color=c=red@@0.2:s=qcif:r=10
  17510. @end example
  17511. @item
  17512. If the input content is to be ignored, @code{nullsrc} can be used. The
  17513. following command generates noise in the luminance plane by employing
  17514. the @code{geq} filter:
  17515. @example
  17516. nullsrc=s=256x256, geq=random(1)*255:128:128
  17517. @end example
  17518. @end itemize
  17519. @subsection Commands
  17520. The @code{color} source supports the following commands:
  17521. @table @option
  17522. @item c, color
  17523. Set the color of the created image. Accepts the same syntax of the
  17524. corresponding @option{color} option.
  17525. @end table
  17526. @section openclsrc
  17527. Generate video using an OpenCL program.
  17528. @table @option
  17529. @item source
  17530. OpenCL program source file.
  17531. @item kernel
  17532. Kernel name in program.
  17533. @item size, s
  17534. Size of frames to generate. This must be set.
  17535. @item format
  17536. Pixel format to use for the generated frames. This must be set.
  17537. @item rate, r
  17538. Number of frames generated every second. Default value is '25'.
  17539. @end table
  17540. For details of how the program loading works, see the @ref{program_opencl}
  17541. filter.
  17542. Example programs:
  17543. @itemize
  17544. @item
  17545. Generate a colour ramp by setting pixel values from the position of the pixel
  17546. in the output image. (Note that this will work with all pixel formats, but
  17547. the generated output will not be the same.)
  17548. @verbatim
  17549. __kernel void ramp(__write_only image2d_t dst,
  17550. unsigned int index)
  17551. {
  17552. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17553. float4 val;
  17554. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17555. write_imagef(dst, loc, val);
  17556. }
  17557. @end verbatim
  17558. @item
  17559. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17560. @verbatim
  17561. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17562. unsigned int index)
  17563. {
  17564. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17565. float4 value = 0.0f;
  17566. int x = loc.x + index;
  17567. int y = loc.y + index;
  17568. while (x > 0 || y > 0) {
  17569. if (x % 3 == 1 && y % 3 == 1) {
  17570. value = 1.0f;
  17571. break;
  17572. }
  17573. x /= 3;
  17574. y /= 3;
  17575. }
  17576. write_imagef(dst, loc, value);
  17577. }
  17578. @end verbatim
  17579. @end itemize
  17580. @section sierpinski
  17581. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17582. This source accepts the following options:
  17583. @table @option
  17584. @item size, s
  17585. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17586. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17587. @item rate, r
  17588. Set frame rate, expressed as number of frames per second. Default
  17589. value is "25".
  17590. @item seed
  17591. Set seed which is used for random panning.
  17592. @item jump
  17593. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17594. @item type
  17595. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17596. @end table
  17597. @c man end VIDEO SOURCES
  17598. @chapter Video Sinks
  17599. @c man begin VIDEO SINKS
  17600. Below is a description of the currently available video sinks.
  17601. @section buffersink
  17602. Buffer video frames, and make them available to the end of the filter
  17603. graph.
  17604. This sink is mainly intended for programmatic use, in particular
  17605. through the interface defined in @file{libavfilter/buffersink.h}
  17606. or the options system.
  17607. It accepts a pointer to an AVBufferSinkContext structure, which
  17608. defines the incoming buffers' formats, to be passed as the opaque
  17609. parameter to @code{avfilter_init_filter} for initialization.
  17610. @section nullsink
  17611. Null video sink: do absolutely nothing with the input video. It is
  17612. mainly useful as a template and for use in analysis / debugging
  17613. tools.
  17614. @c man end VIDEO SINKS
  17615. @chapter Multimedia Filters
  17616. @c man begin MULTIMEDIA FILTERS
  17617. Below is a description of the currently available multimedia filters.
  17618. @section abitscope
  17619. Convert input audio to a video output, displaying the audio bit scope.
  17620. The filter accepts the following options:
  17621. @table @option
  17622. @item rate, r
  17623. Set frame rate, expressed as number of frames per second. Default
  17624. value is "25".
  17625. @item size, s
  17626. Specify the video size for the output. For the syntax of this option, check the
  17627. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17628. Default value is @code{1024x256}.
  17629. @item colors
  17630. Specify list of colors separated by space or by '|' which will be used to
  17631. draw channels. Unrecognized or missing colors will be replaced
  17632. by white color.
  17633. @end table
  17634. @section adrawgraph
  17635. Draw a graph using input audio metadata.
  17636. See @ref{drawgraph}
  17637. @section agraphmonitor
  17638. See @ref{graphmonitor}.
  17639. @section ahistogram
  17640. Convert input audio to a video output, displaying the volume histogram.
  17641. The filter accepts the following options:
  17642. @table @option
  17643. @item dmode
  17644. Specify how histogram is calculated.
  17645. It accepts the following values:
  17646. @table @samp
  17647. @item single
  17648. Use single histogram for all channels.
  17649. @item separate
  17650. Use separate histogram for each channel.
  17651. @end table
  17652. Default is @code{single}.
  17653. @item rate, r
  17654. Set frame rate, expressed as number of frames per second. Default
  17655. value is "25".
  17656. @item size, s
  17657. Specify the video size for the output. For the syntax of this option, check the
  17658. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17659. Default value is @code{hd720}.
  17660. @item scale
  17661. Set display scale.
  17662. It accepts the following values:
  17663. @table @samp
  17664. @item log
  17665. logarithmic
  17666. @item sqrt
  17667. square root
  17668. @item cbrt
  17669. cubic root
  17670. @item lin
  17671. linear
  17672. @item rlog
  17673. reverse logarithmic
  17674. @end table
  17675. Default is @code{log}.
  17676. @item ascale
  17677. Set amplitude scale.
  17678. It accepts the following values:
  17679. @table @samp
  17680. @item log
  17681. logarithmic
  17682. @item lin
  17683. linear
  17684. @end table
  17685. Default is @code{log}.
  17686. @item acount
  17687. Set how much frames to accumulate in histogram.
  17688. Default is 1. Setting this to -1 accumulates all frames.
  17689. @item rheight
  17690. Set histogram ratio of window height.
  17691. @item slide
  17692. Set sonogram sliding.
  17693. It accepts the following values:
  17694. @table @samp
  17695. @item replace
  17696. replace old rows with new ones.
  17697. @item scroll
  17698. scroll from top to bottom.
  17699. @end table
  17700. Default is @code{replace}.
  17701. @end table
  17702. @section aphasemeter
  17703. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17704. representing mean phase of current audio frame. A video output can also be produced and is
  17705. enabled by default. The audio is passed through as first output.
  17706. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17707. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17708. and @code{1} means channels are in phase.
  17709. The filter accepts the following options, all related to its video output:
  17710. @table @option
  17711. @item rate, r
  17712. Set the output frame rate. Default value is @code{25}.
  17713. @item size, s
  17714. Set the video size for the output. For the syntax of this option, check the
  17715. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17716. Default value is @code{800x400}.
  17717. @item rc
  17718. @item gc
  17719. @item bc
  17720. Specify the red, green, blue contrast. Default values are @code{2},
  17721. @code{7} and @code{1}.
  17722. Allowed range is @code{[0, 255]}.
  17723. @item mpc
  17724. Set color which will be used for drawing median phase. If color is
  17725. @code{none} which is default, no median phase value will be drawn.
  17726. @item video
  17727. Enable video output. Default is enabled.
  17728. @end table
  17729. @section avectorscope
  17730. Convert input audio to a video output, representing the audio vector
  17731. scope.
  17732. The filter is used to measure the difference between channels of stereo
  17733. audio stream. A monaural signal, consisting of identical left and right
  17734. signal, results in straight vertical line. Any stereo separation is visible
  17735. as a deviation from this line, creating a Lissajous figure.
  17736. If the straight (or deviation from it) but horizontal line appears this
  17737. indicates that the left and right channels are out of phase.
  17738. The filter accepts the following options:
  17739. @table @option
  17740. @item mode, m
  17741. Set the vectorscope mode.
  17742. Available values are:
  17743. @table @samp
  17744. @item lissajous
  17745. Lissajous rotated by 45 degrees.
  17746. @item lissajous_xy
  17747. Same as above but not rotated.
  17748. @item polar
  17749. Shape resembling half of circle.
  17750. @end table
  17751. Default value is @samp{lissajous}.
  17752. @item size, s
  17753. Set the video size for the output. For the syntax of this option, check the
  17754. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17755. Default value is @code{400x400}.
  17756. @item rate, r
  17757. Set the output frame rate. Default value is @code{25}.
  17758. @item rc
  17759. @item gc
  17760. @item bc
  17761. @item ac
  17762. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17763. @code{160}, @code{80} and @code{255}.
  17764. Allowed range is @code{[0, 255]}.
  17765. @item rf
  17766. @item gf
  17767. @item bf
  17768. @item af
  17769. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17770. @code{10}, @code{5} and @code{5}.
  17771. Allowed range is @code{[0, 255]}.
  17772. @item zoom
  17773. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17774. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17775. @item draw
  17776. Set the vectorscope drawing mode.
  17777. Available values are:
  17778. @table @samp
  17779. @item dot
  17780. Draw dot for each sample.
  17781. @item line
  17782. Draw line between previous and current sample.
  17783. @end table
  17784. Default value is @samp{dot}.
  17785. @item scale
  17786. Specify amplitude scale of audio samples.
  17787. Available values are:
  17788. @table @samp
  17789. @item lin
  17790. Linear.
  17791. @item sqrt
  17792. Square root.
  17793. @item cbrt
  17794. Cubic root.
  17795. @item log
  17796. Logarithmic.
  17797. @end table
  17798. @item swap
  17799. Swap left channel axis with right channel axis.
  17800. @item mirror
  17801. Mirror axis.
  17802. @table @samp
  17803. @item none
  17804. No mirror.
  17805. @item x
  17806. Mirror only x axis.
  17807. @item y
  17808. Mirror only y axis.
  17809. @item xy
  17810. Mirror both axis.
  17811. @end table
  17812. @end table
  17813. @subsection Examples
  17814. @itemize
  17815. @item
  17816. Complete example using @command{ffplay}:
  17817. @example
  17818. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17819. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  17820. @end example
  17821. @end itemize
  17822. @section bench, abench
  17823. Benchmark part of a filtergraph.
  17824. The filter accepts the following options:
  17825. @table @option
  17826. @item action
  17827. Start or stop a timer.
  17828. Available values are:
  17829. @table @samp
  17830. @item start
  17831. Get the current time, set it as frame metadata (using the key
  17832. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  17833. @item stop
  17834. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  17835. the input frame metadata to get the time difference. Time difference, average,
  17836. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  17837. @code{min}) are then printed. The timestamps are expressed in seconds.
  17838. @end table
  17839. @end table
  17840. @subsection Examples
  17841. @itemize
  17842. @item
  17843. Benchmark @ref{selectivecolor} filter:
  17844. @example
  17845. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17846. @end example
  17847. @end itemize
  17848. @section concat
  17849. Concatenate audio and video streams, joining them together one after the
  17850. other.
  17851. The filter works on segments of synchronized video and audio streams. All
  17852. segments must have the same number of streams of each type, and that will
  17853. also be the number of streams at output.
  17854. The filter accepts the following options:
  17855. @table @option
  17856. @item n
  17857. Set the number of segments. Default is 2.
  17858. @item v
  17859. Set the number of output video streams, that is also the number of video
  17860. streams in each segment. Default is 1.
  17861. @item a
  17862. Set the number of output audio streams, that is also the number of audio
  17863. streams in each segment. Default is 0.
  17864. @item unsafe
  17865. Activate unsafe mode: do not fail if segments have a different format.
  17866. @end table
  17867. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  17868. @var{a} audio outputs.
  17869. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  17870. segment, in the same order as the outputs, then the inputs for the second
  17871. segment, etc.
  17872. Related streams do not always have exactly the same duration, for various
  17873. reasons including codec frame size or sloppy authoring. For that reason,
  17874. related synchronized streams (e.g. a video and its audio track) should be
  17875. concatenated at once. The concat filter will use the duration of the longest
  17876. stream in each segment (except the last one), and if necessary pad shorter
  17877. audio streams with silence.
  17878. For this filter to work correctly, all segments must start at timestamp 0.
  17879. All corresponding streams must have the same parameters in all segments; the
  17880. filtering system will automatically select a common pixel format for video
  17881. streams, and a common sample format, sample rate and channel layout for
  17882. audio streams, but other settings, such as resolution, must be converted
  17883. explicitly by the user.
  17884. Different frame rates are acceptable but will result in variable frame rate
  17885. at output; be sure to configure the output file to handle it.
  17886. @subsection Examples
  17887. @itemize
  17888. @item
  17889. Concatenate an opening, an episode and an ending, all in bilingual version
  17890. (video in stream 0, audio in streams 1 and 2):
  17891. @example
  17892. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  17893. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  17894. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  17895. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  17896. @end example
  17897. @item
  17898. Concatenate two parts, handling audio and video separately, using the
  17899. (a)movie sources, and adjusting the resolution:
  17900. @example
  17901. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  17902. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  17903. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  17904. @end example
  17905. Note that a desync will happen at the stitch if the audio and video streams
  17906. do not have exactly the same duration in the first file.
  17907. @end itemize
  17908. @subsection Commands
  17909. This filter supports the following commands:
  17910. @table @option
  17911. @item next
  17912. Close the current segment and step to the next one
  17913. @end table
  17914. @anchor{ebur128}
  17915. @section ebur128
  17916. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  17917. level. By default, it logs a message at a frequency of 10Hz with the
  17918. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  17919. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  17920. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  17921. sample format is double-precision floating point. The input stream will be converted to
  17922. this specification, if needed. Users may need to insert aformat and/or aresample filters
  17923. after this filter to obtain the original parameters.
  17924. The filter also has a video output (see the @var{video} option) with a real
  17925. time graph to observe the loudness evolution. The graphic contains the logged
  17926. message mentioned above, so it is not printed anymore when this option is set,
  17927. unless the verbose logging is set. The main graphing area contains the
  17928. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  17929. the momentary loudness (400 milliseconds), but can optionally be configured
  17930. to instead display short-term loudness (see @var{gauge}).
  17931. The green area marks a +/- 1LU target range around the target loudness
  17932. (-23LUFS by default, unless modified through @var{target}).
  17933. More information about the Loudness Recommendation EBU R128 on
  17934. @url{http://tech.ebu.ch/loudness}.
  17935. The filter accepts the following options:
  17936. @table @option
  17937. @item video
  17938. Activate the video output. The audio stream is passed unchanged whether this
  17939. option is set or no. The video stream will be the first output stream if
  17940. activated. Default is @code{0}.
  17941. @item size
  17942. Set the video size. This option is for video only. For the syntax of this
  17943. option, check the
  17944. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17945. Default and minimum resolution is @code{640x480}.
  17946. @item meter
  17947. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  17948. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  17949. other integer value between this range is allowed.
  17950. @item metadata
  17951. Set metadata injection. If set to @code{1}, the audio input will be segmented
  17952. into 100ms output frames, each of them containing various loudness information
  17953. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  17954. Default is @code{0}.
  17955. @item framelog
  17956. Force the frame logging level.
  17957. Available values are:
  17958. @table @samp
  17959. @item info
  17960. information logging level
  17961. @item verbose
  17962. verbose logging level
  17963. @end table
  17964. By default, the logging level is set to @var{info}. If the @option{video} or
  17965. the @option{metadata} options are set, it switches to @var{verbose}.
  17966. @item peak
  17967. Set peak mode(s).
  17968. Available modes can be cumulated (the option is a @code{flag} type). Possible
  17969. values are:
  17970. @table @samp
  17971. @item none
  17972. Disable any peak mode (default).
  17973. @item sample
  17974. Enable sample-peak mode.
  17975. Simple peak mode looking for the higher sample value. It logs a message
  17976. for sample-peak (identified by @code{SPK}).
  17977. @item true
  17978. Enable true-peak mode.
  17979. If enabled, the peak lookup is done on an over-sampled version of the input
  17980. stream for better peak accuracy. It logs a message for true-peak.
  17981. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  17982. This mode requires a build with @code{libswresample}.
  17983. @end table
  17984. @item dualmono
  17985. Treat mono input files as "dual mono". If a mono file is intended for playback
  17986. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  17987. If set to @code{true}, this option will compensate for this effect.
  17988. Multi-channel input files are not affected by this option.
  17989. @item panlaw
  17990. Set a specific pan law to be used for the measurement of dual mono files.
  17991. This parameter is optional, and has a default value of -3.01dB.
  17992. @item target
  17993. Set a specific target level (in LUFS) used as relative zero in the visualization.
  17994. This parameter is optional and has a default value of -23LUFS as specified
  17995. by EBU R128. However, material published online may prefer a level of -16LUFS
  17996. (e.g. for use with podcasts or video platforms).
  17997. @item gauge
  17998. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  17999. @code{shortterm}. By default the momentary value will be used, but in certain
  18000. scenarios it may be more useful to observe the short term value instead (e.g.
  18001. live mixing).
  18002. @item scale
  18003. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18004. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18005. video output, not the summary or continuous log output.
  18006. @end table
  18007. @subsection Examples
  18008. @itemize
  18009. @item
  18010. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18011. @example
  18012. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18013. @end example
  18014. @item
  18015. Run an analysis with @command{ffmpeg}:
  18016. @example
  18017. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18018. @end example
  18019. @end itemize
  18020. @section interleave, ainterleave
  18021. Temporally interleave frames from several inputs.
  18022. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18023. These filters read frames from several inputs and send the oldest
  18024. queued frame to the output.
  18025. Input streams must have well defined, monotonically increasing frame
  18026. timestamp values.
  18027. In order to submit one frame to output, these filters need to enqueue
  18028. at least one frame for each input, so they cannot work in case one
  18029. input is not yet terminated and will not receive incoming frames.
  18030. For example consider the case when one input is a @code{select} filter
  18031. which always drops input frames. The @code{interleave} filter will keep
  18032. reading from that input, but it will never be able to send new frames
  18033. to output until the input sends an end-of-stream signal.
  18034. Also, depending on inputs synchronization, the filters will drop
  18035. frames in case one input receives more frames than the other ones, and
  18036. the queue is already filled.
  18037. These filters accept the following options:
  18038. @table @option
  18039. @item nb_inputs, n
  18040. Set the number of different inputs, it is 2 by default.
  18041. @item duration
  18042. How to determine the end-of-stream.
  18043. @table @option
  18044. @item longest
  18045. The duration of the longest input. (default)
  18046. @item shortest
  18047. The duration of the shortest input.
  18048. @item first
  18049. The duration of the first input.
  18050. @end table
  18051. @end table
  18052. @subsection Examples
  18053. @itemize
  18054. @item
  18055. Interleave frames belonging to different streams using @command{ffmpeg}:
  18056. @example
  18057. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18058. @end example
  18059. @item
  18060. Add flickering blur effect:
  18061. @example
  18062. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18063. @end example
  18064. @end itemize
  18065. @section metadata, ametadata
  18066. Manipulate frame metadata.
  18067. This filter accepts the following options:
  18068. @table @option
  18069. @item mode
  18070. Set mode of operation of the filter.
  18071. Can be one of the following:
  18072. @table @samp
  18073. @item select
  18074. If both @code{value} and @code{key} is set, select frames
  18075. which have such metadata. If only @code{key} is set, select
  18076. every frame that has such key in metadata.
  18077. @item add
  18078. Add new metadata @code{key} and @code{value}. If key is already available
  18079. do nothing.
  18080. @item modify
  18081. Modify value of already present key.
  18082. @item delete
  18083. If @code{value} is set, delete only keys that have such value.
  18084. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18085. the frame.
  18086. @item print
  18087. Print key and its value if metadata was found. If @code{key} is not set print all
  18088. metadata values available in frame.
  18089. @end table
  18090. @item key
  18091. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18092. @item value
  18093. Set metadata value which will be used. This option is mandatory for
  18094. @code{modify} and @code{add} mode.
  18095. @item function
  18096. Which function to use when comparing metadata value and @code{value}.
  18097. Can be one of following:
  18098. @table @samp
  18099. @item same_str
  18100. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18101. @item starts_with
  18102. Values are interpreted as strings, returns true if metadata value starts with
  18103. the @code{value} option string.
  18104. @item less
  18105. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18106. @item equal
  18107. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18108. @item greater
  18109. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18110. @item expr
  18111. Values are interpreted as floats, returns true if expression from option @code{expr}
  18112. evaluates to true.
  18113. @item ends_with
  18114. Values are interpreted as strings, returns true if metadata value ends with
  18115. the @code{value} option string.
  18116. @end table
  18117. @item expr
  18118. Set expression which is used when @code{function} is set to @code{expr}.
  18119. The expression is evaluated through the eval API and can contain the following
  18120. constants:
  18121. @table @option
  18122. @item VALUE1
  18123. Float representation of @code{value} from metadata key.
  18124. @item VALUE2
  18125. Float representation of @code{value} as supplied by user in @code{value} option.
  18126. @end table
  18127. @item file
  18128. If specified in @code{print} mode, output is written to the named file. Instead of
  18129. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18130. for standard output. If @code{file} option is not set, output is written to the log
  18131. with AV_LOG_INFO loglevel.
  18132. @item direct
  18133. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18134. @end table
  18135. @subsection Examples
  18136. @itemize
  18137. @item
  18138. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18139. between 0 and 1.
  18140. @example
  18141. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18142. @end example
  18143. @item
  18144. Print silencedetect output to file @file{metadata.txt}.
  18145. @example
  18146. silencedetect,ametadata=mode=print:file=metadata.txt
  18147. @end example
  18148. @item
  18149. Direct all metadata to a pipe with file descriptor 4.
  18150. @example
  18151. metadata=mode=print:file='pipe\:4'
  18152. @end example
  18153. @end itemize
  18154. @section perms, aperms
  18155. Set read/write permissions for the output frames.
  18156. These filters are mainly aimed at developers to test direct path in the
  18157. following filter in the filtergraph.
  18158. The filters accept the following options:
  18159. @table @option
  18160. @item mode
  18161. Select the permissions mode.
  18162. It accepts the following values:
  18163. @table @samp
  18164. @item none
  18165. Do nothing. This is the default.
  18166. @item ro
  18167. Set all the output frames read-only.
  18168. @item rw
  18169. Set all the output frames directly writable.
  18170. @item toggle
  18171. Make the frame read-only if writable, and writable if read-only.
  18172. @item random
  18173. Set each output frame read-only or writable randomly.
  18174. @end table
  18175. @item seed
  18176. Set the seed for the @var{random} mode, must be an integer included between
  18177. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18178. @code{-1}, the filter will try to use a good random seed on a best effort
  18179. basis.
  18180. @end table
  18181. Note: in case of auto-inserted filter between the permission filter and the
  18182. following one, the permission might not be received as expected in that
  18183. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18184. perms/aperms filter can avoid this problem.
  18185. @section realtime, arealtime
  18186. Slow down filtering to match real time approximately.
  18187. These filters will pause the filtering for a variable amount of time to
  18188. match the output rate with the input timestamps.
  18189. They are similar to the @option{re} option to @code{ffmpeg}.
  18190. They accept the following options:
  18191. @table @option
  18192. @item limit
  18193. Time limit for the pauses. Any pause longer than that will be considered
  18194. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18195. @item speed
  18196. Speed factor for processing. The value must be a float larger than zero.
  18197. Values larger than 1.0 will result in faster than realtime processing,
  18198. smaller will slow processing down. The @var{limit} is automatically adapted
  18199. accordingly. Default is 1.0.
  18200. A processing speed faster than what is possible without these filters cannot
  18201. be achieved.
  18202. @end table
  18203. @anchor{select}
  18204. @section select, aselect
  18205. Select frames to pass in output.
  18206. This filter accepts the following options:
  18207. @table @option
  18208. @item expr, e
  18209. Set expression, which is evaluated for each input frame.
  18210. If the expression is evaluated to zero, the frame is discarded.
  18211. If the evaluation result is negative or NaN, the frame is sent to the
  18212. first output; otherwise it is sent to the output with index
  18213. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18214. For example a value of @code{1.2} corresponds to the output with index
  18215. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18216. @item outputs, n
  18217. Set the number of outputs. The output to which to send the selected
  18218. frame is based on the result of the evaluation. Default value is 1.
  18219. @end table
  18220. The expression can contain the following constants:
  18221. @table @option
  18222. @item n
  18223. The (sequential) number of the filtered frame, starting from 0.
  18224. @item selected_n
  18225. The (sequential) number of the selected frame, starting from 0.
  18226. @item prev_selected_n
  18227. The sequential number of the last selected frame. It's NAN if undefined.
  18228. @item TB
  18229. The timebase of the input timestamps.
  18230. @item pts
  18231. The PTS (Presentation TimeStamp) of the filtered video frame,
  18232. expressed in @var{TB} units. It's NAN if undefined.
  18233. @item t
  18234. The PTS of the filtered video frame,
  18235. expressed in seconds. It's NAN if undefined.
  18236. @item prev_pts
  18237. The PTS of the previously filtered video frame. It's NAN if undefined.
  18238. @item prev_selected_pts
  18239. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18240. @item prev_selected_t
  18241. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18242. @item start_pts
  18243. The PTS of the first video frame in the video. It's NAN if undefined.
  18244. @item start_t
  18245. The time of the first video frame in the video. It's NAN if undefined.
  18246. @item pict_type @emph{(video only)}
  18247. The type of the filtered frame. It can assume one of the following
  18248. values:
  18249. @table @option
  18250. @item I
  18251. @item P
  18252. @item B
  18253. @item S
  18254. @item SI
  18255. @item SP
  18256. @item BI
  18257. @end table
  18258. @item interlace_type @emph{(video only)}
  18259. The frame interlace type. It can assume one of the following values:
  18260. @table @option
  18261. @item PROGRESSIVE
  18262. The frame is progressive (not interlaced).
  18263. @item TOPFIRST
  18264. The frame is top-field-first.
  18265. @item BOTTOMFIRST
  18266. The frame is bottom-field-first.
  18267. @end table
  18268. @item consumed_sample_n @emph{(audio only)}
  18269. the number of selected samples before the current frame
  18270. @item samples_n @emph{(audio only)}
  18271. the number of samples in the current frame
  18272. @item sample_rate @emph{(audio only)}
  18273. the input sample rate
  18274. @item key
  18275. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18276. @item pos
  18277. the position in the file of the filtered frame, -1 if the information
  18278. is not available (e.g. for synthetic video)
  18279. @item scene @emph{(video only)}
  18280. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18281. probability for the current frame to introduce a new scene, while a higher
  18282. value means the current frame is more likely to be one (see the example below)
  18283. @item concatdec_select
  18284. The concat demuxer can select only part of a concat input file by setting an
  18285. inpoint and an outpoint, but the output packets may not be entirely contained
  18286. in the selected interval. By using this variable, it is possible to skip frames
  18287. generated by the concat demuxer which are not exactly contained in the selected
  18288. interval.
  18289. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18290. and the @var{lavf.concat.duration} packet metadata values which are also
  18291. present in the decoded frames.
  18292. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18293. start_time and either the duration metadata is missing or the frame pts is less
  18294. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18295. missing.
  18296. That basically means that an input frame is selected if its pts is within the
  18297. interval set by the concat demuxer.
  18298. @end table
  18299. The default value of the select expression is "1".
  18300. @subsection Examples
  18301. @itemize
  18302. @item
  18303. Select all frames in input:
  18304. @example
  18305. select
  18306. @end example
  18307. The example above is the same as:
  18308. @example
  18309. select=1
  18310. @end example
  18311. @item
  18312. Skip all frames:
  18313. @example
  18314. select=0
  18315. @end example
  18316. @item
  18317. Select only I-frames:
  18318. @example
  18319. select='eq(pict_type\,I)'
  18320. @end example
  18321. @item
  18322. Select one frame every 100:
  18323. @example
  18324. select='not(mod(n\,100))'
  18325. @end example
  18326. @item
  18327. Select only frames contained in the 10-20 time interval:
  18328. @example
  18329. select=between(t\,10\,20)
  18330. @end example
  18331. @item
  18332. Select only I-frames contained in the 10-20 time interval:
  18333. @example
  18334. select=between(t\,10\,20)*eq(pict_type\,I)
  18335. @end example
  18336. @item
  18337. Select frames with a minimum distance of 10 seconds:
  18338. @example
  18339. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18340. @end example
  18341. @item
  18342. Use aselect to select only audio frames with samples number > 100:
  18343. @example
  18344. aselect='gt(samples_n\,100)'
  18345. @end example
  18346. @item
  18347. Create a mosaic of the first scenes:
  18348. @example
  18349. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18350. @end example
  18351. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18352. choice.
  18353. @item
  18354. Send even and odd frames to separate outputs, and compose them:
  18355. @example
  18356. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18357. @end example
  18358. @item
  18359. Select useful frames from an ffconcat file which is using inpoints and
  18360. outpoints but where the source files are not intra frame only.
  18361. @example
  18362. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18363. @end example
  18364. @end itemize
  18365. @section sendcmd, asendcmd
  18366. Send commands to filters in the filtergraph.
  18367. These filters read commands to be sent to other filters in the
  18368. filtergraph.
  18369. @code{sendcmd} must be inserted between two video filters,
  18370. @code{asendcmd} must be inserted between two audio filters, but apart
  18371. from that they act the same way.
  18372. The specification of commands can be provided in the filter arguments
  18373. with the @var{commands} option, or in a file specified by the
  18374. @var{filename} option.
  18375. These filters accept the following options:
  18376. @table @option
  18377. @item commands, c
  18378. Set the commands to be read and sent to the other filters.
  18379. @item filename, f
  18380. Set the filename of the commands to be read and sent to the other
  18381. filters.
  18382. @end table
  18383. @subsection Commands syntax
  18384. A commands description consists of a sequence of interval
  18385. specifications, comprising a list of commands to be executed when a
  18386. particular event related to that interval occurs. The occurring event
  18387. is typically the current frame time entering or leaving a given time
  18388. interval.
  18389. An interval is specified by the following syntax:
  18390. @example
  18391. @var{START}[-@var{END}] @var{COMMANDS};
  18392. @end example
  18393. The time interval is specified by the @var{START} and @var{END} times.
  18394. @var{END} is optional and defaults to the maximum time.
  18395. The current frame time is considered within the specified interval if
  18396. it is included in the interval [@var{START}, @var{END}), that is when
  18397. the time is greater or equal to @var{START} and is lesser than
  18398. @var{END}.
  18399. @var{COMMANDS} consists of a sequence of one or more command
  18400. specifications, separated by ",", relating to that interval. The
  18401. syntax of a command specification is given by:
  18402. @example
  18403. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18404. @end example
  18405. @var{FLAGS} is optional and specifies the type of events relating to
  18406. the time interval which enable sending the specified command, and must
  18407. be a non-null sequence of identifier flags separated by "+" or "|" and
  18408. enclosed between "[" and "]".
  18409. The following flags are recognized:
  18410. @table @option
  18411. @item enter
  18412. The command is sent when the current frame timestamp enters the
  18413. specified interval. In other words, the command is sent when the
  18414. previous frame timestamp was not in the given interval, and the
  18415. current is.
  18416. @item leave
  18417. The command is sent when the current frame timestamp leaves the
  18418. specified interval. In other words, the command is sent when the
  18419. previous frame timestamp was in the given interval, and the
  18420. current is not.
  18421. @item expr
  18422. The command @var{ARG} is interpreted as expression and result of
  18423. expression is passed as @var{ARG}.
  18424. The expression is evaluated through the eval API and can contain the following
  18425. constants:
  18426. @table @option
  18427. @item POS
  18428. Original position in the file of the frame, or undefined if undefined
  18429. for the current frame.
  18430. @item PTS
  18431. The presentation timestamp in input.
  18432. @item N
  18433. The count of the input frame for video or audio, starting from 0.
  18434. @item T
  18435. The time in seconds of the current frame.
  18436. @item TS
  18437. The start time in seconds of the current command interval.
  18438. @item TE
  18439. The end time in seconds of the current command interval.
  18440. @item TI
  18441. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18442. @end table
  18443. @end table
  18444. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18445. assumed.
  18446. @var{TARGET} specifies the target of the command, usually the name of
  18447. the filter class or a specific filter instance name.
  18448. @var{COMMAND} specifies the name of the command for the target filter.
  18449. @var{ARG} is optional and specifies the optional list of argument for
  18450. the given @var{COMMAND}.
  18451. Between one interval specification and another, whitespaces, or
  18452. sequences of characters starting with @code{#} until the end of line,
  18453. are ignored and can be used to annotate comments.
  18454. A simplified BNF description of the commands specification syntax
  18455. follows:
  18456. @example
  18457. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18458. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18459. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18460. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18461. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18462. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18463. @end example
  18464. @subsection Examples
  18465. @itemize
  18466. @item
  18467. Specify audio tempo change at second 4:
  18468. @example
  18469. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18470. @end example
  18471. @item
  18472. Target a specific filter instance:
  18473. @example
  18474. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18475. @end example
  18476. @item
  18477. Specify a list of drawtext and hue commands in a file.
  18478. @example
  18479. # show text in the interval 5-10
  18480. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18481. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18482. # desaturate the image in the interval 15-20
  18483. 15.0-20.0 [enter] hue s 0,
  18484. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18485. [leave] hue s 1,
  18486. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18487. # apply an exponential saturation fade-out effect, starting from time 25
  18488. 25 [enter] hue s exp(25-t)
  18489. @end example
  18490. A filtergraph allowing to read and process the above command list
  18491. stored in a file @file{test.cmd}, can be specified with:
  18492. @example
  18493. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18494. @end example
  18495. @end itemize
  18496. @anchor{setpts}
  18497. @section setpts, asetpts
  18498. Change the PTS (presentation timestamp) of the input frames.
  18499. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18500. This filter accepts the following options:
  18501. @table @option
  18502. @item expr
  18503. The expression which is evaluated for each frame to construct its timestamp.
  18504. @end table
  18505. The expression is evaluated through the eval API and can contain the following
  18506. constants:
  18507. @table @option
  18508. @item FRAME_RATE, FR
  18509. frame rate, only defined for constant frame-rate video
  18510. @item PTS
  18511. The presentation timestamp in input
  18512. @item N
  18513. The count of the input frame for video or the number of consumed samples,
  18514. not including the current frame for audio, starting from 0.
  18515. @item NB_CONSUMED_SAMPLES
  18516. The number of consumed samples, not including the current frame (only
  18517. audio)
  18518. @item NB_SAMPLES, S
  18519. The number of samples in the current frame (only audio)
  18520. @item SAMPLE_RATE, SR
  18521. The audio sample rate.
  18522. @item STARTPTS
  18523. The PTS of the first frame.
  18524. @item STARTT
  18525. the time in seconds of the first frame
  18526. @item INTERLACED
  18527. State whether the current frame is interlaced.
  18528. @item T
  18529. the time in seconds of the current frame
  18530. @item POS
  18531. original position in the file of the frame, or undefined if undefined
  18532. for the current frame
  18533. @item PREV_INPTS
  18534. The previous input PTS.
  18535. @item PREV_INT
  18536. previous input time in seconds
  18537. @item PREV_OUTPTS
  18538. The previous output PTS.
  18539. @item PREV_OUTT
  18540. previous output time in seconds
  18541. @item RTCTIME
  18542. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18543. instead.
  18544. @item RTCSTART
  18545. The wallclock (RTC) time at the start of the movie in microseconds.
  18546. @item TB
  18547. The timebase of the input timestamps.
  18548. @end table
  18549. @subsection Examples
  18550. @itemize
  18551. @item
  18552. Start counting PTS from zero
  18553. @example
  18554. setpts=PTS-STARTPTS
  18555. @end example
  18556. @item
  18557. Apply fast motion effect:
  18558. @example
  18559. setpts=0.5*PTS
  18560. @end example
  18561. @item
  18562. Apply slow motion effect:
  18563. @example
  18564. setpts=2.0*PTS
  18565. @end example
  18566. @item
  18567. Set fixed rate of 25 frames per second:
  18568. @example
  18569. setpts=N/(25*TB)
  18570. @end example
  18571. @item
  18572. Set fixed rate 25 fps with some jitter:
  18573. @example
  18574. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18575. @end example
  18576. @item
  18577. Apply an offset of 10 seconds to the input PTS:
  18578. @example
  18579. setpts=PTS+10/TB
  18580. @end example
  18581. @item
  18582. Generate timestamps from a "live source" and rebase onto the current timebase:
  18583. @example
  18584. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18585. @end example
  18586. @item
  18587. Generate timestamps by counting samples:
  18588. @example
  18589. asetpts=N/SR/TB
  18590. @end example
  18591. @end itemize
  18592. @section setrange
  18593. Force color range for the output video frame.
  18594. The @code{setrange} filter marks the color range property for the
  18595. output frames. It does not change the input frame, but only sets the
  18596. corresponding property, which affects how the frame is treated by
  18597. following filters.
  18598. The filter accepts the following options:
  18599. @table @option
  18600. @item range
  18601. Available values are:
  18602. @table @samp
  18603. @item auto
  18604. Keep the same color range property.
  18605. @item unspecified, unknown
  18606. Set the color range as unspecified.
  18607. @item limited, tv, mpeg
  18608. Set the color range as limited.
  18609. @item full, pc, jpeg
  18610. Set the color range as full.
  18611. @end table
  18612. @end table
  18613. @section settb, asettb
  18614. Set the timebase to use for the output frames timestamps.
  18615. It is mainly useful for testing timebase configuration.
  18616. It accepts the following parameters:
  18617. @table @option
  18618. @item expr, tb
  18619. The expression which is evaluated into the output timebase.
  18620. @end table
  18621. The value for @option{tb} is an arithmetic expression representing a
  18622. rational. The expression can contain the constants "AVTB" (the default
  18623. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18624. audio only). Default value is "intb".
  18625. @subsection Examples
  18626. @itemize
  18627. @item
  18628. Set the timebase to 1/25:
  18629. @example
  18630. settb=expr=1/25
  18631. @end example
  18632. @item
  18633. Set the timebase to 1/10:
  18634. @example
  18635. settb=expr=0.1
  18636. @end example
  18637. @item
  18638. Set the timebase to 1001/1000:
  18639. @example
  18640. settb=1+0.001
  18641. @end example
  18642. @item
  18643. Set the timebase to 2*intb:
  18644. @example
  18645. settb=2*intb
  18646. @end example
  18647. @item
  18648. Set the default timebase value:
  18649. @example
  18650. settb=AVTB
  18651. @end example
  18652. @end itemize
  18653. @section showcqt
  18654. Convert input audio to a video output representing frequency spectrum
  18655. logarithmically using Brown-Puckette constant Q transform algorithm with
  18656. direct frequency domain coefficient calculation (but the transform itself
  18657. is not really constant Q, instead the Q factor is actually variable/clamped),
  18658. with musical tone scale, from E0 to D#10.
  18659. The filter accepts the following options:
  18660. @table @option
  18661. @item size, s
  18662. Specify the video size for the output. It must be even. For the syntax of this option,
  18663. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18664. Default value is @code{1920x1080}.
  18665. @item fps, rate, r
  18666. Set the output frame rate. Default value is @code{25}.
  18667. @item bar_h
  18668. Set the bargraph height. It must be even. Default value is @code{-1} which
  18669. computes the bargraph height automatically.
  18670. @item axis_h
  18671. Set the axis height. It must be even. Default value is @code{-1} which computes
  18672. the axis height automatically.
  18673. @item sono_h
  18674. Set the sonogram height. It must be even. Default value is @code{-1} which
  18675. computes the sonogram height automatically.
  18676. @item fullhd
  18677. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18678. instead. Default value is @code{1}.
  18679. @item sono_v, volume
  18680. Specify the sonogram volume expression. It can contain variables:
  18681. @table @option
  18682. @item bar_v
  18683. the @var{bar_v} evaluated expression
  18684. @item frequency, freq, f
  18685. the frequency where it is evaluated
  18686. @item timeclamp, tc
  18687. the value of @var{timeclamp} option
  18688. @end table
  18689. and functions:
  18690. @table @option
  18691. @item a_weighting(f)
  18692. A-weighting of equal loudness
  18693. @item b_weighting(f)
  18694. B-weighting of equal loudness
  18695. @item c_weighting(f)
  18696. C-weighting of equal loudness.
  18697. @end table
  18698. Default value is @code{16}.
  18699. @item bar_v, volume2
  18700. Specify the bargraph volume expression. It can contain variables:
  18701. @table @option
  18702. @item sono_v
  18703. the @var{sono_v} evaluated expression
  18704. @item frequency, freq, f
  18705. the frequency where it is evaluated
  18706. @item timeclamp, tc
  18707. the value of @var{timeclamp} option
  18708. @end table
  18709. and functions:
  18710. @table @option
  18711. @item a_weighting(f)
  18712. A-weighting of equal loudness
  18713. @item b_weighting(f)
  18714. B-weighting of equal loudness
  18715. @item c_weighting(f)
  18716. C-weighting of equal loudness.
  18717. @end table
  18718. Default value is @code{sono_v}.
  18719. @item sono_g, gamma
  18720. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18721. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18722. Acceptable range is @code{[1, 7]}.
  18723. @item bar_g, gamma2
  18724. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18725. @code{[1, 7]}.
  18726. @item bar_t
  18727. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18728. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18729. @item timeclamp, tc
  18730. Specify the transform timeclamp. At low frequency, there is trade-off between
  18731. accuracy in time domain and frequency domain. If timeclamp is lower,
  18732. event in time domain is represented more accurately (such as fast bass drum),
  18733. otherwise event in frequency domain is represented more accurately
  18734. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18735. @item attack
  18736. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18737. limits future samples by applying asymmetric windowing in time domain, useful
  18738. when low latency is required. Accepted range is @code{[0, 1]}.
  18739. @item basefreq
  18740. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18741. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18742. @item endfreq
  18743. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18744. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18745. @item coeffclamp
  18746. This option is deprecated and ignored.
  18747. @item tlength
  18748. Specify the transform length in time domain. Use this option to control accuracy
  18749. trade-off between time domain and frequency domain at every frequency sample.
  18750. It can contain variables:
  18751. @table @option
  18752. @item frequency, freq, f
  18753. the frequency where it is evaluated
  18754. @item timeclamp, tc
  18755. the value of @var{timeclamp} option.
  18756. @end table
  18757. Default value is @code{384*tc/(384+tc*f)}.
  18758. @item count
  18759. Specify the transform count for every video frame. Default value is @code{6}.
  18760. Acceptable range is @code{[1, 30]}.
  18761. @item fcount
  18762. Specify the transform count for every single pixel. Default value is @code{0},
  18763. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18764. @item fontfile
  18765. Specify font file for use with freetype to draw the axis. If not specified,
  18766. use embedded font. Note that drawing with font file or embedded font is not
  18767. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18768. option instead.
  18769. @item font
  18770. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18771. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18772. escaping.
  18773. @item fontcolor
  18774. Specify font color expression. This is arithmetic expression that should return
  18775. integer value 0xRRGGBB. It can contain variables:
  18776. @table @option
  18777. @item frequency, freq, f
  18778. the frequency where it is evaluated
  18779. @item timeclamp, tc
  18780. the value of @var{timeclamp} option
  18781. @end table
  18782. and functions:
  18783. @table @option
  18784. @item midi(f)
  18785. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  18786. @item r(x), g(x), b(x)
  18787. red, green, and blue value of intensity x.
  18788. @end table
  18789. Default value is @code{st(0, (midi(f)-59.5)/12);
  18790. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  18791. r(1-ld(1)) + b(ld(1))}.
  18792. @item axisfile
  18793. Specify image file to draw the axis. This option override @var{fontfile} and
  18794. @var{fontcolor} option.
  18795. @item axis, text
  18796. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  18797. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  18798. Default value is @code{1}.
  18799. @item csp
  18800. Set colorspace. The accepted values are:
  18801. @table @samp
  18802. @item unspecified
  18803. Unspecified (default)
  18804. @item bt709
  18805. BT.709
  18806. @item fcc
  18807. FCC
  18808. @item bt470bg
  18809. BT.470BG or BT.601-6 625
  18810. @item smpte170m
  18811. SMPTE-170M or BT.601-6 525
  18812. @item smpte240m
  18813. SMPTE-240M
  18814. @item bt2020ncl
  18815. BT.2020 with non-constant luminance
  18816. @end table
  18817. @item cscheme
  18818. Set spectrogram color scheme. This is list of floating point values with format
  18819. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  18820. The default is @code{1|0.5|0|0|0.5|1}.
  18821. @end table
  18822. @subsection Examples
  18823. @itemize
  18824. @item
  18825. Playing audio while showing the spectrum:
  18826. @example
  18827. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  18828. @end example
  18829. @item
  18830. Same as above, but with frame rate 30 fps:
  18831. @example
  18832. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  18833. @end example
  18834. @item
  18835. Playing at 1280x720:
  18836. @example
  18837. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  18838. @end example
  18839. @item
  18840. Disable sonogram display:
  18841. @example
  18842. sono_h=0
  18843. @end example
  18844. @item
  18845. A1 and its harmonics: A1, A2, (near)E3, A3:
  18846. @example
  18847. 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),
  18848. asplit[a][out1]; [a] showcqt [out0]'
  18849. @end example
  18850. @item
  18851. Same as above, but with more accuracy in frequency domain:
  18852. @example
  18853. 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),
  18854. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  18855. @end example
  18856. @item
  18857. Custom volume:
  18858. @example
  18859. bar_v=10:sono_v=bar_v*a_weighting(f)
  18860. @end example
  18861. @item
  18862. Custom gamma, now spectrum is linear to the amplitude.
  18863. @example
  18864. bar_g=2:sono_g=2
  18865. @end example
  18866. @item
  18867. Custom tlength equation:
  18868. @example
  18869. 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)))'
  18870. @end example
  18871. @item
  18872. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  18873. @example
  18874. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  18875. @end example
  18876. @item
  18877. Custom font using fontconfig:
  18878. @example
  18879. font='Courier New,Monospace,mono|bold'
  18880. @end example
  18881. @item
  18882. Custom frequency range with custom axis using image file:
  18883. @example
  18884. axisfile=myaxis.png:basefreq=40:endfreq=10000
  18885. @end example
  18886. @end itemize
  18887. @section showfreqs
  18888. Convert input audio to video output representing the audio power spectrum.
  18889. Audio amplitude is on Y-axis while frequency is on X-axis.
  18890. The filter accepts the following options:
  18891. @table @option
  18892. @item size, s
  18893. Specify size of video. For the syntax of this option, check the
  18894. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18895. Default is @code{1024x512}.
  18896. @item mode
  18897. Set display mode.
  18898. This set how each frequency bin will be represented.
  18899. It accepts the following values:
  18900. @table @samp
  18901. @item line
  18902. @item bar
  18903. @item dot
  18904. @end table
  18905. Default is @code{bar}.
  18906. @item ascale
  18907. Set amplitude scale.
  18908. It accepts the following values:
  18909. @table @samp
  18910. @item lin
  18911. Linear scale.
  18912. @item sqrt
  18913. Square root scale.
  18914. @item cbrt
  18915. Cubic root scale.
  18916. @item log
  18917. Logarithmic scale.
  18918. @end table
  18919. Default is @code{log}.
  18920. @item fscale
  18921. Set frequency scale.
  18922. It accepts the following values:
  18923. @table @samp
  18924. @item lin
  18925. Linear scale.
  18926. @item log
  18927. Logarithmic scale.
  18928. @item rlog
  18929. Reverse logarithmic scale.
  18930. @end table
  18931. Default is @code{lin}.
  18932. @item win_size
  18933. Set window size. Allowed range is from 16 to 65536.
  18934. Default is @code{2048}
  18935. @item win_func
  18936. Set windowing function.
  18937. It accepts the following values:
  18938. @table @samp
  18939. @item rect
  18940. @item bartlett
  18941. @item hanning
  18942. @item hamming
  18943. @item blackman
  18944. @item welch
  18945. @item flattop
  18946. @item bharris
  18947. @item bnuttall
  18948. @item bhann
  18949. @item sine
  18950. @item nuttall
  18951. @item lanczos
  18952. @item gauss
  18953. @item tukey
  18954. @item dolph
  18955. @item cauchy
  18956. @item parzen
  18957. @item poisson
  18958. @item bohman
  18959. @end table
  18960. Default is @code{hanning}.
  18961. @item overlap
  18962. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18963. which means optimal overlap for selected window function will be picked.
  18964. @item averaging
  18965. Set time averaging. Setting this to 0 will display current maximal peaks.
  18966. Default is @code{1}, which means time averaging is disabled.
  18967. @item colors
  18968. Specify list of colors separated by space or by '|' which will be used to
  18969. draw channel frequencies. Unrecognized or missing colors will be replaced
  18970. by white color.
  18971. @item cmode
  18972. Set channel display mode.
  18973. It accepts the following values:
  18974. @table @samp
  18975. @item combined
  18976. @item separate
  18977. @end table
  18978. Default is @code{combined}.
  18979. @item minamp
  18980. Set minimum amplitude used in @code{log} amplitude scaler.
  18981. @end table
  18982. @section showspatial
  18983. Convert stereo input audio to a video output, representing the spatial relationship
  18984. between two channels.
  18985. The filter accepts the following options:
  18986. @table @option
  18987. @item size, s
  18988. Specify the video size for the output. For the syntax of this option, check the
  18989. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18990. Default value is @code{512x512}.
  18991. @item win_size
  18992. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  18993. @item win_func
  18994. Set window function.
  18995. It accepts the following values:
  18996. @table @samp
  18997. @item rect
  18998. @item bartlett
  18999. @item hann
  19000. @item hanning
  19001. @item hamming
  19002. @item blackman
  19003. @item welch
  19004. @item flattop
  19005. @item bharris
  19006. @item bnuttall
  19007. @item bhann
  19008. @item sine
  19009. @item nuttall
  19010. @item lanczos
  19011. @item gauss
  19012. @item tukey
  19013. @item dolph
  19014. @item cauchy
  19015. @item parzen
  19016. @item poisson
  19017. @item bohman
  19018. @end table
  19019. Default value is @code{hann}.
  19020. @item overlap
  19021. Set ratio of overlap window. Default value is @code{0.5}.
  19022. When value is @code{1} overlap is set to recommended size for specific
  19023. window function currently used.
  19024. @end table
  19025. @anchor{showspectrum}
  19026. @section showspectrum
  19027. Convert input audio to a video output, representing the audio frequency
  19028. spectrum.
  19029. The filter accepts the following options:
  19030. @table @option
  19031. @item size, s
  19032. Specify the video size for the output. For the syntax of this option, check the
  19033. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19034. Default value is @code{640x512}.
  19035. @item slide
  19036. Specify how the spectrum should slide along the window.
  19037. It accepts the following values:
  19038. @table @samp
  19039. @item replace
  19040. the samples start again on the left when they reach the right
  19041. @item scroll
  19042. the samples scroll from right to left
  19043. @item fullframe
  19044. frames are only produced when the samples reach the right
  19045. @item rscroll
  19046. the samples scroll from left to right
  19047. @end table
  19048. Default value is @code{replace}.
  19049. @item mode
  19050. Specify display mode.
  19051. It accepts the following values:
  19052. @table @samp
  19053. @item combined
  19054. all channels are displayed in the same row
  19055. @item separate
  19056. all channels are displayed in separate rows
  19057. @end table
  19058. Default value is @samp{combined}.
  19059. @item color
  19060. Specify display color mode.
  19061. It accepts the following values:
  19062. @table @samp
  19063. @item channel
  19064. each channel is displayed in a separate color
  19065. @item intensity
  19066. each channel is displayed using the same color scheme
  19067. @item rainbow
  19068. each channel is displayed using the rainbow color scheme
  19069. @item moreland
  19070. each channel is displayed using the moreland color scheme
  19071. @item nebulae
  19072. each channel is displayed using the nebulae color scheme
  19073. @item fire
  19074. each channel is displayed using the fire color scheme
  19075. @item fiery
  19076. each channel is displayed using the fiery color scheme
  19077. @item fruit
  19078. each channel is displayed using the fruit color scheme
  19079. @item cool
  19080. each channel is displayed using the cool color scheme
  19081. @item magma
  19082. each channel is displayed using the magma color scheme
  19083. @item green
  19084. each channel is displayed using the green color scheme
  19085. @item viridis
  19086. each channel is displayed using the viridis color scheme
  19087. @item plasma
  19088. each channel is displayed using the plasma color scheme
  19089. @item cividis
  19090. each channel is displayed using the cividis color scheme
  19091. @item terrain
  19092. each channel is displayed using the terrain color scheme
  19093. @end table
  19094. Default value is @samp{channel}.
  19095. @item scale
  19096. Specify scale used for calculating intensity color values.
  19097. It accepts the following values:
  19098. @table @samp
  19099. @item lin
  19100. linear
  19101. @item sqrt
  19102. square root, default
  19103. @item cbrt
  19104. cubic root
  19105. @item log
  19106. logarithmic
  19107. @item 4thrt
  19108. 4th root
  19109. @item 5thrt
  19110. 5th root
  19111. @end table
  19112. Default value is @samp{sqrt}.
  19113. @item fscale
  19114. Specify frequency scale.
  19115. It accepts the following values:
  19116. @table @samp
  19117. @item lin
  19118. linear
  19119. @item log
  19120. logarithmic
  19121. @end table
  19122. Default value is @samp{lin}.
  19123. @item saturation
  19124. Set saturation modifier for displayed colors. Negative values provide
  19125. alternative color scheme. @code{0} is no saturation at all.
  19126. Saturation must be in [-10.0, 10.0] range.
  19127. Default value is @code{1}.
  19128. @item win_func
  19129. Set window function.
  19130. It accepts the following values:
  19131. @table @samp
  19132. @item rect
  19133. @item bartlett
  19134. @item hann
  19135. @item hanning
  19136. @item hamming
  19137. @item blackman
  19138. @item welch
  19139. @item flattop
  19140. @item bharris
  19141. @item bnuttall
  19142. @item bhann
  19143. @item sine
  19144. @item nuttall
  19145. @item lanczos
  19146. @item gauss
  19147. @item tukey
  19148. @item dolph
  19149. @item cauchy
  19150. @item parzen
  19151. @item poisson
  19152. @item bohman
  19153. @end table
  19154. Default value is @code{hann}.
  19155. @item orientation
  19156. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19157. @code{horizontal}. Default is @code{vertical}.
  19158. @item overlap
  19159. Set ratio of overlap window. Default value is @code{0}.
  19160. When value is @code{1} overlap is set to recommended size for specific
  19161. window function currently used.
  19162. @item gain
  19163. Set scale gain for calculating intensity color values.
  19164. Default value is @code{1}.
  19165. @item data
  19166. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19167. @item rotation
  19168. Set color rotation, must be in [-1.0, 1.0] range.
  19169. Default value is @code{0}.
  19170. @item start
  19171. Set start frequency from which to display spectrogram. Default is @code{0}.
  19172. @item stop
  19173. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19174. @item fps
  19175. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19176. @item legend
  19177. Draw time and frequency axes and legends. Default is disabled.
  19178. @end table
  19179. The usage is very similar to the showwaves filter; see the examples in that
  19180. section.
  19181. @subsection Examples
  19182. @itemize
  19183. @item
  19184. Large window with logarithmic color scaling:
  19185. @example
  19186. showspectrum=s=1280x480:scale=log
  19187. @end example
  19188. @item
  19189. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19190. @example
  19191. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19192. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19193. @end example
  19194. @end itemize
  19195. @section showspectrumpic
  19196. Convert input audio to a single video frame, representing the audio frequency
  19197. spectrum.
  19198. The filter accepts the following options:
  19199. @table @option
  19200. @item size, s
  19201. Specify the video size for the output. For the syntax of this option, check the
  19202. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19203. Default value is @code{4096x2048}.
  19204. @item mode
  19205. Specify display mode.
  19206. It accepts the following values:
  19207. @table @samp
  19208. @item combined
  19209. all channels are displayed in the same row
  19210. @item separate
  19211. all channels are displayed in separate rows
  19212. @end table
  19213. Default value is @samp{combined}.
  19214. @item color
  19215. Specify display color mode.
  19216. It accepts the following values:
  19217. @table @samp
  19218. @item channel
  19219. each channel is displayed in a separate color
  19220. @item intensity
  19221. each channel is displayed using the same color scheme
  19222. @item rainbow
  19223. each channel is displayed using the rainbow color scheme
  19224. @item moreland
  19225. each channel is displayed using the moreland color scheme
  19226. @item nebulae
  19227. each channel is displayed using the nebulae color scheme
  19228. @item fire
  19229. each channel is displayed using the fire color scheme
  19230. @item fiery
  19231. each channel is displayed using the fiery color scheme
  19232. @item fruit
  19233. each channel is displayed using the fruit color scheme
  19234. @item cool
  19235. each channel is displayed using the cool color scheme
  19236. @item magma
  19237. each channel is displayed using the magma color scheme
  19238. @item green
  19239. each channel is displayed using the green color scheme
  19240. @item viridis
  19241. each channel is displayed using the viridis color scheme
  19242. @item plasma
  19243. each channel is displayed using the plasma color scheme
  19244. @item cividis
  19245. each channel is displayed using the cividis color scheme
  19246. @item terrain
  19247. each channel is displayed using the terrain color scheme
  19248. @end table
  19249. Default value is @samp{intensity}.
  19250. @item scale
  19251. Specify scale used for calculating intensity color values.
  19252. It accepts the following values:
  19253. @table @samp
  19254. @item lin
  19255. linear
  19256. @item sqrt
  19257. square root, default
  19258. @item cbrt
  19259. cubic root
  19260. @item log
  19261. logarithmic
  19262. @item 4thrt
  19263. 4th root
  19264. @item 5thrt
  19265. 5th root
  19266. @end table
  19267. Default value is @samp{log}.
  19268. @item fscale
  19269. Specify frequency scale.
  19270. It accepts the following values:
  19271. @table @samp
  19272. @item lin
  19273. linear
  19274. @item log
  19275. logarithmic
  19276. @end table
  19277. Default value is @samp{lin}.
  19278. @item saturation
  19279. Set saturation modifier for displayed colors. Negative values provide
  19280. alternative color scheme. @code{0} is no saturation at all.
  19281. Saturation must be in [-10.0, 10.0] range.
  19282. Default value is @code{1}.
  19283. @item win_func
  19284. Set window function.
  19285. It accepts the following values:
  19286. @table @samp
  19287. @item rect
  19288. @item bartlett
  19289. @item hann
  19290. @item hanning
  19291. @item hamming
  19292. @item blackman
  19293. @item welch
  19294. @item flattop
  19295. @item bharris
  19296. @item bnuttall
  19297. @item bhann
  19298. @item sine
  19299. @item nuttall
  19300. @item lanczos
  19301. @item gauss
  19302. @item tukey
  19303. @item dolph
  19304. @item cauchy
  19305. @item parzen
  19306. @item poisson
  19307. @item bohman
  19308. @end table
  19309. Default value is @code{hann}.
  19310. @item orientation
  19311. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19312. @code{horizontal}. Default is @code{vertical}.
  19313. @item gain
  19314. Set scale gain for calculating intensity color values.
  19315. Default value is @code{1}.
  19316. @item legend
  19317. Draw time and frequency axes and legends. Default is enabled.
  19318. @item rotation
  19319. Set color rotation, must be in [-1.0, 1.0] range.
  19320. Default value is @code{0}.
  19321. @item start
  19322. Set start frequency from which to display spectrogram. Default is @code{0}.
  19323. @item stop
  19324. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19325. @end table
  19326. @subsection Examples
  19327. @itemize
  19328. @item
  19329. Extract an audio spectrogram of a whole audio track
  19330. in a 1024x1024 picture using @command{ffmpeg}:
  19331. @example
  19332. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19333. @end example
  19334. @end itemize
  19335. @section showvolume
  19336. Convert input audio volume to a video output.
  19337. The filter accepts the following options:
  19338. @table @option
  19339. @item rate, r
  19340. Set video rate.
  19341. @item b
  19342. Set border width, allowed range is [0, 5]. Default is 1.
  19343. @item w
  19344. Set channel width, allowed range is [80, 8192]. Default is 400.
  19345. @item h
  19346. Set channel height, allowed range is [1, 900]. Default is 20.
  19347. @item f
  19348. Set fade, allowed range is [0, 1]. Default is 0.95.
  19349. @item c
  19350. Set volume color expression.
  19351. The expression can use the following variables:
  19352. @table @option
  19353. @item VOLUME
  19354. Current max volume of channel in dB.
  19355. @item PEAK
  19356. Current peak.
  19357. @item CHANNEL
  19358. Current channel number, starting from 0.
  19359. @end table
  19360. @item t
  19361. If set, displays channel names. Default is enabled.
  19362. @item v
  19363. If set, displays volume values. Default is enabled.
  19364. @item o
  19365. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19366. default is @code{h}.
  19367. @item s
  19368. Set step size, allowed range is [0, 5]. Default is 0, which means
  19369. step is disabled.
  19370. @item p
  19371. Set background opacity, allowed range is [0, 1]. Default is 0.
  19372. @item m
  19373. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19374. default is @code{p}.
  19375. @item ds
  19376. Set display scale, can be linear: @code{lin} or log: @code{log},
  19377. default is @code{lin}.
  19378. @item dm
  19379. In second.
  19380. If set to > 0., display a line for the max level
  19381. in the previous seconds.
  19382. default is disabled: @code{0.}
  19383. @item dmc
  19384. The color of the max line. Use when @code{dm} option is set to > 0.
  19385. default is: @code{orange}
  19386. @end table
  19387. @section showwaves
  19388. Convert input audio to a video output, representing the samples waves.
  19389. The filter accepts the following options:
  19390. @table @option
  19391. @item size, s
  19392. Specify the video size for the output. For the syntax of this option, check the
  19393. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19394. Default value is @code{600x240}.
  19395. @item mode
  19396. Set display mode.
  19397. Available values are:
  19398. @table @samp
  19399. @item point
  19400. Draw a point for each sample.
  19401. @item line
  19402. Draw a vertical line for each sample.
  19403. @item p2p
  19404. Draw a point for each sample and a line between them.
  19405. @item cline
  19406. Draw a centered vertical line for each sample.
  19407. @end table
  19408. Default value is @code{point}.
  19409. @item n
  19410. Set the number of samples which are printed on the same column. A
  19411. larger value will decrease the frame rate. Must be a positive
  19412. integer. This option can be set only if the value for @var{rate}
  19413. is not explicitly specified.
  19414. @item rate, r
  19415. Set the (approximate) output frame rate. This is done by setting the
  19416. option @var{n}. Default value is "25".
  19417. @item split_channels
  19418. Set if channels should be drawn separately or overlap. Default value is 0.
  19419. @item colors
  19420. Set colors separated by '|' which are going to be used for drawing of each channel.
  19421. @item scale
  19422. Set amplitude scale.
  19423. Available values are:
  19424. @table @samp
  19425. @item lin
  19426. Linear.
  19427. @item log
  19428. Logarithmic.
  19429. @item sqrt
  19430. Square root.
  19431. @item cbrt
  19432. Cubic root.
  19433. @end table
  19434. Default is linear.
  19435. @item draw
  19436. Set the draw mode. This is mostly useful to set for high @var{n}.
  19437. Available values are:
  19438. @table @samp
  19439. @item scale
  19440. Scale pixel values for each drawn sample.
  19441. @item full
  19442. Draw every sample directly.
  19443. @end table
  19444. Default value is @code{scale}.
  19445. @end table
  19446. @subsection Examples
  19447. @itemize
  19448. @item
  19449. Output the input file audio and the corresponding video representation
  19450. at the same time:
  19451. @example
  19452. amovie=a.mp3,asplit[out0],showwaves[out1]
  19453. @end example
  19454. @item
  19455. Create a synthetic signal and show it with showwaves, forcing a
  19456. frame rate of 30 frames per second:
  19457. @example
  19458. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19459. @end example
  19460. @end itemize
  19461. @section showwavespic
  19462. Convert input audio to a single video frame, representing the samples waves.
  19463. The filter accepts the following options:
  19464. @table @option
  19465. @item size, s
  19466. Specify the video size for the output. For the syntax of this option, check the
  19467. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19468. Default value is @code{600x240}.
  19469. @item split_channels
  19470. Set if channels should be drawn separately or overlap. Default value is 0.
  19471. @item colors
  19472. Set colors separated by '|' which are going to be used for drawing of each channel.
  19473. @item scale
  19474. Set amplitude scale.
  19475. Available values are:
  19476. @table @samp
  19477. @item lin
  19478. Linear.
  19479. @item log
  19480. Logarithmic.
  19481. @item sqrt
  19482. Square root.
  19483. @item cbrt
  19484. Cubic root.
  19485. @end table
  19486. Default is linear.
  19487. @item draw
  19488. Set the draw mode.
  19489. Available values are:
  19490. @table @samp
  19491. @item scale
  19492. Scale pixel values for each drawn sample.
  19493. @item full
  19494. Draw every sample directly.
  19495. @end table
  19496. Default value is @code{scale}.
  19497. @item filter
  19498. Set the filter mode.
  19499. Available values are:
  19500. @table @samp
  19501. @item average
  19502. Use average samples values for each drawn sample.
  19503. @item peak
  19504. Use peak samples values for each drawn sample.
  19505. @end table
  19506. Default value is @code{average}.
  19507. @end table
  19508. @subsection Examples
  19509. @itemize
  19510. @item
  19511. Extract a channel split representation of the wave form of a whole audio track
  19512. in a 1024x800 picture using @command{ffmpeg}:
  19513. @example
  19514. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19515. @end example
  19516. @end itemize
  19517. @section sidedata, asidedata
  19518. Delete frame side data, or select frames based on it.
  19519. This filter accepts the following options:
  19520. @table @option
  19521. @item mode
  19522. Set mode of operation of the filter.
  19523. Can be one of the following:
  19524. @table @samp
  19525. @item select
  19526. Select every frame with side data of @code{type}.
  19527. @item delete
  19528. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19529. data in the frame.
  19530. @end table
  19531. @item type
  19532. Set side data type used with all modes. Must be set for @code{select} mode. For
  19533. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19534. in @file{libavutil/frame.h}. For example, to choose
  19535. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19536. @end table
  19537. @section spectrumsynth
  19538. Synthesize audio from 2 input video spectrums, first input stream represents
  19539. magnitude across time and second represents phase across time.
  19540. The filter will transform from frequency domain as displayed in videos back
  19541. to time domain as presented in audio output.
  19542. This filter is primarily created for reversing processed @ref{showspectrum}
  19543. filter outputs, but can synthesize sound from other spectrograms too.
  19544. But in such case results are going to be poor if the phase data is not
  19545. available, because in such cases phase data need to be recreated, usually
  19546. it's just recreated from random noise.
  19547. For best results use gray only output (@code{channel} color mode in
  19548. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19549. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19550. @code{data} option. Inputs videos should generally use @code{fullframe}
  19551. slide mode as that saves resources needed for decoding video.
  19552. The filter accepts the following options:
  19553. @table @option
  19554. @item sample_rate
  19555. Specify sample rate of output audio, the sample rate of audio from which
  19556. spectrum was generated may differ.
  19557. @item channels
  19558. Set number of channels represented in input video spectrums.
  19559. @item scale
  19560. Set scale which was used when generating magnitude input spectrum.
  19561. Can be @code{lin} or @code{log}. Default is @code{log}.
  19562. @item slide
  19563. Set slide which was used when generating inputs spectrums.
  19564. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19565. Default is @code{fullframe}.
  19566. @item win_func
  19567. Set window function used for resynthesis.
  19568. @item overlap
  19569. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19570. which means optimal overlap for selected window function will be picked.
  19571. @item orientation
  19572. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19573. Default is @code{vertical}.
  19574. @end table
  19575. @subsection Examples
  19576. @itemize
  19577. @item
  19578. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19579. then resynthesize videos back to audio with spectrumsynth:
  19580. @example
  19581. 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
  19582. 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
  19583. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19584. @end example
  19585. @end itemize
  19586. @section split, asplit
  19587. Split input into several identical outputs.
  19588. @code{asplit} works with audio input, @code{split} with video.
  19589. The filter accepts a single parameter which specifies the number of outputs. If
  19590. unspecified, it defaults to 2.
  19591. @subsection Examples
  19592. @itemize
  19593. @item
  19594. Create two separate outputs from the same input:
  19595. @example
  19596. [in] split [out0][out1]
  19597. @end example
  19598. @item
  19599. To create 3 or more outputs, you need to specify the number of
  19600. outputs, like in:
  19601. @example
  19602. [in] asplit=3 [out0][out1][out2]
  19603. @end example
  19604. @item
  19605. Create two separate outputs from the same input, one cropped and
  19606. one padded:
  19607. @example
  19608. [in] split [splitout1][splitout2];
  19609. [splitout1] crop=100:100:0:0 [cropout];
  19610. [splitout2] pad=200:200:100:100 [padout];
  19611. @end example
  19612. @item
  19613. Create 5 copies of the input audio with @command{ffmpeg}:
  19614. @example
  19615. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19616. @end example
  19617. @end itemize
  19618. @section zmq, azmq
  19619. Receive commands sent through a libzmq client, and forward them to
  19620. filters in the filtergraph.
  19621. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19622. must be inserted between two video filters, @code{azmq} between two
  19623. audio filters. Both are capable to send messages to any filter type.
  19624. To enable these filters you need to install the libzmq library and
  19625. headers and configure FFmpeg with @code{--enable-libzmq}.
  19626. For more information about libzmq see:
  19627. @url{http://www.zeromq.org/}
  19628. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19629. receives messages sent through a network interface defined by the
  19630. @option{bind_address} (or the abbreviation "@option{b}") option.
  19631. Default value of this option is @file{tcp://localhost:5555}. You may
  19632. want to alter this value to your needs, but do not forget to escape any
  19633. ':' signs (see @ref{filtergraph escaping}).
  19634. The received message must be in the form:
  19635. @example
  19636. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19637. @end example
  19638. @var{TARGET} specifies the target of the command, usually the name of
  19639. the filter class or a specific filter instance name. The default
  19640. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19641. but you can override this by using the @samp{filter_name@@id} syntax
  19642. (see @ref{Filtergraph syntax}).
  19643. @var{COMMAND} specifies the name of the command for the target filter.
  19644. @var{ARG} is optional and specifies the optional argument list for the
  19645. given @var{COMMAND}.
  19646. Upon reception, the message is processed and the corresponding command
  19647. is injected into the filtergraph. Depending on the result, the filter
  19648. will send a reply to the client, adopting the format:
  19649. @example
  19650. @var{ERROR_CODE} @var{ERROR_REASON}
  19651. @var{MESSAGE}
  19652. @end example
  19653. @var{MESSAGE} is optional.
  19654. @subsection Examples
  19655. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19656. be used to send commands processed by these filters.
  19657. Consider the following filtergraph generated by @command{ffplay}.
  19658. In this example the last overlay filter has an instance name. All other
  19659. filters will have default instance names.
  19660. @example
  19661. ffplay -dumpgraph 1 -f lavfi "
  19662. color=s=100x100:c=red [l];
  19663. color=s=100x100:c=blue [r];
  19664. nullsrc=s=200x100, zmq [bg];
  19665. [bg][l] overlay [bg+l];
  19666. [bg+l][r] overlay@@my=x=100 "
  19667. @end example
  19668. To change the color of the left side of the video, the following
  19669. command can be used:
  19670. @example
  19671. echo Parsed_color_0 c yellow | tools/zmqsend
  19672. @end example
  19673. To change the right side:
  19674. @example
  19675. echo Parsed_color_1 c pink | tools/zmqsend
  19676. @end example
  19677. To change the position of the right side:
  19678. @example
  19679. echo overlay@@my x 150 | tools/zmqsend
  19680. @end example
  19681. @c man end MULTIMEDIA FILTERS
  19682. @chapter Multimedia Sources
  19683. @c man begin MULTIMEDIA SOURCES
  19684. Below is a description of the currently available multimedia sources.
  19685. @section amovie
  19686. This is the same as @ref{movie} source, except it selects an audio
  19687. stream by default.
  19688. @anchor{movie}
  19689. @section movie
  19690. Read audio and/or video stream(s) from a movie container.
  19691. It accepts the following parameters:
  19692. @table @option
  19693. @item filename
  19694. The name of the resource to read (not necessarily a file; it can also be a
  19695. device or a stream accessed through some protocol).
  19696. @item format_name, f
  19697. Specifies the format assumed for the movie to read, and can be either
  19698. the name of a container or an input device. If not specified, the
  19699. format is guessed from @var{movie_name} or by probing.
  19700. @item seek_point, sp
  19701. Specifies the seek point in seconds. The frames will be output
  19702. starting from this seek point. The parameter is evaluated with
  19703. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19704. postfix. The default value is "0".
  19705. @item streams, s
  19706. Specifies the streams to read. Several streams can be specified,
  19707. separated by "+". The source will then have as many outputs, in the
  19708. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19709. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19710. respectively the default (best suited) video and audio stream. Default
  19711. is "dv", or "da" if the filter is called as "amovie".
  19712. @item stream_index, si
  19713. Specifies the index of the video stream to read. If the value is -1,
  19714. the most suitable video stream will be automatically selected. The default
  19715. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19716. audio instead of video.
  19717. @item loop
  19718. Specifies how many times to read the stream in sequence.
  19719. If the value is 0, the stream will be looped infinitely.
  19720. Default value is "1".
  19721. Note that when the movie is looped the source timestamps are not
  19722. changed, so it will generate non monotonically increasing timestamps.
  19723. @item discontinuity
  19724. Specifies the time difference between frames above which the point is
  19725. considered a timestamp discontinuity which is removed by adjusting the later
  19726. timestamps.
  19727. @end table
  19728. It allows overlaying a second video on top of the main input of
  19729. a filtergraph, as shown in this graph:
  19730. @example
  19731. input -----------> deltapts0 --> overlay --> output
  19732. ^
  19733. |
  19734. movie --> scale--> deltapts1 -------+
  19735. @end example
  19736. @subsection Examples
  19737. @itemize
  19738. @item
  19739. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19740. on top of the input labelled "in":
  19741. @example
  19742. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19743. [in] setpts=PTS-STARTPTS [main];
  19744. [main][over] overlay=16:16 [out]
  19745. @end example
  19746. @item
  19747. Read from a video4linux2 device, and overlay it on top of the input
  19748. labelled "in":
  19749. @example
  19750. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19751. [in] setpts=PTS-STARTPTS [main];
  19752. [main][over] overlay=16:16 [out]
  19753. @end example
  19754. @item
  19755. Read the first video stream and the audio stream with id 0x81 from
  19756. dvd.vob; the video is connected to the pad named "video" and the audio is
  19757. connected to the pad named "audio":
  19758. @example
  19759. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19760. @end example
  19761. @end itemize
  19762. @subsection Commands
  19763. Both movie and amovie support the following commands:
  19764. @table @option
  19765. @item seek
  19766. Perform seek using "av_seek_frame".
  19767. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19768. @itemize
  19769. @item
  19770. @var{stream_index}: If stream_index is -1, a default
  19771. stream is selected, and @var{timestamp} is automatically converted
  19772. from AV_TIME_BASE units to the stream specific time_base.
  19773. @item
  19774. @var{timestamp}: Timestamp in AVStream.time_base units
  19775. or, if no stream is specified, in AV_TIME_BASE units.
  19776. @item
  19777. @var{flags}: Flags which select direction and seeking mode.
  19778. @end itemize
  19779. @item get_duration
  19780. Get movie duration in AV_TIME_BASE units.
  19781. @end table
  19782. @c man end MULTIMEDIA SOURCES