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.

26707 lines
708KB

  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 for each band split. This controls filter roll-off or steepness
  413. of filter transfer function.
  414. Available values are:
  415. @table @samp
  416. @item 2nd
  417. 12 dB per octave.
  418. @item 4th
  419. 24 dB per octave.
  420. @item 6th
  421. 36 dB per octave.
  422. @item 8th
  423. 48 dB per octave.
  424. @item 10th
  425. 60 dB per octave.
  426. @item 12th
  427. 72 dB per octave.
  428. @item 14th
  429. 84 dB per octave.
  430. @item 16th
  431. 96 dB per octave.
  432. @item 18th
  433. 108 dB per octave.
  434. @item 20th
  435. 120 dB per octave.
  436. @end table
  437. Default is @var{4th}.
  438. @item level
  439. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  440. @item gains
  441. Set output gain for each band. Default value is 1 for all bands.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  447. each band will be in separate stream:
  448. @example
  449. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  450. @end example
  451. @item
  452. Same as above, but with higher filter order:
  453. @example
  454. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  455. @end example
  456. @item
  457. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  458. @example
  459. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500 8000:order=8th[LOW][MID][HIGH]' -map '[LOW]' low.wav -map '[MID]' mid.wav -map '[HIGH]' high.wav
  460. @end example
  461. @end itemize
  462. @section acrusher
  463. Reduce audio bit resolution.
  464. This filter is bit crusher with enhanced functionality. A bit crusher
  465. is used to audibly reduce number of bits an audio signal is sampled
  466. with. This doesn't change the bit depth at all, it just produces the
  467. effect. Material reduced in bit depth sounds more harsh and "digital".
  468. This filter is able to even round to continuous values instead of discrete
  469. bit depths.
  470. Additionally it has a D/C offset which results in different crushing of
  471. the lower and the upper half of the signal.
  472. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  473. Another feature of this filter is the logarithmic mode.
  474. This setting switches from linear distances between bits to logarithmic ones.
  475. The result is a much more "natural" sounding crusher which doesn't gate low
  476. signals for example. The human ear has a logarithmic perception,
  477. so this kind of crushing is much more pleasant.
  478. Logarithmic crushing is also able to get anti-aliased.
  479. The filter accepts the following options:
  480. @table @option
  481. @item level_in
  482. Set level in.
  483. @item level_out
  484. Set level out.
  485. @item bits
  486. Set bit reduction.
  487. @item mix
  488. Set mixing amount.
  489. @item mode
  490. Can be linear: @code{lin} or logarithmic: @code{log}.
  491. @item dc
  492. Set DC.
  493. @item aa
  494. Set anti-aliasing.
  495. @item samples
  496. Set sample reduction.
  497. @item lfo
  498. Enable LFO. By default disabled.
  499. @item lforange
  500. Set LFO range.
  501. @item lforate
  502. Set LFO rate.
  503. @end table
  504. @section acue
  505. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  506. filter.
  507. @section adeclick
  508. Remove impulsive noise from input audio.
  509. Samples detected as impulsive noise are replaced by interpolated samples using
  510. autoregressive modelling.
  511. @table @option
  512. @item w
  513. Set window size, in milliseconds. Allowed range is from @code{10} to
  514. @code{100}. Default value is @code{55} milliseconds.
  515. This sets size of window which will be processed at once.
  516. @item o
  517. Set window overlap, in percentage of window size. Allowed range is from
  518. @code{50} to @code{95}. Default value is @code{75} percent.
  519. Setting this to a very high value increases impulsive noise removal but makes
  520. whole process much slower.
  521. @item a
  522. Set autoregression order, in percentage of window size. Allowed range is from
  523. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  524. controls quality of interpolated samples using neighbour good samples.
  525. @item t
  526. Set threshold value. Allowed range is from @code{1} to @code{100}.
  527. Default value is @code{2}.
  528. This controls the strength of impulsive noise which is going to be removed.
  529. The lower value, the more samples will be detected as impulsive noise.
  530. @item b
  531. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  532. @code{10}. Default value is @code{2}.
  533. If any two samples detected as noise are spaced less than this value then any
  534. sample between those two samples will be also detected as noise.
  535. @item m
  536. Set overlap method.
  537. It accepts the following values:
  538. @table @option
  539. @item a
  540. Select overlap-add method. Even not interpolated samples are slightly
  541. changed with this method.
  542. @item s
  543. Select overlap-save method. Not interpolated samples remain unchanged.
  544. @end table
  545. Default value is @code{a}.
  546. @end table
  547. @section adeclip
  548. Remove clipped samples from input audio.
  549. Samples detected as clipped are replaced by interpolated samples using
  550. autoregressive modelling.
  551. @table @option
  552. @item w
  553. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  554. Default value is @code{55} milliseconds.
  555. This sets size of window which will be processed at once.
  556. @item o
  557. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  558. to @code{95}. Default value is @code{75} percent.
  559. @item a
  560. Set autoregression order, in percentage of window size. Allowed range is from
  561. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  562. quality of interpolated samples using neighbour good samples.
  563. @item t
  564. Set threshold value. Allowed range is from @code{1} to @code{100}.
  565. Default value is @code{10}. Higher values make clip detection less aggressive.
  566. @item n
  567. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  568. Default value is @code{1000}. Higher values make clip detection less aggressive.
  569. @item m
  570. Set overlap method.
  571. It accepts the following values:
  572. @table @option
  573. @item a
  574. Select overlap-add method. Even not interpolated samples are slightly changed
  575. with this method.
  576. @item s
  577. Select overlap-save method. Not interpolated samples remain unchanged.
  578. @end table
  579. Default value is @code{a}.
  580. @end table
  581. @section adelay
  582. Delay one or more audio channels.
  583. Samples in delayed channel are filled with silence.
  584. The filter accepts the following option:
  585. @table @option
  586. @item delays
  587. Set list of delays in milliseconds for each channel separated by '|'.
  588. Unused delays will be silently ignored. If number of given delays is
  589. smaller than number of channels all remaining channels will not be delayed.
  590. If you want to delay exact number of samples, append 'S' to number.
  591. If you want instead to delay in seconds, append 's' to number.
  592. @item all
  593. Use last set delay for all remaining channels. By default is disabled.
  594. This option if enabled changes how option @code{delays} is interpreted.
  595. @end table
  596. @subsection Examples
  597. @itemize
  598. @item
  599. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  600. the second channel (and any other channels that may be present) unchanged.
  601. @example
  602. adelay=1500|0|500
  603. @end example
  604. @item
  605. Delay second channel by 500 samples, the third channel by 700 samples and leave
  606. the first channel (and any other channels that may be present) unchanged.
  607. @example
  608. adelay=0|500S|700S
  609. @end example
  610. @item
  611. Delay all channels by same number of samples:
  612. @example
  613. adelay=delays=64S:all=1
  614. @end example
  615. @end itemize
  616. @section adenorm
  617. Remedy denormals in audio by adding extremely low-level noise.
  618. This filter shall be placed before any filter that can produce denormals.
  619. A description of the accepted parameters follows.
  620. @table @option
  621. @item level
  622. Set level of added noise in dB. Default is @code{-351}.
  623. Allowed range is from -451 to -90.
  624. @item type
  625. Set type of added noise.
  626. @table @option
  627. @item dc
  628. Add DC signal.
  629. @item ac
  630. Add AC signal.
  631. @item square
  632. Add square signal.
  633. @item pulse
  634. Add pulse signal.
  635. @end table
  636. Default is @code{dc}.
  637. @end table
  638. @subsection Commands
  639. This filter supports the all above options as @ref{commands}.
  640. @section aderivative, aintegral
  641. Compute derivative/integral of audio stream.
  642. Applying both filters one after another produces original audio.
  643. @section aecho
  644. Apply echoing to the input audio.
  645. Echoes are reflected sound and can occur naturally amongst mountains
  646. (and sometimes large buildings) when talking or shouting; digital echo
  647. effects emulate this behaviour and are often used to help fill out the
  648. sound of a single instrument or vocal. The time difference between the
  649. original signal and the reflection is the @code{delay}, and the
  650. loudness of the reflected signal is the @code{decay}.
  651. Multiple echoes can have different delays and decays.
  652. A description of the accepted parameters follows.
  653. @table @option
  654. @item in_gain
  655. Set input gain of reflected signal. Default is @code{0.6}.
  656. @item out_gain
  657. Set output gain of reflected signal. Default is @code{0.3}.
  658. @item delays
  659. Set list of time intervals in milliseconds between original signal and reflections
  660. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  661. Default is @code{1000}.
  662. @item decays
  663. Set list of loudness of reflected signals separated by '|'.
  664. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  665. Default is @code{0.5}.
  666. @end table
  667. @subsection Examples
  668. @itemize
  669. @item
  670. Make it sound as if there are twice as many instruments as are actually playing:
  671. @example
  672. aecho=0.8:0.88:60:0.4
  673. @end example
  674. @item
  675. If delay is very short, then it sounds like a (metallic) robot playing music:
  676. @example
  677. aecho=0.8:0.88:6:0.4
  678. @end example
  679. @item
  680. A longer delay will sound like an open air concert in the mountains:
  681. @example
  682. aecho=0.8:0.9:1000:0.3
  683. @end example
  684. @item
  685. Same as above but with one more mountain:
  686. @example
  687. aecho=0.8:0.9:1000|1800:0.3|0.25
  688. @end example
  689. @end itemize
  690. @section aemphasis
  691. Audio emphasis filter creates or restores material directly taken from LPs or
  692. emphased CDs with different filter curves. E.g. to store music on vinyl the
  693. signal has to be altered by a filter first to even out the disadvantages of
  694. this recording medium.
  695. Once the material is played back the inverse filter has to be applied to
  696. restore the distortion of the frequency response.
  697. The filter accepts the following options:
  698. @table @option
  699. @item level_in
  700. Set input gain.
  701. @item level_out
  702. Set output gain.
  703. @item mode
  704. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  705. use @code{production} mode. Default is @code{reproduction} mode.
  706. @item type
  707. Set filter type. Selects medium. Can be one of the following:
  708. @table @option
  709. @item col
  710. select Columbia.
  711. @item emi
  712. select EMI.
  713. @item bsi
  714. select BSI (78RPM).
  715. @item riaa
  716. select RIAA.
  717. @item cd
  718. select Compact Disc (CD).
  719. @item 50fm
  720. select 50µs (FM).
  721. @item 75fm
  722. select 75µs (FM).
  723. @item 50kf
  724. select 50µs (FM-KF).
  725. @item 75kf
  726. select 75µs (FM-KF).
  727. @end table
  728. @end table
  729. @subsection Commands
  730. This filter supports the all above options as @ref{commands}.
  731. @section aeval
  732. Modify an audio signal according to the specified expressions.
  733. This filter accepts one or more expressions (one for each channel),
  734. which are evaluated and used to modify a corresponding audio signal.
  735. It accepts the following parameters:
  736. @table @option
  737. @item exprs
  738. Set the '|'-separated expressions list for each separate channel. If
  739. the number of input channels is greater than the number of
  740. expressions, the last specified expression is used for the remaining
  741. output channels.
  742. @item channel_layout, c
  743. Set output channel layout. If not specified, the channel layout is
  744. specified by the number of expressions. If set to @samp{same}, it will
  745. use by default the same input channel layout.
  746. @end table
  747. Each expression in @var{exprs} can contain the following constants and functions:
  748. @table @option
  749. @item ch
  750. channel number of the current expression
  751. @item n
  752. number of the evaluated sample, starting from 0
  753. @item s
  754. sample rate
  755. @item t
  756. time of the evaluated sample expressed in seconds
  757. @item nb_in_channels
  758. @item nb_out_channels
  759. input and output number of channels
  760. @item val(CH)
  761. the value of input channel with number @var{CH}
  762. @end table
  763. Note: this filter is slow. For faster processing you should use a
  764. dedicated filter.
  765. @subsection Examples
  766. @itemize
  767. @item
  768. Half volume:
  769. @example
  770. aeval=val(ch)/2:c=same
  771. @end example
  772. @item
  773. Invert phase of the second channel:
  774. @example
  775. aeval=val(0)|-val(1)
  776. @end example
  777. @end itemize
  778. @anchor{afade}
  779. @section afade
  780. Apply fade-in/out effect to input audio.
  781. A description of the accepted parameters follows.
  782. @table @option
  783. @item type, t
  784. Specify the effect type, can be either @code{in} for fade-in, or
  785. @code{out} for a fade-out effect. Default is @code{in}.
  786. @item start_sample, ss
  787. Specify the number of the start sample for starting to apply the fade
  788. effect. Default is 0.
  789. @item nb_samples, ns
  790. Specify the number of samples for which the fade effect has to last. At
  791. the end of the fade-in effect the output audio will have the same
  792. volume as the input audio, at the end of the fade-out transition
  793. the output audio will be silence. Default is 44100.
  794. @item start_time, st
  795. Specify the start time of the fade effect. Default is 0.
  796. The value must be specified as a time duration; see
  797. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  798. for the accepted syntax.
  799. If set this option is used instead of @var{start_sample}.
  800. @item duration, d
  801. Specify the duration of the fade effect. See
  802. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  803. for the accepted syntax.
  804. At the end of the fade-in effect the output audio will have the same
  805. volume as the input audio, at the end of the fade-out transition
  806. the output audio will be silence.
  807. By default the duration is determined by @var{nb_samples}.
  808. If set this option is used instead of @var{nb_samples}.
  809. @item curve
  810. Set curve for fade transition.
  811. It accepts the following values:
  812. @table @option
  813. @item tri
  814. select triangular, linear slope (default)
  815. @item qsin
  816. select quarter of sine wave
  817. @item hsin
  818. select half of sine wave
  819. @item esin
  820. select exponential sine wave
  821. @item log
  822. select logarithmic
  823. @item ipar
  824. select inverted parabola
  825. @item qua
  826. select quadratic
  827. @item cub
  828. select cubic
  829. @item squ
  830. select square root
  831. @item cbr
  832. select cubic root
  833. @item par
  834. select parabola
  835. @item exp
  836. select exponential
  837. @item iqsin
  838. select inverted quarter of sine wave
  839. @item ihsin
  840. select inverted half of sine wave
  841. @item dese
  842. select double-exponential seat
  843. @item desi
  844. select double-exponential sigmoid
  845. @item losi
  846. select logistic sigmoid
  847. @item sinc
  848. select sine cardinal function
  849. @item isinc
  850. select inverted sine cardinal function
  851. @item nofade
  852. no fade applied
  853. @end table
  854. @end table
  855. @subsection Commands
  856. This filter supports the all above options as @ref{commands}.
  857. @subsection Examples
  858. @itemize
  859. @item
  860. Fade in first 15 seconds of audio:
  861. @example
  862. afade=t=in:ss=0:d=15
  863. @end example
  864. @item
  865. Fade out last 25 seconds of a 900 seconds audio:
  866. @example
  867. afade=t=out:st=875:d=25
  868. @end example
  869. @end itemize
  870. @section afftdn
  871. Denoise audio samples with FFT.
  872. A description of the accepted parameters follows.
  873. @table @option
  874. @item nr
  875. Set the noise reduction in dB, allowed range is 0.01 to 97.
  876. Default value is 12 dB.
  877. @item nf
  878. Set the noise floor in dB, allowed range is -80 to -20.
  879. Default value is -50 dB.
  880. @item nt
  881. Set the noise type.
  882. It accepts the following values:
  883. @table @option
  884. @item w
  885. Select white noise.
  886. @item v
  887. Select vinyl noise.
  888. @item s
  889. Select shellac noise.
  890. @item c
  891. Select custom noise, defined in @code{bn} option.
  892. Default value is white noise.
  893. @end table
  894. @item bn
  895. Set custom band noise for every one of 15 bands.
  896. Bands are separated by ' ' or '|'.
  897. @item rf
  898. Set the residual floor in dB, allowed range is -80 to -20.
  899. Default value is -38 dB.
  900. @item tn
  901. Enable noise tracking. By default is disabled.
  902. With this enabled, noise floor is automatically adjusted.
  903. @item tr
  904. Enable residual tracking. By default is disabled.
  905. @item om
  906. Set the output mode.
  907. It accepts the following values:
  908. @table @option
  909. @item i
  910. Pass input unchanged.
  911. @item o
  912. Pass noise filtered out.
  913. @item n
  914. Pass only noise.
  915. Default value is @var{o}.
  916. @end table
  917. @end table
  918. @subsection Commands
  919. This filter supports the following commands:
  920. @table @option
  921. @item sample_noise, sn
  922. Start or stop measuring noise profile.
  923. Syntax for the command is : "start" or "stop" string.
  924. After measuring noise profile is stopped it will be
  925. automatically applied in filtering.
  926. @item noise_reduction, nr
  927. Change noise reduction. Argument is single float number.
  928. Syntax for the command is : "@var{noise_reduction}"
  929. @item noise_floor, nf
  930. Change noise floor. Argument is single float number.
  931. Syntax for the command is : "@var{noise_floor}"
  932. @item output_mode, om
  933. Change output mode operation.
  934. Syntax for the command is : "i", "o" or "n" string.
  935. @end table
  936. @section afftfilt
  937. Apply arbitrary expressions to samples in frequency domain.
  938. @table @option
  939. @item real
  940. Set frequency domain real expression for each separate channel separated
  941. by '|'. Default is "re".
  942. If the number of input channels is greater than the number of
  943. expressions, the last specified expression is used for the remaining
  944. output channels.
  945. @item imag
  946. Set frequency domain imaginary expression for each separate channel
  947. separated by '|'. Default is "im".
  948. Each expression in @var{real} and @var{imag} can contain the following
  949. constants and functions:
  950. @table @option
  951. @item sr
  952. sample rate
  953. @item b
  954. current frequency bin number
  955. @item nb
  956. number of available bins
  957. @item ch
  958. channel number of the current expression
  959. @item chs
  960. number of channels
  961. @item pts
  962. current frame pts
  963. @item re
  964. current real part of frequency bin of current channel
  965. @item im
  966. current imaginary part of frequency bin of current channel
  967. @item real(b, ch)
  968. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  969. @item imag(b, ch)
  970. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  971. @end table
  972. @item win_size
  973. Set window size. Allowed range is from 16 to 131072.
  974. Default is @code{4096}
  975. @item win_func
  976. Set window function. Default is @code{hann}.
  977. @item overlap
  978. Set window overlap. If set to 1, the recommended overlap for selected
  979. window function will be picked. Default is @code{0.75}.
  980. @end table
  981. @subsection Examples
  982. @itemize
  983. @item
  984. Leave almost only low frequencies in audio:
  985. @example
  986. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  987. @end example
  988. @item
  989. Apply robotize effect:
  990. @example
  991. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  992. @end example
  993. @item
  994. Apply whisper effect:
  995. @example
  996. 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"
  997. @end example
  998. @end itemize
  999. @anchor{afir}
  1000. @section afir
  1001. Apply an arbitrary Finite Impulse Response filter.
  1002. This filter is designed for applying long FIR filters,
  1003. up to 60 seconds long.
  1004. It can be used as component for digital crossover filters,
  1005. room equalization, cross talk cancellation, wavefield synthesis,
  1006. auralization, ambiophonics, ambisonics and spatialization.
  1007. This filter uses the streams higher than first one as FIR coefficients.
  1008. If the non-first stream holds a single channel, it will be used
  1009. for all input channels in the first stream, otherwise
  1010. the number of channels in the non-first stream must be same as
  1011. the number of channels in the first stream.
  1012. It accepts the following parameters:
  1013. @table @option
  1014. @item dry
  1015. Set dry gain. This sets input gain.
  1016. @item wet
  1017. Set wet gain. This sets final output gain.
  1018. @item length
  1019. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1020. @item gtype
  1021. Enable applying gain measured from power of IR.
  1022. Set which approach to use for auto gain measurement.
  1023. @table @option
  1024. @item none
  1025. Do not apply any gain.
  1026. @item peak
  1027. select peak gain, very conservative approach. This is default value.
  1028. @item dc
  1029. select DC gain, limited application.
  1030. @item gn
  1031. select gain to noise approach, this is most popular one.
  1032. @end table
  1033. @item irgain
  1034. Set gain to be applied to IR coefficients before filtering.
  1035. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1036. @item irfmt
  1037. Set format of IR stream. Can be @code{mono} or @code{input}.
  1038. Default is @code{input}.
  1039. @item maxir
  1040. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1041. Allowed range is 0.1 to 60 seconds.
  1042. @item response
  1043. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1044. By default it is disabled.
  1045. @item channel
  1046. Set for which IR channel to display frequency response. By default is first channel
  1047. displayed. This option is used only when @var{response} is enabled.
  1048. @item size
  1049. Set video stream size. This option is used only when @var{response} is enabled.
  1050. @item rate
  1051. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1052. @item minp
  1053. Set minimal partition size used for convolution. Default is @var{8192}.
  1054. Allowed range is from @var{1} to @var{32768}.
  1055. Lower values decreases latency at cost of higher CPU usage.
  1056. @item maxp
  1057. Set maximal partition size used for convolution. Default is @var{8192}.
  1058. Allowed range is from @var{8} to @var{32768}.
  1059. Lower values may increase CPU usage.
  1060. @item nbirs
  1061. Set number of input impulse responses streams which will be switchable at runtime.
  1062. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1063. @item ir
  1064. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1065. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1066. This option can be changed at runtime via @ref{commands}.
  1067. @end table
  1068. @subsection Examples
  1069. @itemize
  1070. @item
  1071. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1072. @example
  1073. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1074. @end example
  1075. @end itemize
  1076. @anchor{aformat}
  1077. @section aformat
  1078. Set output format constraints for the input audio. The framework will
  1079. negotiate the most appropriate format to minimize conversions.
  1080. It accepts the following parameters:
  1081. @table @option
  1082. @item sample_fmts, f
  1083. A '|'-separated list of requested sample formats.
  1084. @item sample_rates, r
  1085. A '|'-separated list of requested sample rates.
  1086. @item channel_layouts, cl
  1087. A '|'-separated list of requested channel layouts.
  1088. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1089. for the required syntax.
  1090. @end table
  1091. If a parameter is omitted, all values are allowed.
  1092. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1093. @example
  1094. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1095. @end example
  1096. @section afreqshift
  1097. Apply frequency shift to input audio samples.
  1098. The filter accepts the following options:
  1099. @table @option
  1100. @item shift
  1101. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1102. Default value is 0.0.
  1103. @item level
  1104. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1105. Default value is 1.0.
  1106. @end table
  1107. @subsection Commands
  1108. This filter supports the all above options as @ref{commands}.
  1109. @section agate
  1110. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1111. processing reduces disturbing noise between useful signals.
  1112. Gating is done by detecting the volume below a chosen level @var{threshold}
  1113. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1114. floor is set via @var{range}. Because an exact manipulation of the signal
  1115. would cause distortion of the waveform the reduction can be levelled over
  1116. time. This is done by setting @var{attack} and @var{release}.
  1117. @var{attack} determines how long the signal has to fall below the threshold
  1118. before any reduction will occur and @var{release} sets the time the signal
  1119. has to rise above the threshold to reduce the reduction again.
  1120. Shorter signals than the chosen attack time will be left untouched.
  1121. @table @option
  1122. @item level_in
  1123. Set input level before filtering.
  1124. Default is 1. Allowed range is from 0.015625 to 64.
  1125. @item mode
  1126. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1127. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1128. will be amplified, expanding dynamic range in upward direction.
  1129. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1130. @item range
  1131. Set the level of gain reduction when the signal is below the threshold.
  1132. Default is 0.06125. Allowed range is from 0 to 1.
  1133. Setting this to 0 disables reduction and then filter behaves like expander.
  1134. @item threshold
  1135. If a signal rises above this level the gain reduction is released.
  1136. Default is 0.125. Allowed range is from 0 to 1.
  1137. @item ratio
  1138. Set a ratio by which the signal is reduced.
  1139. Default is 2. Allowed range is from 1 to 9000.
  1140. @item attack
  1141. Amount of milliseconds the signal has to rise above the threshold before gain
  1142. reduction stops.
  1143. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1144. @item release
  1145. Amount of milliseconds the signal has to fall below the threshold before the
  1146. reduction is increased again. Default is 250 milliseconds.
  1147. Allowed range is from 0.01 to 9000.
  1148. @item makeup
  1149. Set amount of amplification of signal after processing.
  1150. Default is 1. Allowed range is from 1 to 64.
  1151. @item knee
  1152. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1153. Default is 2.828427125. Allowed range is from 1 to 8.
  1154. @item detection
  1155. Choose if exact signal should be taken for detection or an RMS like one.
  1156. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1157. @item link
  1158. Choose if the average level between all channels or the louder channel affects
  1159. the reduction.
  1160. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1161. @end table
  1162. @subsection Commands
  1163. This filter supports the all above options as @ref{commands}.
  1164. @section aiir
  1165. Apply an arbitrary Infinite Impulse Response filter.
  1166. It accepts the following parameters:
  1167. @table @option
  1168. @item zeros, z
  1169. Set B/numerator/zeros/reflection coefficients.
  1170. @item poles, p
  1171. Set A/denominator/poles/ladder coefficients.
  1172. @item gains, k
  1173. Set channels gains.
  1174. @item dry_gain
  1175. Set input gain.
  1176. @item wet_gain
  1177. Set output gain.
  1178. @item format, f
  1179. Set coefficients format.
  1180. @table @samp
  1181. @item ll
  1182. lattice-ladder function
  1183. @item sf
  1184. analog transfer function
  1185. @item tf
  1186. digital transfer function
  1187. @item zp
  1188. Z-plane zeros/poles, cartesian (default)
  1189. @item pr
  1190. Z-plane zeros/poles, polar radians
  1191. @item pd
  1192. Z-plane zeros/poles, polar degrees
  1193. @item sp
  1194. S-plane zeros/poles
  1195. @end table
  1196. @item process, r
  1197. Set type of processing.
  1198. @table @samp
  1199. @item d
  1200. direct processing
  1201. @item s
  1202. serial processing
  1203. @item p
  1204. parallel processing
  1205. @end table
  1206. @item precision, e
  1207. Set filtering precision.
  1208. @table @samp
  1209. @item dbl
  1210. double-precision floating-point (default)
  1211. @item flt
  1212. single-precision floating-point
  1213. @item i32
  1214. 32-bit integers
  1215. @item i16
  1216. 16-bit integers
  1217. @end table
  1218. @item normalize, n
  1219. Normalize filter coefficients, by default is enabled.
  1220. Enabling it will normalize magnitude response at DC to 0dB.
  1221. @item mix
  1222. How much to use filtered signal in output. Default is 1.
  1223. Range is between 0 and 1.
  1224. @item response
  1225. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1226. By default it is disabled.
  1227. @item channel
  1228. Set for which IR channel to display frequency response. By default is first channel
  1229. displayed. This option is used only when @var{response} is enabled.
  1230. @item size
  1231. Set video stream size. This option is used only when @var{response} is enabled.
  1232. @end table
  1233. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1234. order.
  1235. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1236. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1237. imaginary unit.
  1238. Different coefficients and gains can be provided for every channel, in such case
  1239. use '|' to separate coefficients or gains. Last provided coefficients will be
  1240. used for all remaining channels.
  1241. @subsection Examples
  1242. @itemize
  1243. @item
  1244. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1245. @example
  1246. 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
  1247. @end example
  1248. @item
  1249. Same as above but in @code{zp} format:
  1250. @example
  1251. 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
  1252. @end example
  1253. @item
  1254. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1255. @example
  1256. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1257. @end example
  1258. @end itemize
  1259. @section alimiter
  1260. The limiter prevents an input signal from rising over a desired threshold.
  1261. This limiter uses lookahead technology to prevent your signal from distorting.
  1262. It means that there is a small delay after the signal is processed. Keep in mind
  1263. that the delay it produces is the attack time you set.
  1264. The filter accepts the following options:
  1265. @table @option
  1266. @item level_in
  1267. Set input gain. Default is 1.
  1268. @item level_out
  1269. Set output gain. Default is 1.
  1270. @item limit
  1271. Don't let signals above this level pass the limiter. Default is 1.
  1272. @item attack
  1273. The limiter will reach its attenuation level in this amount of time in
  1274. milliseconds. Default is 5 milliseconds.
  1275. @item release
  1276. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1277. Default is 50 milliseconds.
  1278. @item asc
  1279. When gain reduction is always needed ASC takes care of releasing to an
  1280. average reduction level rather than reaching a reduction of 0 in the release
  1281. time.
  1282. @item asc_level
  1283. Select how much the release time is affected by ASC, 0 means nearly no changes
  1284. in release time while 1 produces higher release times.
  1285. @item level
  1286. Auto level output signal. Default is enabled.
  1287. This normalizes audio back to 0dB if enabled.
  1288. @end table
  1289. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1290. with @ref{aresample} before applying this filter.
  1291. @section allpass
  1292. Apply a two-pole all-pass filter with central frequency (in Hz)
  1293. @var{frequency}, and filter-width @var{width}.
  1294. An all-pass filter changes the audio's frequency to phase relationship
  1295. without changing its frequency to amplitude relationship.
  1296. The filter accepts the following options:
  1297. @table @option
  1298. @item frequency, f
  1299. Set frequency in Hz.
  1300. @item width_type, t
  1301. Set method to specify band-width of filter.
  1302. @table @option
  1303. @item h
  1304. Hz
  1305. @item q
  1306. Q-Factor
  1307. @item o
  1308. octave
  1309. @item s
  1310. slope
  1311. @item k
  1312. kHz
  1313. @end table
  1314. @item width, w
  1315. Specify the band-width of a filter in width_type units.
  1316. @item mix, m
  1317. How much to use filtered signal in output. Default is 1.
  1318. Range is between 0 and 1.
  1319. @item channels, c
  1320. Specify which channels to filter, by default all available are filtered.
  1321. @item normalize, n
  1322. Normalize biquad coefficients, by default is disabled.
  1323. Enabling it will normalize magnitude response at DC to 0dB.
  1324. @item order, o
  1325. Set the filter order, can be 1 or 2. Default is 2.
  1326. @item transform, a
  1327. Set transform type of IIR filter.
  1328. @table @option
  1329. @item di
  1330. @item dii
  1331. @item tdii
  1332. @item latt
  1333. @end table
  1334. @item precision, r
  1335. Set precison of filtering.
  1336. @table @option
  1337. @item auto
  1338. Pick automatic sample format depending on surround filters.
  1339. @item s16
  1340. Always use signed 16-bit.
  1341. @item s32
  1342. Always use signed 32-bit.
  1343. @item f32
  1344. Always use float 32-bit.
  1345. @item f64
  1346. Always use float 64-bit.
  1347. @end table
  1348. @end table
  1349. @subsection Commands
  1350. This filter supports the following commands:
  1351. @table @option
  1352. @item frequency, f
  1353. Change allpass frequency.
  1354. Syntax for the command is : "@var{frequency}"
  1355. @item width_type, t
  1356. Change allpass width_type.
  1357. Syntax for the command is : "@var{width_type}"
  1358. @item width, w
  1359. Change allpass width.
  1360. Syntax for the command is : "@var{width}"
  1361. @item mix, m
  1362. Change allpass mix.
  1363. Syntax for the command is : "@var{mix}"
  1364. @end table
  1365. @section aloop
  1366. Loop audio samples.
  1367. The filter accepts the following options:
  1368. @table @option
  1369. @item loop
  1370. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1371. Default is 0.
  1372. @item size
  1373. Set maximal number of samples. Default is 0.
  1374. @item start
  1375. Set first sample of loop. Default is 0.
  1376. @end table
  1377. @anchor{amerge}
  1378. @section amerge
  1379. Merge two or more audio streams into a single multi-channel stream.
  1380. The filter accepts the following options:
  1381. @table @option
  1382. @item inputs
  1383. Set the number of inputs. Default is 2.
  1384. @end table
  1385. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1386. the channel layout of the output will be set accordingly and the channels
  1387. will be reordered as necessary. If the channel layouts of the inputs are not
  1388. disjoint, the output will have all the channels of the first input then all
  1389. the channels of the second input, in that order, and the channel layout of
  1390. the output will be the default value corresponding to the total number of
  1391. channels.
  1392. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1393. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1394. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1395. first input, b1 is the first channel of the second input).
  1396. On the other hand, if both input are in stereo, the output channels will be
  1397. in the default order: a1, a2, b1, b2, and the channel layout will be
  1398. arbitrarily set to 4.0, which may or may not be the expected value.
  1399. All inputs must have the same sample rate, and format.
  1400. If inputs do not have the same duration, the output will stop with the
  1401. shortest.
  1402. @subsection Examples
  1403. @itemize
  1404. @item
  1405. Merge two mono files into a stereo stream:
  1406. @example
  1407. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1408. @end example
  1409. @item
  1410. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1411. @example
  1412. 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
  1413. @end example
  1414. @end itemize
  1415. @section amix
  1416. Mixes multiple audio inputs into a single output.
  1417. Note that this filter only supports float samples (the @var{amerge}
  1418. and @var{pan} audio filters support many formats). If the @var{amix}
  1419. input has integer samples then @ref{aresample} will be automatically
  1420. inserted to perform the conversion to float samples.
  1421. For example
  1422. @example
  1423. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1424. @end example
  1425. will mix 3 input audio streams to a single output with the same duration as the
  1426. first input and a dropout transition time of 3 seconds.
  1427. It accepts the following parameters:
  1428. @table @option
  1429. @item inputs
  1430. The number of inputs. If unspecified, it defaults to 2.
  1431. @item duration
  1432. How to determine the end-of-stream.
  1433. @table @option
  1434. @item longest
  1435. The duration of the longest input. (default)
  1436. @item shortest
  1437. The duration of the shortest input.
  1438. @item first
  1439. The duration of the first input.
  1440. @end table
  1441. @item dropout_transition
  1442. The transition time, in seconds, for volume renormalization when an input
  1443. stream ends. The default value is 2 seconds.
  1444. @item weights
  1445. Specify weight of each input audio stream as sequence.
  1446. Each weight is separated by space. By default all inputs have same weight.
  1447. @end table
  1448. @subsection Commands
  1449. This filter supports the following commands:
  1450. @table @option
  1451. @item weights
  1452. Syntax is same as option with same name.
  1453. @end table
  1454. @section amultiply
  1455. Multiply first audio stream with second audio stream and store result
  1456. in output audio stream. Multiplication is done by multiplying each
  1457. sample from first stream with sample at same position from second stream.
  1458. With this element-wise multiplication one can create amplitude fades and
  1459. amplitude modulations.
  1460. @section anequalizer
  1461. High-order parametric multiband equalizer for each channel.
  1462. It accepts the following parameters:
  1463. @table @option
  1464. @item params
  1465. This option string is in format:
  1466. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1467. Each equalizer band is separated by '|'.
  1468. @table @option
  1469. @item chn
  1470. Set channel number to which equalization will be applied.
  1471. If input doesn't have that channel the entry is ignored.
  1472. @item f
  1473. Set central frequency for band.
  1474. If input doesn't have that frequency the entry is ignored.
  1475. @item w
  1476. Set band width in Hertz.
  1477. @item g
  1478. Set band gain in dB.
  1479. @item t
  1480. Set filter type for band, optional, can be:
  1481. @table @samp
  1482. @item 0
  1483. Butterworth, this is default.
  1484. @item 1
  1485. Chebyshev type 1.
  1486. @item 2
  1487. Chebyshev type 2.
  1488. @end table
  1489. @end table
  1490. @item curves
  1491. With this option activated frequency response of anequalizer is displayed
  1492. in video stream.
  1493. @item size
  1494. Set video stream size. Only useful if curves option is activated.
  1495. @item mgain
  1496. Set max gain that will be displayed. Only useful if curves option is activated.
  1497. Setting this to a reasonable value makes it possible to display gain which is derived from
  1498. neighbour bands which are too close to each other and thus produce higher gain
  1499. when both are activated.
  1500. @item fscale
  1501. Set frequency scale used to draw frequency response in video output.
  1502. Can be linear or logarithmic. Default is logarithmic.
  1503. @item colors
  1504. Set color for each channel curve which is going to be displayed in video stream.
  1505. This is list of color names separated by space or by '|'.
  1506. Unrecognised or missing colors will be replaced by white color.
  1507. @end table
  1508. @subsection Examples
  1509. @itemize
  1510. @item
  1511. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1512. for first 2 channels using Chebyshev type 1 filter:
  1513. @example
  1514. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1515. @end example
  1516. @end itemize
  1517. @subsection Commands
  1518. This filter supports the following commands:
  1519. @table @option
  1520. @item change
  1521. Alter existing filter parameters.
  1522. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1523. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1524. error is returned.
  1525. @var{freq} set new frequency parameter.
  1526. @var{width} set new width parameter in Hertz.
  1527. @var{gain} set new gain parameter in dB.
  1528. Full filter invocation with asendcmd may look like this:
  1529. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1530. @end table
  1531. @section anlmdn
  1532. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1533. Each sample is adjusted by looking for other samples with similar contexts. This
  1534. context similarity is defined by comparing their surrounding patches of size
  1535. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1536. The filter accepts the following options:
  1537. @table @option
  1538. @item s
  1539. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1540. @item p
  1541. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1542. Default value is 2 milliseconds.
  1543. @item r
  1544. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1545. Default value is 6 milliseconds.
  1546. @item o
  1547. Set the output mode.
  1548. It accepts the following values:
  1549. @table @option
  1550. @item i
  1551. Pass input unchanged.
  1552. @item o
  1553. Pass noise filtered out.
  1554. @item n
  1555. Pass only noise.
  1556. Default value is @var{o}.
  1557. @end table
  1558. @item m
  1559. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1560. @end table
  1561. @subsection Commands
  1562. This filter supports the all above options as @ref{commands}.
  1563. @section anlms
  1564. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1565. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1566. relate to producing the least mean square of the error signal (difference between the desired,
  1567. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1568. A description of the accepted options follows.
  1569. @table @option
  1570. @item order
  1571. Set filter order.
  1572. @item mu
  1573. Set filter mu.
  1574. @item eps
  1575. Set the filter eps.
  1576. @item leakage
  1577. Set the filter leakage.
  1578. @item out_mode
  1579. It accepts the following values:
  1580. @table @option
  1581. @item i
  1582. Pass the 1st input.
  1583. @item d
  1584. Pass the 2nd input.
  1585. @item o
  1586. Pass filtered samples.
  1587. @item n
  1588. Pass difference between desired and filtered samples.
  1589. Default value is @var{o}.
  1590. @end table
  1591. @end table
  1592. @subsection Examples
  1593. @itemize
  1594. @item
  1595. One of many usages of this filter is noise reduction, input audio is filtered
  1596. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1597. @example
  1598. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1599. @end example
  1600. @end itemize
  1601. @subsection Commands
  1602. This filter supports the same commands as options, excluding option @code{order}.
  1603. @section anull
  1604. Pass the audio source unchanged to the output.
  1605. @section apad
  1606. Pad the end of an audio stream with silence.
  1607. This can be used together with @command{ffmpeg} @option{-shortest} to
  1608. extend audio streams to the same length as the video stream.
  1609. A description of the accepted options follows.
  1610. @table @option
  1611. @item packet_size
  1612. Set silence packet size. Default value is 4096.
  1613. @item pad_len
  1614. Set the number of samples of silence to add to the end. After the
  1615. value is reached, the stream is terminated. This option is mutually
  1616. exclusive with @option{whole_len}.
  1617. @item whole_len
  1618. Set the minimum total number of samples in the output audio stream. If
  1619. the value is longer than the input audio length, silence is added to
  1620. the end, until the value is reached. This option is mutually exclusive
  1621. with @option{pad_len}.
  1622. @item pad_dur
  1623. Specify the duration of samples of silence to add. See
  1624. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1625. for the accepted syntax. Used only if set to non-zero value.
  1626. @item whole_dur
  1627. Specify the minimum total duration in the output audio stream. See
  1628. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1629. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1630. the input audio length, silence is added to the end, until the value is reached.
  1631. This option is mutually exclusive with @option{pad_dur}
  1632. @end table
  1633. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1634. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1635. the input stream indefinitely.
  1636. @subsection Examples
  1637. @itemize
  1638. @item
  1639. Add 1024 samples of silence to the end of the input:
  1640. @example
  1641. apad=pad_len=1024
  1642. @end example
  1643. @item
  1644. Make sure the audio output will contain at least 10000 samples, pad
  1645. the input with silence if required:
  1646. @example
  1647. apad=whole_len=10000
  1648. @end example
  1649. @item
  1650. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1651. video stream will always result the shortest and will be converted
  1652. until the end in the output file when using the @option{shortest}
  1653. option:
  1654. @example
  1655. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1656. @end example
  1657. @end itemize
  1658. @section aphaser
  1659. Add a phasing effect to the input audio.
  1660. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1661. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1662. A description of the accepted parameters follows.
  1663. @table @option
  1664. @item in_gain
  1665. Set input gain. Default is 0.4.
  1666. @item out_gain
  1667. Set output gain. Default is 0.74
  1668. @item delay
  1669. Set delay in milliseconds. Default is 3.0.
  1670. @item decay
  1671. Set decay. Default is 0.4.
  1672. @item speed
  1673. Set modulation speed in Hz. Default is 0.5.
  1674. @item type
  1675. Set modulation type. Default is triangular.
  1676. It accepts the following values:
  1677. @table @samp
  1678. @item triangular, t
  1679. @item sinusoidal, s
  1680. @end table
  1681. @end table
  1682. @section aphaseshift
  1683. Apply phase shift to input audio samples.
  1684. The filter accepts the following options:
  1685. @table @option
  1686. @item shift
  1687. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1688. Default value is 0.0.
  1689. @item level
  1690. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1691. Default value is 1.0.
  1692. @end table
  1693. @subsection Commands
  1694. This filter supports the all above options as @ref{commands}.
  1695. @section apulsator
  1696. Audio pulsator is something between an autopanner and a tremolo.
  1697. But it can produce funny stereo effects as well. Pulsator changes the volume
  1698. of the left and right channel based on a LFO (low frequency oscillator) with
  1699. different waveforms and shifted phases.
  1700. This filter have the ability to define an offset between left and right
  1701. channel. An offset of 0 means that both LFO shapes match each other.
  1702. The left and right channel are altered equally - a conventional tremolo.
  1703. An offset of 50% means that the shape of the right channel is exactly shifted
  1704. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1705. an autopanner. At 1 both curves match again. Every setting in between moves the
  1706. phase shift gapless between all stages and produces some "bypassing" sounds with
  1707. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1708. the 0.5) the faster the signal passes from the left to the right speaker.
  1709. The filter accepts the following options:
  1710. @table @option
  1711. @item level_in
  1712. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1713. @item level_out
  1714. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1715. @item mode
  1716. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1717. sawup or sawdown. Default is sine.
  1718. @item amount
  1719. Set modulation. Define how much of original signal is affected by the LFO.
  1720. @item offset_l
  1721. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1722. @item offset_r
  1723. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1724. @item width
  1725. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1726. @item timing
  1727. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1728. @item bpm
  1729. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1730. is set to bpm.
  1731. @item ms
  1732. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1733. is set to ms.
  1734. @item hz
  1735. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1736. if timing is set to hz.
  1737. @end table
  1738. @anchor{aresample}
  1739. @section aresample
  1740. Resample the input audio to the specified parameters, using the
  1741. libswresample library. If none are specified then the filter will
  1742. automatically convert between its input and output.
  1743. This filter is also able to stretch/squeeze the audio data to make it match
  1744. the timestamps or to inject silence / cut out audio to make it match the
  1745. timestamps, do a combination of both or do neither.
  1746. The filter accepts the syntax
  1747. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1748. expresses a sample rate and @var{resampler_options} is a list of
  1749. @var{key}=@var{value} pairs, separated by ":". See the
  1750. @ref{Resampler Options,,"Resampler Options" section in the
  1751. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1752. for the complete list of supported options.
  1753. @subsection Examples
  1754. @itemize
  1755. @item
  1756. Resample the input audio to 44100Hz:
  1757. @example
  1758. aresample=44100
  1759. @end example
  1760. @item
  1761. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1762. samples per second compensation:
  1763. @example
  1764. aresample=async=1000
  1765. @end example
  1766. @end itemize
  1767. @section areverse
  1768. Reverse an audio clip.
  1769. Warning: This filter requires memory to buffer the entire clip, so trimming
  1770. is suggested.
  1771. @subsection Examples
  1772. @itemize
  1773. @item
  1774. Take the first 5 seconds of a clip, and reverse it.
  1775. @example
  1776. atrim=end=5,areverse
  1777. @end example
  1778. @end itemize
  1779. @section arnndn
  1780. Reduce noise from speech using Recurrent Neural Networks.
  1781. This filter accepts the following options:
  1782. @table @option
  1783. @item model, m
  1784. Set train model file to load. This option is always required.
  1785. @item mix
  1786. Set how much to mix filtered samples into final output.
  1787. Allowed range is from -1 to 1. Default value is 1.
  1788. Negative values are special, they set how much to keep filtered noise
  1789. in the final filter output. Set this option to -1 to hear actual
  1790. noise removed from input signal.
  1791. @end table
  1792. @section asetnsamples
  1793. Set the number of samples per each output audio frame.
  1794. The last output packet may contain a different number of samples, as
  1795. the filter will flush all the remaining samples when the input audio
  1796. signals its end.
  1797. The filter accepts the following options:
  1798. @table @option
  1799. @item nb_out_samples, n
  1800. Set the number of frames per each output audio frame. The number is
  1801. intended as the number of samples @emph{per each channel}.
  1802. Default value is 1024.
  1803. @item pad, p
  1804. If set to 1, the filter will pad the last audio frame with zeroes, so
  1805. that the last frame will contain the same number of samples as the
  1806. previous ones. Default value is 1.
  1807. @end table
  1808. For example, to set the number of per-frame samples to 1234 and
  1809. disable padding for the last frame, use:
  1810. @example
  1811. asetnsamples=n=1234:p=0
  1812. @end example
  1813. @section asetrate
  1814. Set the sample rate without altering the PCM data.
  1815. This will result in a change of speed and pitch.
  1816. The filter accepts the following options:
  1817. @table @option
  1818. @item sample_rate, r
  1819. Set the output sample rate. Default is 44100 Hz.
  1820. @end table
  1821. @section ashowinfo
  1822. Show a line containing various information for each input audio frame.
  1823. The input audio is not modified.
  1824. The shown line contains a sequence of key/value pairs of the form
  1825. @var{key}:@var{value}.
  1826. The following values are shown in the output:
  1827. @table @option
  1828. @item n
  1829. The (sequential) number of the input frame, starting from 0.
  1830. @item pts
  1831. The presentation timestamp of the input frame, in time base units; the time base
  1832. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1833. @item pts_time
  1834. The presentation timestamp of the input frame in seconds.
  1835. @item pos
  1836. position of the frame in the input stream, -1 if this information in
  1837. unavailable and/or meaningless (for example in case of synthetic audio)
  1838. @item fmt
  1839. The sample format.
  1840. @item chlayout
  1841. The channel layout.
  1842. @item rate
  1843. The sample rate for the audio frame.
  1844. @item nb_samples
  1845. The number of samples (per channel) in the frame.
  1846. @item checksum
  1847. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1848. audio, the data is treated as if all the planes were concatenated.
  1849. @item plane_checksums
  1850. A list of Adler-32 checksums for each data plane.
  1851. @end table
  1852. @section asoftclip
  1853. Apply audio soft clipping.
  1854. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1855. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1856. This filter accepts the following options:
  1857. @table @option
  1858. @item type
  1859. Set type of soft-clipping.
  1860. It accepts the following values:
  1861. @table @option
  1862. @item hard
  1863. @item tanh
  1864. @item atan
  1865. @item cubic
  1866. @item exp
  1867. @item alg
  1868. @item quintic
  1869. @item sin
  1870. @item erf
  1871. @end table
  1872. @item threshold
  1873. Set threshold from where to start clipping. Default value is 0dB or 1.
  1874. @item output
  1875. Set gain applied to output. Default value is 0dB or 1.
  1876. @item param
  1877. Set additional parameter which controls sigmoid function.
  1878. @item oversample
  1879. Set oversampling factor.
  1880. @end table
  1881. @subsection Commands
  1882. This filter supports the all above options as @ref{commands}.
  1883. @section asr
  1884. Automatic Speech Recognition
  1885. This filter uses PocketSphinx for speech recognition. To enable
  1886. compilation of this filter, you need to configure FFmpeg with
  1887. @code{--enable-pocketsphinx}.
  1888. It accepts the following options:
  1889. @table @option
  1890. @item rate
  1891. Set sampling rate of input audio. Defaults is @code{16000}.
  1892. This need to match speech models, otherwise one will get poor results.
  1893. @item hmm
  1894. Set dictionary containing acoustic model files.
  1895. @item dict
  1896. Set pronunciation dictionary.
  1897. @item lm
  1898. Set language model file.
  1899. @item lmctl
  1900. Set language model set.
  1901. @item lmname
  1902. Set which language model to use.
  1903. @item logfn
  1904. Set output for log messages.
  1905. @end table
  1906. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1907. @anchor{astats}
  1908. @section astats
  1909. Display time domain statistical information about the audio channels.
  1910. Statistics are calculated and displayed for each audio channel and,
  1911. where applicable, an overall figure is also given.
  1912. It accepts the following option:
  1913. @table @option
  1914. @item length
  1915. Short window length in seconds, used for peak and trough RMS measurement.
  1916. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1917. @item metadata
  1918. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1919. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1920. disabled.
  1921. Available keys for each channel are:
  1922. DC_offset
  1923. Min_level
  1924. Max_level
  1925. Min_difference
  1926. Max_difference
  1927. Mean_difference
  1928. RMS_difference
  1929. Peak_level
  1930. RMS_peak
  1931. RMS_trough
  1932. Crest_factor
  1933. Flat_factor
  1934. Peak_count
  1935. Noise_floor
  1936. Noise_floor_count
  1937. Bit_depth
  1938. Dynamic_range
  1939. Zero_crossings
  1940. Zero_crossings_rate
  1941. Number_of_NaNs
  1942. Number_of_Infs
  1943. Number_of_denormals
  1944. and for Overall:
  1945. DC_offset
  1946. Min_level
  1947. Max_level
  1948. Min_difference
  1949. Max_difference
  1950. Mean_difference
  1951. RMS_difference
  1952. Peak_level
  1953. RMS_level
  1954. RMS_peak
  1955. RMS_trough
  1956. Flat_factor
  1957. Peak_count
  1958. Noise_floor
  1959. Noise_floor_count
  1960. Bit_depth
  1961. Number_of_samples
  1962. Number_of_NaNs
  1963. Number_of_Infs
  1964. Number_of_denormals
  1965. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1966. this @code{lavfi.astats.Overall.Peak_count}.
  1967. For description what each key means read below.
  1968. @item reset
  1969. Set number of frame after which stats are going to be recalculated.
  1970. Default is disabled.
  1971. @item measure_perchannel
  1972. Select the entries which need to be measured per channel. The metadata keys can
  1973. be used as flags, default is @option{all} which measures everything.
  1974. @option{none} disables all per channel measurement.
  1975. @item measure_overall
  1976. Select the entries which need to be measured overall. The metadata keys can
  1977. be used as flags, default is @option{all} which measures everything.
  1978. @option{none} disables all overall measurement.
  1979. @end table
  1980. A description of each shown parameter follows:
  1981. @table @option
  1982. @item DC offset
  1983. Mean amplitude displacement from zero.
  1984. @item Min level
  1985. Minimal sample level.
  1986. @item Max level
  1987. Maximal sample level.
  1988. @item Min difference
  1989. Minimal difference between two consecutive samples.
  1990. @item Max difference
  1991. Maximal difference between two consecutive samples.
  1992. @item Mean difference
  1993. Mean difference between two consecutive samples.
  1994. The average of each difference between two consecutive samples.
  1995. @item RMS difference
  1996. Root Mean Square difference between two consecutive samples.
  1997. @item Peak level dB
  1998. @item RMS level dB
  1999. Standard peak and RMS level measured in dBFS.
  2000. @item RMS peak dB
  2001. @item RMS trough dB
  2002. Peak and trough values for RMS level measured over a short window.
  2003. @item Crest factor
  2004. Standard ratio of peak to RMS level (note: not in dB).
  2005. @item Flat factor
  2006. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2007. (i.e. either @var{Min level} or @var{Max level}).
  2008. @item Peak count
  2009. Number of occasions (not the number of samples) that the signal attained either
  2010. @var{Min level} or @var{Max level}.
  2011. @item Noise floor dB
  2012. Minimum local peak measured in dBFS over a short window.
  2013. @item Noise floor count
  2014. Number of occasions (not the number of samples) that the signal attained
  2015. @var{Noise floor}.
  2016. @item Bit depth
  2017. Overall bit depth of audio. Number of bits used for each sample.
  2018. @item Dynamic range
  2019. Measured dynamic range of audio in dB.
  2020. @item Zero crossings
  2021. Number of points where the waveform crosses the zero level axis.
  2022. @item Zero crossings rate
  2023. Rate of Zero crossings and number of audio samples.
  2024. @end table
  2025. @section asubboost
  2026. Boost subwoofer frequencies.
  2027. The filter accepts the following options:
  2028. @table @option
  2029. @item dry
  2030. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2031. Default value is 0.7.
  2032. @item wet
  2033. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2034. Default value is 0.7.
  2035. @item decay
  2036. Set delay line decay gain value. Allowed range is from 0 to 1.
  2037. Default value is 0.7.
  2038. @item feedback
  2039. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2040. Default value is 0.9.
  2041. @item cutoff
  2042. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2043. Default value is 100.
  2044. @item slope
  2045. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2046. Default value is 0.5.
  2047. @item delay
  2048. Set delay. Allowed range is from 1 to 100.
  2049. Default value is 20.
  2050. @end table
  2051. @subsection Commands
  2052. This filter supports the all above options as @ref{commands}.
  2053. @section asubcut
  2054. Cut subwoofer frequencies.
  2055. This filter allows to set custom, steeper
  2056. roll off than highpass filter, and thus is able to more attenuate
  2057. frequency content in stop-band.
  2058. The filter accepts the following options:
  2059. @table @option
  2060. @item cutoff
  2061. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2062. Default value is 20.
  2063. @item order
  2064. Set filter order. Available values are from 3 to 20.
  2065. Default value is 10.
  2066. @item level
  2067. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2068. @end table
  2069. @subsection Commands
  2070. This filter supports the all above options as @ref{commands}.
  2071. @section asupercut
  2072. Cut super frequencies.
  2073. The filter accepts the following options:
  2074. @table @option
  2075. @item cutoff
  2076. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2077. Default value is 20000.
  2078. @item order
  2079. Set filter order. Available values are from 3 to 20.
  2080. Default value is 10.
  2081. @item level
  2082. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2083. @end table
  2084. @subsection Commands
  2085. This filter supports the all above options as @ref{commands}.
  2086. @section asuperpass
  2087. Apply high order Butterworth band-pass filter.
  2088. The filter accepts the following options:
  2089. @table @option
  2090. @item centerf
  2091. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2092. Default value is 1000.
  2093. @item order
  2094. Set filter order. Available values are from 4 to 20.
  2095. Default value is 4.
  2096. @item qfactor
  2097. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2098. @item level
  2099. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2100. @end table
  2101. @subsection Commands
  2102. This filter supports the all above options as @ref{commands}.
  2103. @section asuperstop
  2104. Apply high order Butterworth band-stop filter.
  2105. The filter accepts the following options:
  2106. @table @option
  2107. @item centerf
  2108. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2109. Default value is 1000.
  2110. @item order
  2111. Set filter order. Available values are from 4 to 20.
  2112. Default value is 4.
  2113. @item qfactor
  2114. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2115. @item level
  2116. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2117. @end table
  2118. @subsection Commands
  2119. This filter supports the all above options as @ref{commands}.
  2120. @section atempo
  2121. Adjust audio tempo.
  2122. The filter accepts exactly one parameter, the audio tempo. If not
  2123. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2124. be in the [0.5, 100.0] range.
  2125. Note that tempo greater than 2 will skip some samples rather than
  2126. blend them in. If for any reason this is a concern it is always
  2127. possible to daisy-chain several instances of atempo to achieve the
  2128. desired product tempo.
  2129. @subsection Examples
  2130. @itemize
  2131. @item
  2132. Slow down audio to 80% tempo:
  2133. @example
  2134. atempo=0.8
  2135. @end example
  2136. @item
  2137. To speed up audio to 300% tempo:
  2138. @example
  2139. atempo=3
  2140. @end example
  2141. @item
  2142. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2143. @example
  2144. atempo=sqrt(3),atempo=sqrt(3)
  2145. @end example
  2146. @end itemize
  2147. @subsection Commands
  2148. This filter supports the following commands:
  2149. @table @option
  2150. @item tempo
  2151. Change filter tempo scale factor.
  2152. Syntax for the command is : "@var{tempo}"
  2153. @end table
  2154. @section atrim
  2155. Trim the input so that the output contains one continuous subpart of the input.
  2156. It accepts the following parameters:
  2157. @table @option
  2158. @item start
  2159. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2160. sample with the timestamp @var{start} will be the first sample in the output.
  2161. @item end
  2162. Specify time of the first audio sample that will be dropped, i.e. the
  2163. audio sample immediately preceding the one with the timestamp @var{end} will be
  2164. the last sample in the output.
  2165. @item start_pts
  2166. Same as @var{start}, except this option sets the start timestamp in samples
  2167. instead of seconds.
  2168. @item end_pts
  2169. Same as @var{end}, except this option sets the end timestamp in samples instead
  2170. of seconds.
  2171. @item duration
  2172. The maximum duration of the output in seconds.
  2173. @item start_sample
  2174. The number of the first sample that should be output.
  2175. @item end_sample
  2176. The number of the first sample that should be dropped.
  2177. @end table
  2178. @option{start}, @option{end}, and @option{duration} are expressed as time
  2179. duration specifications; see
  2180. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2181. Note that the first two sets of the start/end options and the @option{duration}
  2182. option look at the frame timestamp, while the _sample options simply count the
  2183. samples that pass through the filter. So start/end_pts and start/end_sample will
  2184. give different results when the timestamps are wrong, inexact or do not start at
  2185. zero. Also note that this filter does not modify the timestamps. If you wish
  2186. to have the output timestamps start at zero, insert the asetpts filter after the
  2187. atrim filter.
  2188. If multiple start or end options are set, this filter tries to be greedy and
  2189. keep all samples that match at least one of the specified constraints. To keep
  2190. only the part that matches all the constraints at once, chain multiple atrim
  2191. filters.
  2192. The defaults are such that all the input is kept. So it is possible to set e.g.
  2193. just the end values to keep everything before the specified time.
  2194. Examples:
  2195. @itemize
  2196. @item
  2197. Drop everything except the second minute of input:
  2198. @example
  2199. ffmpeg -i INPUT -af atrim=60:120
  2200. @end example
  2201. @item
  2202. Keep only the first 1000 samples:
  2203. @example
  2204. ffmpeg -i INPUT -af atrim=end_sample=1000
  2205. @end example
  2206. @end itemize
  2207. @section axcorrelate
  2208. Calculate normalized cross-correlation between two input audio streams.
  2209. Resulted samples are always between -1 and 1 inclusive.
  2210. If result is 1 it means two input samples are highly correlated in that selected segment.
  2211. Result 0 means they are not correlated at all.
  2212. If result is -1 it means two input samples are out of phase, which means they cancel each
  2213. other.
  2214. The filter accepts the following options:
  2215. @table @option
  2216. @item size
  2217. Set size of segment over which cross-correlation is calculated.
  2218. Default is 256. Allowed range is from 2 to 131072.
  2219. @item algo
  2220. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2221. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2222. are always zero and thus need much less calculations to make.
  2223. This is generally not true, but is valid for typical audio streams.
  2224. @end table
  2225. @subsection Examples
  2226. @itemize
  2227. @item
  2228. Calculate correlation between channels in stereo audio stream:
  2229. @example
  2230. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2231. @end example
  2232. @end itemize
  2233. @section bandpass
  2234. Apply a two-pole Butterworth band-pass filter with central
  2235. frequency @var{frequency}, and (3dB-point) band-width width.
  2236. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2237. instead of the default: constant 0dB peak gain.
  2238. The filter roll off at 6dB per octave (20dB per decade).
  2239. The filter accepts the following options:
  2240. @table @option
  2241. @item frequency, f
  2242. Set the filter's central frequency. Default is @code{3000}.
  2243. @item csg
  2244. Constant skirt gain if set to 1. Defaults to 0.
  2245. @item width_type, t
  2246. Set method to specify band-width of filter.
  2247. @table @option
  2248. @item h
  2249. Hz
  2250. @item q
  2251. Q-Factor
  2252. @item o
  2253. octave
  2254. @item s
  2255. slope
  2256. @item k
  2257. kHz
  2258. @end table
  2259. @item width, w
  2260. Specify the band-width of a filter in width_type units.
  2261. @item mix, m
  2262. How much to use filtered signal in output. Default is 1.
  2263. Range is between 0 and 1.
  2264. @item channels, c
  2265. Specify which channels to filter, by default all available are filtered.
  2266. @item normalize, n
  2267. Normalize biquad coefficients, by default is disabled.
  2268. Enabling it will normalize magnitude response at DC to 0dB.
  2269. @item transform, a
  2270. Set transform type of IIR filter.
  2271. @table @option
  2272. @item di
  2273. @item dii
  2274. @item tdii
  2275. @item latt
  2276. @end table
  2277. @item precision, r
  2278. Set precison of filtering.
  2279. @table @option
  2280. @item auto
  2281. Pick automatic sample format depending on surround filters.
  2282. @item s16
  2283. Always use signed 16-bit.
  2284. @item s32
  2285. Always use signed 32-bit.
  2286. @item f32
  2287. Always use float 32-bit.
  2288. @item f64
  2289. Always use float 64-bit.
  2290. @end table
  2291. @end table
  2292. @subsection Commands
  2293. This filter supports the following commands:
  2294. @table @option
  2295. @item frequency, f
  2296. Change bandpass frequency.
  2297. Syntax for the command is : "@var{frequency}"
  2298. @item width_type, t
  2299. Change bandpass width_type.
  2300. Syntax for the command is : "@var{width_type}"
  2301. @item width, w
  2302. Change bandpass width.
  2303. Syntax for the command is : "@var{width}"
  2304. @item mix, m
  2305. Change bandpass mix.
  2306. Syntax for the command is : "@var{mix}"
  2307. @end table
  2308. @section bandreject
  2309. Apply a two-pole Butterworth band-reject filter with central
  2310. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2311. The filter roll off at 6dB per octave (20dB per decade).
  2312. The filter accepts the following options:
  2313. @table @option
  2314. @item frequency, f
  2315. Set the filter's central frequency. Default is @code{3000}.
  2316. @item width_type, t
  2317. Set method to specify band-width of filter.
  2318. @table @option
  2319. @item h
  2320. Hz
  2321. @item q
  2322. Q-Factor
  2323. @item o
  2324. octave
  2325. @item s
  2326. slope
  2327. @item k
  2328. kHz
  2329. @end table
  2330. @item width, w
  2331. Specify the band-width of a filter in width_type units.
  2332. @item mix, m
  2333. How much to use filtered signal in output. Default is 1.
  2334. Range is between 0 and 1.
  2335. @item channels, c
  2336. Specify which channels to filter, by default all available are filtered.
  2337. @item normalize, n
  2338. Normalize biquad coefficients, by default is disabled.
  2339. Enabling it will normalize magnitude response at DC to 0dB.
  2340. @item transform, a
  2341. Set transform type of IIR filter.
  2342. @table @option
  2343. @item di
  2344. @item dii
  2345. @item tdii
  2346. @item latt
  2347. @end table
  2348. @item precision, r
  2349. Set precison of filtering.
  2350. @table @option
  2351. @item auto
  2352. Pick automatic sample format depending on surround filters.
  2353. @item s16
  2354. Always use signed 16-bit.
  2355. @item s32
  2356. Always use signed 32-bit.
  2357. @item f32
  2358. Always use float 32-bit.
  2359. @item f64
  2360. Always use float 64-bit.
  2361. @end table
  2362. @end table
  2363. @subsection Commands
  2364. This filter supports the following commands:
  2365. @table @option
  2366. @item frequency, f
  2367. Change bandreject frequency.
  2368. Syntax for the command is : "@var{frequency}"
  2369. @item width_type, t
  2370. Change bandreject width_type.
  2371. Syntax for the command is : "@var{width_type}"
  2372. @item width, w
  2373. Change bandreject width.
  2374. Syntax for the command is : "@var{width}"
  2375. @item mix, m
  2376. Change bandreject mix.
  2377. Syntax for the command is : "@var{mix}"
  2378. @end table
  2379. @section bass, lowshelf
  2380. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2381. shelving filter with a response similar to that of a standard
  2382. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2383. The filter accepts the following options:
  2384. @table @option
  2385. @item gain, g
  2386. Give the gain at 0 Hz. Its useful range is about -20
  2387. (for a large cut) to +20 (for a large boost).
  2388. Beware of clipping when using a positive gain.
  2389. @item frequency, f
  2390. Set the filter's central frequency and so can be used
  2391. to extend or reduce the frequency range to be boosted or cut.
  2392. The default value is @code{100} Hz.
  2393. @item width_type, t
  2394. Set method to specify band-width of filter.
  2395. @table @option
  2396. @item h
  2397. Hz
  2398. @item q
  2399. Q-Factor
  2400. @item o
  2401. octave
  2402. @item s
  2403. slope
  2404. @item k
  2405. kHz
  2406. @end table
  2407. @item width, w
  2408. Determine how steep is the filter's shelf transition.
  2409. @item poles, p
  2410. Set number of poles. Default is 2.
  2411. @item mix, m
  2412. How much to use filtered signal in output. Default is 1.
  2413. Range is between 0 and 1.
  2414. @item channels, c
  2415. Specify which channels to filter, by default all available are filtered.
  2416. @item normalize, n
  2417. Normalize biquad coefficients, by default is disabled.
  2418. Enabling it will normalize magnitude response at DC to 0dB.
  2419. @item transform, a
  2420. Set transform type of IIR filter.
  2421. @table @option
  2422. @item di
  2423. @item dii
  2424. @item tdii
  2425. @item latt
  2426. @end table
  2427. @item precision, r
  2428. Set precison of filtering.
  2429. @table @option
  2430. @item auto
  2431. Pick automatic sample format depending on surround filters.
  2432. @item s16
  2433. Always use signed 16-bit.
  2434. @item s32
  2435. Always use signed 32-bit.
  2436. @item f32
  2437. Always use float 32-bit.
  2438. @item f64
  2439. Always use float 64-bit.
  2440. @end table
  2441. @end table
  2442. @subsection Commands
  2443. This filter supports the following commands:
  2444. @table @option
  2445. @item frequency, f
  2446. Change bass frequency.
  2447. Syntax for the command is : "@var{frequency}"
  2448. @item width_type, t
  2449. Change bass width_type.
  2450. Syntax for the command is : "@var{width_type}"
  2451. @item width, w
  2452. Change bass width.
  2453. Syntax for the command is : "@var{width}"
  2454. @item gain, g
  2455. Change bass gain.
  2456. Syntax for the command is : "@var{gain}"
  2457. @item mix, m
  2458. Change bass mix.
  2459. Syntax for the command is : "@var{mix}"
  2460. @end table
  2461. @section biquad
  2462. Apply a biquad IIR filter with the given coefficients.
  2463. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2464. are the numerator and denominator coefficients respectively.
  2465. and @var{channels}, @var{c} specify which channels to filter, by default all
  2466. available are filtered.
  2467. @subsection Commands
  2468. This filter supports the following commands:
  2469. @table @option
  2470. @item a0
  2471. @item a1
  2472. @item a2
  2473. @item b0
  2474. @item b1
  2475. @item b2
  2476. Change biquad parameter.
  2477. Syntax for the command is : "@var{value}"
  2478. @item mix, m
  2479. How much to use filtered signal in output. Default is 1.
  2480. Range is between 0 and 1.
  2481. @item channels, c
  2482. Specify which channels to filter, by default all available are filtered.
  2483. @item normalize, n
  2484. Normalize biquad coefficients, by default is disabled.
  2485. Enabling it will normalize magnitude response at DC to 0dB.
  2486. @item transform, a
  2487. Set transform type of IIR filter.
  2488. @table @option
  2489. @item di
  2490. @item dii
  2491. @item tdii
  2492. @item latt
  2493. @end table
  2494. @item precision, r
  2495. Set precison of filtering.
  2496. @table @option
  2497. @item auto
  2498. Pick automatic sample format depending on surround filters.
  2499. @item s16
  2500. Always use signed 16-bit.
  2501. @item s32
  2502. Always use signed 32-bit.
  2503. @item f32
  2504. Always use float 32-bit.
  2505. @item f64
  2506. Always use float 64-bit.
  2507. @end table
  2508. @end table
  2509. @section bs2b
  2510. Bauer stereo to binaural transformation, which improves headphone listening of
  2511. stereo audio records.
  2512. To enable compilation of this filter you need to configure FFmpeg with
  2513. @code{--enable-libbs2b}.
  2514. It accepts the following parameters:
  2515. @table @option
  2516. @item profile
  2517. Pre-defined crossfeed level.
  2518. @table @option
  2519. @item default
  2520. Default level (fcut=700, feed=50).
  2521. @item cmoy
  2522. Chu Moy circuit (fcut=700, feed=60).
  2523. @item jmeier
  2524. Jan Meier circuit (fcut=650, feed=95).
  2525. @end table
  2526. @item fcut
  2527. Cut frequency (in Hz).
  2528. @item feed
  2529. Feed level (in Hz).
  2530. @end table
  2531. @section channelmap
  2532. Remap input channels to new locations.
  2533. It accepts the following parameters:
  2534. @table @option
  2535. @item map
  2536. Map channels from input to output. The argument is a '|'-separated list of
  2537. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2538. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2539. channel (e.g. FL for front left) or its index in the input channel layout.
  2540. @var{out_channel} is the name of the output channel or its index in the output
  2541. channel layout. If @var{out_channel} is not given then it is implicitly an
  2542. index, starting with zero and increasing by one for each mapping.
  2543. @item channel_layout
  2544. The channel layout of the output stream.
  2545. @end table
  2546. If no mapping is present, the filter will implicitly map input channels to
  2547. output channels, preserving indices.
  2548. @subsection Examples
  2549. @itemize
  2550. @item
  2551. For example, assuming a 5.1+downmix input MOV file,
  2552. @example
  2553. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2554. @end example
  2555. will create an output WAV file tagged as stereo from the downmix channels of
  2556. the input.
  2557. @item
  2558. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2559. @example
  2560. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2561. @end example
  2562. @end itemize
  2563. @section channelsplit
  2564. Split each channel from an input audio stream into a separate output stream.
  2565. It accepts the following parameters:
  2566. @table @option
  2567. @item channel_layout
  2568. The channel layout of the input stream. The default is "stereo".
  2569. @item channels
  2570. A channel layout describing the channels to be extracted as separate output streams
  2571. or "all" to extract each input channel as a separate stream. The default is "all".
  2572. Choosing channels not present in channel layout in the input will result in an error.
  2573. @end table
  2574. @subsection Examples
  2575. @itemize
  2576. @item
  2577. For example, assuming a stereo input MP3 file,
  2578. @example
  2579. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2580. @end example
  2581. will create an output Matroska file with two audio streams, one containing only
  2582. the left channel and the other the right channel.
  2583. @item
  2584. Split a 5.1 WAV file into per-channel files:
  2585. @example
  2586. ffmpeg -i in.wav -filter_complex
  2587. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2588. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2589. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2590. side_right.wav
  2591. @end example
  2592. @item
  2593. Extract only LFE from a 5.1 WAV file:
  2594. @example
  2595. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2596. -map '[LFE]' lfe.wav
  2597. @end example
  2598. @end itemize
  2599. @section chorus
  2600. Add a chorus effect to the audio.
  2601. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2602. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2603. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2604. The modulation depth defines the range the modulated delay is played before or after
  2605. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2606. sound tuned around the original one, like in a chorus where some vocals are slightly
  2607. off key.
  2608. It accepts the following parameters:
  2609. @table @option
  2610. @item in_gain
  2611. Set input gain. Default is 0.4.
  2612. @item out_gain
  2613. Set output gain. Default is 0.4.
  2614. @item delays
  2615. Set delays. A typical delay is around 40ms to 60ms.
  2616. @item decays
  2617. Set decays.
  2618. @item speeds
  2619. Set speeds.
  2620. @item depths
  2621. Set depths.
  2622. @end table
  2623. @subsection Examples
  2624. @itemize
  2625. @item
  2626. A single delay:
  2627. @example
  2628. chorus=0.7:0.9:55:0.4:0.25:2
  2629. @end example
  2630. @item
  2631. Two delays:
  2632. @example
  2633. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2634. @end example
  2635. @item
  2636. Fuller sounding chorus with three delays:
  2637. @example
  2638. 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
  2639. @end example
  2640. @end itemize
  2641. @section compand
  2642. Compress or expand the audio's dynamic range.
  2643. It accepts the following parameters:
  2644. @table @option
  2645. @item attacks
  2646. @item decays
  2647. A list of times in seconds for each channel over which the instantaneous level
  2648. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2649. increase of volume and @var{decays} refers to decrease of volume. For most
  2650. situations, the attack time (response to the audio getting louder) should be
  2651. shorter than the decay time, because the human ear is more sensitive to sudden
  2652. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2653. a typical value for decay is 0.8 seconds.
  2654. If specified number of attacks & decays is lower than number of channels, the last
  2655. set attack/decay will be used for all remaining channels.
  2656. @item points
  2657. A list of points for the transfer function, specified in dB relative to the
  2658. maximum possible signal amplitude. Each key points list must be defined using
  2659. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2660. @code{x0/y0 x1/y1 x2/y2 ....}
  2661. The input values must be in strictly increasing order but the transfer function
  2662. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2663. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2664. function are @code{-70/-70|-60/-20|1/0}.
  2665. @item soft-knee
  2666. Set the curve radius in dB for all joints. It defaults to 0.01.
  2667. @item gain
  2668. Set the additional gain in dB to be applied at all points on the transfer
  2669. function. This allows for easy adjustment of the overall gain.
  2670. It defaults to 0.
  2671. @item volume
  2672. Set an initial volume, in dB, to be assumed for each channel when filtering
  2673. starts. This permits the user to supply a nominal level initially, so that, for
  2674. example, a very large gain is not applied to initial signal levels before the
  2675. companding has begun to operate. A typical value for audio which is initially
  2676. quiet is -90 dB. It defaults to 0.
  2677. @item delay
  2678. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2679. delayed before being fed to the volume adjuster. Specifying a delay
  2680. approximately equal to the attack/decay times allows the filter to effectively
  2681. operate in predictive rather than reactive mode. It defaults to 0.
  2682. @end table
  2683. @subsection Examples
  2684. @itemize
  2685. @item
  2686. Make music with both quiet and loud passages suitable for listening to in a
  2687. noisy environment:
  2688. @example
  2689. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2690. @end example
  2691. Another example for audio with whisper and explosion parts:
  2692. @example
  2693. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2694. @end example
  2695. @item
  2696. A noise gate for when the noise is at a lower level than the signal:
  2697. @example
  2698. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2699. @end example
  2700. @item
  2701. Here is another noise gate, this time for when the noise is at a higher level
  2702. than the signal (making it, in some ways, similar to squelch):
  2703. @example
  2704. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2705. @end example
  2706. @item
  2707. 2:1 compression starting at -6dB:
  2708. @example
  2709. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2710. @end example
  2711. @item
  2712. 2:1 compression starting at -9dB:
  2713. @example
  2714. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2715. @end example
  2716. @item
  2717. 2:1 compression starting at -12dB:
  2718. @example
  2719. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2720. @end example
  2721. @item
  2722. 2:1 compression starting at -18dB:
  2723. @example
  2724. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2725. @end example
  2726. @item
  2727. 3:1 compression starting at -15dB:
  2728. @example
  2729. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2730. @end example
  2731. @item
  2732. Compressor/Gate:
  2733. @example
  2734. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2735. @end example
  2736. @item
  2737. Expander:
  2738. @example
  2739. 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
  2740. @end example
  2741. @item
  2742. Hard limiter at -6dB:
  2743. @example
  2744. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2745. @end example
  2746. @item
  2747. Hard limiter at -12dB:
  2748. @example
  2749. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2750. @end example
  2751. @item
  2752. Hard noise gate at -35 dB:
  2753. @example
  2754. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2755. @end example
  2756. @item
  2757. Soft limiter:
  2758. @example
  2759. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2760. @end example
  2761. @end itemize
  2762. @section compensationdelay
  2763. Compensation Delay Line is a metric based delay to compensate differing
  2764. positions of microphones or speakers.
  2765. For example, you have recorded guitar with two microphones placed in
  2766. different locations. Because the front of sound wave has fixed speed in
  2767. normal conditions, the phasing of microphones can vary and depends on
  2768. their location and interposition. The best sound mix can be achieved when
  2769. these microphones are in phase (synchronized). Note that a distance of
  2770. ~30 cm between microphones makes one microphone capture the signal in
  2771. antiphase to the other microphone. That makes the final mix sound moody.
  2772. This filter helps to solve phasing problems by adding different delays
  2773. to each microphone track and make them synchronized.
  2774. The best result can be reached when you take one track as base and
  2775. synchronize other tracks one by one with it.
  2776. Remember that synchronization/delay tolerance depends on sample rate, too.
  2777. Higher sample rates will give more tolerance.
  2778. The filter accepts the following parameters:
  2779. @table @option
  2780. @item mm
  2781. Set millimeters distance. This is compensation distance for fine tuning.
  2782. Default is 0.
  2783. @item cm
  2784. Set cm distance. This is compensation distance for tightening distance setup.
  2785. Default is 0.
  2786. @item m
  2787. Set meters distance. This is compensation distance for hard distance setup.
  2788. Default is 0.
  2789. @item dry
  2790. Set dry amount. Amount of unprocessed (dry) signal.
  2791. Default is 0.
  2792. @item wet
  2793. Set wet amount. Amount of processed (wet) signal.
  2794. Default is 1.
  2795. @item temp
  2796. Set temperature in degrees Celsius. This is the temperature of the environment.
  2797. Default is 20.
  2798. @end table
  2799. @section crossfeed
  2800. Apply headphone crossfeed filter.
  2801. Crossfeed is the process of blending the left and right channels of stereo
  2802. audio recording.
  2803. It is mainly used to reduce extreme stereo separation of low frequencies.
  2804. The intent is to produce more speaker like sound to the listener.
  2805. The filter accepts the following options:
  2806. @table @option
  2807. @item strength
  2808. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2809. This sets gain of low shelf filter for side part of stereo image.
  2810. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2811. @item range
  2812. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2813. This sets cut off frequency of low shelf filter. Default is cut off near
  2814. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2815. @item slope
  2816. Set curve slope of low shelf filter. Default is 0.5.
  2817. Allowed range is from 0.01 to 1.
  2818. @item level_in
  2819. Set input gain. Default is 0.9.
  2820. @item level_out
  2821. Set output gain. Default is 1.
  2822. @end table
  2823. @subsection Commands
  2824. This filter supports the all above options as @ref{commands}.
  2825. @section crystalizer
  2826. Simple algorithm for audio noise sharpening.
  2827. This filter linearly increases differences betweeen each audio sample.
  2828. The filter accepts the following options:
  2829. @table @option
  2830. @item i
  2831. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  2832. (unchanged sound) to 10.0 (maximum effect).
  2833. To inverse filtering use negative value.
  2834. @item c
  2835. Enable clipping. By default is enabled.
  2836. @end table
  2837. @subsection Commands
  2838. This filter supports the all above options as @ref{commands}.
  2839. @section dcshift
  2840. Apply a DC shift to the audio.
  2841. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2842. in the recording chain) from the audio. The effect of a DC offset is reduced
  2843. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2844. a signal has a DC offset.
  2845. @table @option
  2846. @item shift
  2847. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2848. the audio.
  2849. @item limitergain
  2850. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2851. used to prevent clipping.
  2852. @end table
  2853. @section deesser
  2854. Apply de-essing to the audio samples.
  2855. @table @option
  2856. @item i
  2857. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2858. Default is 0.
  2859. @item m
  2860. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2861. Default is 0.5.
  2862. @item f
  2863. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2864. Default is 0.5.
  2865. @item s
  2866. Set the output mode.
  2867. It accepts the following values:
  2868. @table @option
  2869. @item i
  2870. Pass input unchanged.
  2871. @item o
  2872. Pass ess filtered out.
  2873. @item e
  2874. Pass only ess.
  2875. Default value is @var{o}.
  2876. @end table
  2877. @end table
  2878. @section drmeter
  2879. Measure audio dynamic range.
  2880. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2881. is found in transition material. And anything less that 8 have very poor dynamics
  2882. and is very compressed.
  2883. The filter accepts the following options:
  2884. @table @option
  2885. @item length
  2886. Set window length in seconds used to split audio into segments of equal length.
  2887. Default is 3 seconds.
  2888. @end table
  2889. @section dynaudnorm
  2890. Dynamic Audio Normalizer.
  2891. This filter applies a certain amount of gain to the input audio in order
  2892. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2893. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2894. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2895. This allows for applying extra gain to the "quiet" sections of the audio
  2896. while avoiding distortions or clipping the "loud" sections. In other words:
  2897. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2898. sections, in the sense that the volume of each section is brought to the
  2899. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2900. this goal *without* applying "dynamic range compressing". It will retain 100%
  2901. of the dynamic range *within* each section of the audio file.
  2902. @table @option
  2903. @item framelen, f
  2904. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2905. Default is 500 milliseconds.
  2906. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2907. referred to as frames. This is required, because a peak magnitude has no
  2908. meaning for just a single sample value. Instead, we need to determine the
  2909. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2910. normalizer would simply use the peak magnitude of the complete file, the
  2911. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2912. frame. The length of a frame is specified in milliseconds. By default, the
  2913. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2914. been found to give good results with most files.
  2915. Note that the exact frame length, in number of samples, will be determined
  2916. automatically, based on the sampling rate of the individual input audio file.
  2917. @item gausssize, g
  2918. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2919. number. Default is 31.
  2920. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2921. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2922. is specified in frames, centered around the current frame. For the sake of
  2923. simplicity, this must be an odd number. Consequently, the default value of 31
  2924. takes into account the current frame, as well as the 15 preceding frames and
  2925. the 15 subsequent frames. Using a larger window results in a stronger
  2926. smoothing effect and thus in less gain variation, i.e. slower gain
  2927. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2928. effect and thus in more gain variation, i.e. faster gain adaptation.
  2929. In other words, the more you increase this value, the more the Dynamic Audio
  2930. Normalizer will behave like a "traditional" normalization filter. On the
  2931. contrary, the more you decrease this value, the more the Dynamic Audio
  2932. Normalizer will behave like a dynamic range compressor.
  2933. @item peak, p
  2934. Set the target peak value. This specifies the highest permissible magnitude
  2935. level for the normalized audio input. This filter will try to approach the
  2936. target peak magnitude as closely as possible, but at the same time it also
  2937. makes sure that the normalized signal will never exceed the peak magnitude.
  2938. A frame's maximum local gain factor is imposed directly by the target peak
  2939. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2940. It is not recommended to go above this value.
  2941. @item maxgain, m
  2942. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2943. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2944. factor for each input frame, i.e. the maximum gain factor that does not
  2945. result in clipping or distortion. The maximum gain factor is determined by
  2946. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2947. additionally bounds the frame's maximum gain factor by a predetermined
  2948. (global) maximum gain factor. This is done in order to avoid excessive gain
  2949. factors in "silent" or almost silent frames. By default, the maximum gain
  2950. factor is 10.0, For most inputs the default value should be sufficient and
  2951. it usually is not recommended to increase this value. Though, for input
  2952. with an extremely low overall volume level, it may be necessary to allow even
  2953. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2954. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2955. Instead, a "sigmoid" threshold function will be applied. This way, the
  2956. gain factors will smoothly approach the threshold value, but never exceed that
  2957. value.
  2958. @item targetrms, r
  2959. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2960. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2961. This means that the maximum local gain factor for each frame is defined
  2962. (only) by the frame's highest magnitude sample. This way, the samples can
  2963. be amplified as much as possible without exceeding the maximum signal
  2964. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2965. Normalizer can also take into account the frame's root mean square,
  2966. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2967. determine the power of a time-varying signal. It is therefore considered
  2968. that the RMS is a better approximation of the "perceived loudness" than
  2969. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2970. frames to a constant RMS value, a uniform "perceived loudness" can be
  2971. established. If a target RMS value has been specified, a frame's local gain
  2972. factor is defined as the factor that would result in exactly that RMS value.
  2973. Note, however, that the maximum local gain factor is still restricted by the
  2974. frame's highest magnitude sample, in order to prevent clipping.
  2975. @item coupling, n
  2976. Enable channels coupling. By default is enabled.
  2977. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2978. amount. This means the same gain factor will be applied to all channels, i.e.
  2979. the maximum possible gain factor is determined by the "loudest" channel.
  2980. However, in some recordings, it may happen that the volume of the different
  2981. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2982. In this case, this option can be used to disable the channel coupling. This way,
  2983. the gain factor will be determined independently for each channel, depending
  2984. only on the individual channel's highest magnitude sample. This allows for
  2985. harmonizing the volume of the different channels.
  2986. @item correctdc, c
  2987. Enable DC bias correction. By default is disabled.
  2988. An audio signal (in the time domain) is a sequence of sample values.
  2989. In the Dynamic Audio Normalizer these sample values are represented in the
  2990. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2991. audio signal, or "waveform", should be centered around the zero point.
  2992. That means if we calculate the mean value of all samples in a file, or in a
  2993. single frame, then the result should be 0.0 or at least very close to that
  2994. value. If, however, there is a significant deviation of the mean value from
  2995. 0.0, in either positive or negative direction, this is referred to as a
  2996. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2997. Audio Normalizer provides optional DC bias correction.
  2998. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2999. the mean value, or "DC correction" offset, of each input frame and subtract
  3000. that value from all of the frame's sample values which ensures those samples
  3001. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3002. boundaries, the DC correction offset values will be interpolated smoothly
  3003. between neighbouring frames.
  3004. @item altboundary, b
  3005. Enable alternative boundary mode. By default is disabled.
  3006. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3007. around each frame. This includes the preceding frames as well as the
  3008. subsequent frames. However, for the "boundary" frames, located at the very
  3009. beginning and at the very end of the audio file, not all neighbouring
  3010. frames are available. In particular, for the first few frames in the audio
  3011. file, the preceding frames are not known. And, similarly, for the last few
  3012. frames in the audio file, the subsequent frames are not known. Thus, the
  3013. question arises which gain factors should be assumed for the missing frames
  3014. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3015. to deal with this situation. The default boundary mode assumes a gain factor
  3016. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3017. "fade out" at the beginning and at the end of the input, respectively.
  3018. @item compress, s
  3019. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3020. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3021. compression. This means that signal peaks will not be pruned and thus the
  3022. full dynamic range will be retained within each local neighbourhood. However,
  3023. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3024. normalization algorithm with a more "traditional" compression.
  3025. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3026. (thresholding) function. If (and only if) the compression feature is enabled,
  3027. all input frames will be processed by a soft knee thresholding function prior
  3028. to the actual normalization process. Put simply, the thresholding function is
  3029. going to prune all samples whose magnitude exceeds a certain threshold value.
  3030. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3031. value. Instead, the threshold value will be adjusted for each individual
  3032. frame.
  3033. In general, smaller parameters result in stronger compression, and vice versa.
  3034. Values below 3.0 are not recommended, because audible distortion may appear.
  3035. @item threshold, t
  3036. Set the target threshold value. This specifies the lowest permissible
  3037. magnitude level for the audio input which will be normalized.
  3038. If input frame volume is above this value frame will be normalized.
  3039. Otherwise frame may not be normalized at all. The default value is set
  3040. to 0, which means all input frames will be normalized.
  3041. This option is mostly useful if digital noise is not wanted to be amplified.
  3042. @end table
  3043. @subsection Commands
  3044. This filter supports the all above options as @ref{commands}.
  3045. @section earwax
  3046. Make audio easier to listen to on headphones.
  3047. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3048. so that when listened to on headphones the stereo image is moved from
  3049. inside your head (standard for headphones) to outside and in front of
  3050. the listener (standard for speakers).
  3051. Ported from SoX.
  3052. @section equalizer
  3053. Apply a two-pole peaking equalisation (EQ) filter. With this
  3054. filter, the signal-level at and around a selected frequency can
  3055. be increased or decreased, whilst (unlike bandpass and bandreject
  3056. filters) that at all other frequencies is unchanged.
  3057. In order to produce complex equalisation curves, this filter can
  3058. be given several times, each with a different central frequency.
  3059. The filter accepts the following options:
  3060. @table @option
  3061. @item frequency, f
  3062. Set the filter's central frequency in Hz.
  3063. @item width_type, t
  3064. Set method to specify band-width of filter.
  3065. @table @option
  3066. @item h
  3067. Hz
  3068. @item q
  3069. Q-Factor
  3070. @item o
  3071. octave
  3072. @item s
  3073. slope
  3074. @item k
  3075. kHz
  3076. @end table
  3077. @item width, w
  3078. Specify the band-width of a filter in width_type units.
  3079. @item gain, g
  3080. Set the required gain or attenuation in dB.
  3081. Beware of clipping when using a positive gain.
  3082. @item mix, m
  3083. How much to use filtered signal in output. Default is 1.
  3084. Range is between 0 and 1.
  3085. @item channels, c
  3086. Specify which channels to filter, by default all available are filtered.
  3087. @item normalize, n
  3088. Normalize biquad coefficients, by default is disabled.
  3089. Enabling it will normalize magnitude response at DC to 0dB.
  3090. @item transform, a
  3091. Set transform type of IIR filter.
  3092. @table @option
  3093. @item di
  3094. @item dii
  3095. @item tdii
  3096. @item latt
  3097. @end table
  3098. @item precision, r
  3099. Set precison of filtering.
  3100. @table @option
  3101. @item auto
  3102. Pick automatic sample format depending on surround filters.
  3103. @item s16
  3104. Always use signed 16-bit.
  3105. @item s32
  3106. Always use signed 32-bit.
  3107. @item f32
  3108. Always use float 32-bit.
  3109. @item f64
  3110. Always use float 64-bit.
  3111. @end table
  3112. @end table
  3113. @subsection Examples
  3114. @itemize
  3115. @item
  3116. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3117. @example
  3118. equalizer=f=1000:t=h:width=200:g=-10
  3119. @end example
  3120. @item
  3121. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3122. @example
  3123. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3124. @end example
  3125. @end itemize
  3126. @subsection Commands
  3127. This filter supports the following commands:
  3128. @table @option
  3129. @item frequency, f
  3130. Change equalizer frequency.
  3131. Syntax for the command is : "@var{frequency}"
  3132. @item width_type, t
  3133. Change equalizer width_type.
  3134. Syntax for the command is : "@var{width_type}"
  3135. @item width, w
  3136. Change equalizer width.
  3137. Syntax for the command is : "@var{width}"
  3138. @item gain, g
  3139. Change equalizer gain.
  3140. Syntax for the command is : "@var{gain}"
  3141. @item mix, m
  3142. Change equalizer mix.
  3143. Syntax for the command is : "@var{mix}"
  3144. @end table
  3145. @section extrastereo
  3146. Linearly increases the difference between left and right channels which
  3147. adds some sort of "live" effect to playback.
  3148. The filter accepts the following options:
  3149. @table @option
  3150. @item m
  3151. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3152. (average of both channels), with 1.0 sound will be unchanged, with
  3153. -1.0 left and right channels will be swapped.
  3154. @item c
  3155. Enable clipping. By default is enabled.
  3156. @end table
  3157. @subsection Commands
  3158. This filter supports the all above options as @ref{commands}.
  3159. @section firequalizer
  3160. Apply FIR Equalization using arbitrary frequency response.
  3161. The filter accepts the following option:
  3162. @table @option
  3163. @item gain
  3164. Set gain curve equation (in dB). The expression can contain variables:
  3165. @table @option
  3166. @item f
  3167. the evaluated frequency
  3168. @item sr
  3169. sample rate
  3170. @item ch
  3171. channel number, set to 0 when multichannels evaluation is disabled
  3172. @item chid
  3173. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3174. multichannels evaluation is disabled
  3175. @item chs
  3176. number of channels
  3177. @item chlayout
  3178. channel_layout, see libavutil/channel_layout.h
  3179. @end table
  3180. and functions:
  3181. @table @option
  3182. @item gain_interpolate(f)
  3183. interpolate gain on frequency f based on gain_entry
  3184. @item cubic_interpolate(f)
  3185. same as gain_interpolate, but smoother
  3186. @end table
  3187. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3188. @item gain_entry
  3189. Set gain entry for gain_interpolate function. The expression can
  3190. contain functions:
  3191. @table @option
  3192. @item entry(f, g)
  3193. store gain entry at frequency f with value g
  3194. @end table
  3195. This option is also available as command.
  3196. @item delay
  3197. Set filter delay in seconds. Higher value means more accurate.
  3198. Default is @code{0.01}.
  3199. @item accuracy
  3200. Set filter accuracy in Hz. Lower value means more accurate.
  3201. Default is @code{5}.
  3202. @item wfunc
  3203. Set window function. Acceptable values are:
  3204. @table @option
  3205. @item rectangular
  3206. rectangular window, useful when gain curve is already smooth
  3207. @item hann
  3208. hann window (default)
  3209. @item hamming
  3210. hamming window
  3211. @item blackman
  3212. blackman window
  3213. @item nuttall3
  3214. 3-terms continuous 1st derivative nuttall window
  3215. @item mnuttall3
  3216. minimum 3-terms discontinuous nuttall window
  3217. @item nuttall
  3218. 4-terms continuous 1st derivative nuttall window
  3219. @item bnuttall
  3220. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3221. @item bharris
  3222. blackman-harris window
  3223. @item tukey
  3224. tukey window
  3225. @end table
  3226. @item fixed
  3227. If enabled, use fixed number of audio samples. This improves speed when
  3228. filtering with large delay. Default is disabled.
  3229. @item multi
  3230. Enable multichannels evaluation on gain. Default is disabled.
  3231. @item zero_phase
  3232. Enable zero phase mode by subtracting timestamp to compensate delay.
  3233. Default is disabled.
  3234. @item scale
  3235. Set scale used by gain. Acceptable values are:
  3236. @table @option
  3237. @item linlin
  3238. linear frequency, linear gain
  3239. @item linlog
  3240. linear frequency, logarithmic (in dB) gain (default)
  3241. @item loglin
  3242. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3243. @item loglog
  3244. logarithmic frequency, logarithmic gain
  3245. @end table
  3246. @item dumpfile
  3247. Set file for dumping, suitable for gnuplot.
  3248. @item dumpscale
  3249. Set scale for dumpfile. Acceptable values are same with scale option.
  3250. Default is linlog.
  3251. @item fft2
  3252. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3253. Default is disabled.
  3254. @item min_phase
  3255. Enable minimum phase impulse response. Default is disabled.
  3256. @end table
  3257. @subsection Examples
  3258. @itemize
  3259. @item
  3260. lowpass at 1000 Hz:
  3261. @example
  3262. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3263. @end example
  3264. @item
  3265. lowpass at 1000 Hz with gain_entry:
  3266. @example
  3267. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3268. @end example
  3269. @item
  3270. custom equalization:
  3271. @example
  3272. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3273. @end example
  3274. @item
  3275. higher delay with zero phase to compensate delay:
  3276. @example
  3277. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3278. @end example
  3279. @item
  3280. lowpass on left channel, highpass on right channel:
  3281. @example
  3282. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3283. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3284. @end example
  3285. @end itemize
  3286. @section flanger
  3287. Apply a flanging effect to the audio.
  3288. The filter accepts the following options:
  3289. @table @option
  3290. @item delay
  3291. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3292. @item depth
  3293. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3294. @item regen
  3295. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3296. Default value is 0.
  3297. @item width
  3298. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3299. Default value is 71.
  3300. @item speed
  3301. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3302. @item shape
  3303. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3304. Default value is @var{sinusoidal}.
  3305. @item phase
  3306. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3307. Default value is 25.
  3308. @item interp
  3309. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3310. Default is @var{linear}.
  3311. @end table
  3312. @section haas
  3313. Apply Haas effect to audio.
  3314. Note that this makes most sense to apply on mono signals.
  3315. With this filter applied to mono signals it give some directionality and
  3316. stretches its stereo image.
  3317. The filter accepts the following options:
  3318. @table @option
  3319. @item level_in
  3320. Set input level. By default is @var{1}, or 0dB
  3321. @item level_out
  3322. Set output level. By default is @var{1}, or 0dB.
  3323. @item side_gain
  3324. Set gain applied to side part of signal. By default is @var{1}.
  3325. @item middle_source
  3326. Set kind of middle source. Can be one of the following:
  3327. @table @samp
  3328. @item left
  3329. Pick left channel.
  3330. @item right
  3331. Pick right channel.
  3332. @item mid
  3333. Pick middle part signal of stereo image.
  3334. @item side
  3335. Pick side part signal of stereo image.
  3336. @end table
  3337. @item middle_phase
  3338. Change middle phase. By default is disabled.
  3339. @item left_delay
  3340. Set left channel delay. By default is @var{2.05} milliseconds.
  3341. @item left_balance
  3342. Set left channel balance. By default is @var{-1}.
  3343. @item left_gain
  3344. Set left channel gain. By default is @var{1}.
  3345. @item left_phase
  3346. Change left phase. By default is disabled.
  3347. @item right_delay
  3348. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3349. @item right_balance
  3350. Set right channel balance. By default is @var{1}.
  3351. @item right_gain
  3352. Set right channel gain. By default is @var{1}.
  3353. @item right_phase
  3354. Change right phase. By default is enabled.
  3355. @end table
  3356. @section hdcd
  3357. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3358. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3359. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3360. of HDCD, and detects the Transient Filter flag.
  3361. @example
  3362. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3363. @end example
  3364. When using the filter with wav, note the default encoding for wav is 16-bit,
  3365. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3366. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3367. @example
  3368. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3369. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3370. @end example
  3371. The filter accepts the following options:
  3372. @table @option
  3373. @item disable_autoconvert
  3374. Disable any automatic format conversion or resampling in the filter graph.
  3375. @item process_stereo
  3376. Process the stereo channels together. If target_gain does not match between
  3377. channels, consider it invalid and use the last valid target_gain.
  3378. @item cdt_ms
  3379. Set the code detect timer period in ms.
  3380. @item force_pe
  3381. Always extend peaks above -3dBFS even if PE isn't signaled.
  3382. @item analyze_mode
  3383. Replace audio with a solid tone and adjust the amplitude to signal some
  3384. specific aspect of the decoding process. The output file can be loaded in
  3385. an audio editor alongside the original to aid analysis.
  3386. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3387. Modes are:
  3388. @table @samp
  3389. @item 0, off
  3390. Disabled
  3391. @item 1, lle
  3392. Gain adjustment level at each sample
  3393. @item 2, pe
  3394. Samples where peak extend occurs
  3395. @item 3, cdt
  3396. Samples where the code detect timer is active
  3397. @item 4, tgm
  3398. Samples where the target gain does not match between channels
  3399. @end table
  3400. @end table
  3401. @section headphone
  3402. Apply head-related transfer functions (HRTFs) to create virtual
  3403. loudspeakers around the user for binaural listening via headphones.
  3404. The HRIRs are provided via additional streams, for each channel
  3405. one stereo input stream is needed.
  3406. The filter accepts the following options:
  3407. @table @option
  3408. @item map
  3409. Set mapping of input streams for convolution.
  3410. The argument is a '|'-separated list of channel names in order as they
  3411. are given as additional stream inputs for filter.
  3412. This also specify number of input streams. Number of input streams
  3413. must be not less than number of channels in first stream plus one.
  3414. @item gain
  3415. Set gain applied to audio. Value is in dB. Default is 0.
  3416. @item type
  3417. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3418. processing audio in time domain which is slow.
  3419. @var{freq} is processing audio in frequency domain which is fast.
  3420. Default is @var{freq}.
  3421. @item lfe
  3422. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3423. @item size
  3424. Set size of frame in number of samples which will be processed at once.
  3425. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3426. @item hrir
  3427. Set format of hrir stream.
  3428. Default value is @var{stereo}. Alternative value is @var{multich}.
  3429. If value is set to @var{stereo}, number of additional streams should
  3430. be greater or equal to number of input channels in first input stream.
  3431. Also each additional stream should have stereo number of channels.
  3432. If value is set to @var{multich}, number of additional streams should
  3433. be exactly one. Also number of input channels of additional stream
  3434. should be equal or greater than twice number of channels of first input
  3435. stream.
  3436. @end table
  3437. @subsection Examples
  3438. @itemize
  3439. @item
  3440. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3441. each amovie filter use stereo file with IR coefficients as input.
  3442. The files give coefficients for each position of virtual loudspeaker:
  3443. @example
  3444. ffmpeg -i input.wav
  3445. -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"
  3446. output.wav
  3447. @end example
  3448. @item
  3449. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3450. but now in @var{multich} @var{hrir} format.
  3451. @example
  3452. 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"
  3453. output.wav
  3454. @end example
  3455. @end itemize
  3456. @section highpass
  3457. Apply a high-pass filter with 3dB point frequency.
  3458. The filter can be either single-pole, or double-pole (the default).
  3459. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3460. The filter accepts the following options:
  3461. @table @option
  3462. @item frequency, f
  3463. Set frequency in Hz. Default is 3000.
  3464. @item poles, p
  3465. Set number of poles. Default is 2.
  3466. @item width_type, t
  3467. Set method to specify band-width of filter.
  3468. @table @option
  3469. @item h
  3470. Hz
  3471. @item q
  3472. Q-Factor
  3473. @item o
  3474. octave
  3475. @item s
  3476. slope
  3477. @item k
  3478. kHz
  3479. @end table
  3480. @item width, w
  3481. Specify the band-width of a filter in width_type units.
  3482. Applies only to double-pole filter.
  3483. The default is 0.707q and gives a Butterworth response.
  3484. @item mix, m
  3485. How much to use filtered signal in output. Default is 1.
  3486. Range is between 0 and 1.
  3487. @item channels, c
  3488. Specify which channels to filter, by default all available are filtered.
  3489. @item normalize, n
  3490. Normalize biquad coefficients, by default is disabled.
  3491. Enabling it will normalize magnitude response at DC to 0dB.
  3492. @item transform, a
  3493. Set transform type of IIR filter.
  3494. @table @option
  3495. @item di
  3496. @item dii
  3497. @item tdii
  3498. @item latt
  3499. @end table
  3500. @item precision, r
  3501. Set precison of filtering.
  3502. @table @option
  3503. @item auto
  3504. Pick automatic sample format depending on surround filters.
  3505. @item s16
  3506. Always use signed 16-bit.
  3507. @item s32
  3508. Always use signed 32-bit.
  3509. @item f32
  3510. Always use float 32-bit.
  3511. @item f64
  3512. Always use float 64-bit.
  3513. @end table
  3514. @end table
  3515. @subsection Commands
  3516. This filter supports the following commands:
  3517. @table @option
  3518. @item frequency, f
  3519. Change highpass frequency.
  3520. Syntax for the command is : "@var{frequency}"
  3521. @item width_type, t
  3522. Change highpass width_type.
  3523. Syntax for the command is : "@var{width_type}"
  3524. @item width, w
  3525. Change highpass width.
  3526. Syntax for the command is : "@var{width}"
  3527. @item mix, m
  3528. Change highpass mix.
  3529. Syntax for the command is : "@var{mix}"
  3530. @end table
  3531. @section join
  3532. Join multiple input streams into one multi-channel stream.
  3533. It accepts the following parameters:
  3534. @table @option
  3535. @item inputs
  3536. The number of input streams. It defaults to 2.
  3537. @item channel_layout
  3538. The desired output channel layout. It defaults to stereo.
  3539. @item map
  3540. Map channels from inputs to output. The argument is a '|'-separated list of
  3541. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3542. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3543. can be either the name of the input channel (e.g. FL for front left) or its
  3544. index in the specified input stream. @var{out_channel} is the name of the output
  3545. channel.
  3546. @end table
  3547. The filter will attempt to guess the mappings when they are not specified
  3548. explicitly. It does so by first trying to find an unused matching input channel
  3549. and if that fails it picks the first unused input channel.
  3550. Join 3 inputs (with properly set channel layouts):
  3551. @example
  3552. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3553. @end example
  3554. Build a 5.1 output from 6 single-channel streams:
  3555. @example
  3556. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3557. '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'
  3558. out
  3559. @end example
  3560. @section ladspa
  3561. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3562. To enable compilation of this filter you need to configure FFmpeg with
  3563. @code{--enable-ladspa}.
  3564. @table @option
  3565. @item file, f
  3566. Specifies the name of LADSPA plugin library to load. If the environment
  3567. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3568. each one of the directories specified by the colon separated list in
  3569. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3570. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3571. @file{/usr/lib/ladspa/}.
  3572. @item plugin, p
  3573. Specifies the plugin within the library. Some libraries contain only
  3574. one plugin, but others contain many of them. If this is not set filter
  3575. will list all available plugins within the specified library.
  3576. @item controls, c
  3577. Set the '|' separated list of controls which are zero or more floating point
  3578. values that determine the behavior of the loaded plugin (for example delay,
  3579. threshold or gain).
  3580. Controls need to be defined using the following syntax:
  3581. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3582. @var{valuei} is the value set on the @var{i}-th control.
  3583. Alternatively they can be also defined using the following syntax:
  3584. @var{value0}|@var{value1}|@var{value2}|..., where
  3585. @var{valuei} is the value set on the @var{i}-th control.
  3586. If @option{controls} is set to @code{help}, all available controls and
  3587. their valid ranges are printed.
  3588. @item sample_rate, s
  3589. Specify the sample rate, default to 44100. Only used if plugin have
  3590. zero inputs.
  3591. @item nb_samples, n
  3592. Set the number of samples per channel per each output frame, default
  3593. is 1024. Only used if plugin have zero inputs.
  3594. @item duration, d
  3595. Set the minimum duration of the sourced audio. See
  3596. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3597. for the accepted syntax.
  3598. Note that the resulting duration may be greater than the specified duration,
  3599. as the generated audio is always cut at the end of a complete frame.
  3600. If not specified, or the expressed duration is negative, the audio is
  3601. supposed to be generated forever.
  3602. Only used if plugin have zero inputs.
  3603. @item latency, l
  3604. Enable latency compensation, by default is disabled.
  3605. Only used if plugin have inputs.
  3606. @end table
  3607. @subsection Examples
  3608. @itemize
  3609. @item
  3610. List all available plugins within amp (LADSPA example plugin) library:
  3611. @example
  3612. ladspa=file=amp
  3613. @end example
  3614. @item
  3615. List all available controls and their valid ranges for @code{vcf_notch}
  3616. plugin from @code{VCF} library:
  3617. @example
  3618. ladspa=f=vcf:p=vcf_notch:c=help
  3619. @end example
  3620. @item
  3621. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3622. plugin library:
  3623. @example
  3624. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3625. @end example
  3626. @item
  3627. Add reverberation to the audio using TAP-plugins
  3628. (Tom's Audio Processing plugins):
  3629. @example
  3630. ladspa=file=tap_reverb:tap_reverb
  3631. @end example
  3632. @item
  3633. Generate white noise, with 0.2 amplitude:
  3634. @example
  3635. ladspa=file=cmt:noise_source_white:c=c0=.2
  3636. @end example
  3637. @item
  3638. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3639. @code{C* Audio Plugin Suite} (CAPS) library:
  3640. @example
  3641. ladspa=file=caps:Click:c=c1=20'
  3642. @end example
  3643. @item
  3644. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3645. @example
  3646. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3647. @end example
  3648. @item
  3649. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3650. @code{SWH Plugins} collection:
  3651. @example
  3652. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3653. @end example
  3654. @item
  3655. Attenuate low frequencies using Multiband EQ from Steve Harris
  3656. @code{SWH Plugins} collection:
  3657. @example
  3658. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3659. @end example
  3660. @item
  3661. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3662. (CAPS) library:
  3663. @example
  3664. ladspa=caps:Narrower
  3665. @end example
  3666. @item
  3667. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3668. @example
  3669. ladspa=caps:White:.2
  3670. @end example
  3671. @item
  3672. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3673. @example
  3674. ladspa=caps:Fractal:c=c1=1
  3675. @end example
  3676. @item
  3677. Dynamic volume normalization using @code{VLevel} plugin:
  3678. @example
  3679. ladspa=vlevel-ladspa:vlevel_mono
  3680. @end example
  3681. @end itemize
  3682. @subsection Commands
  3683. This filter supports the following commands:
  3684. @table @option
  3685. @item cN
  3686. Modify the @var{N}-th control value.
  3687. If the specified value is not valid, it is ignored and prior one is kept.
  3688. @end table
  3689. @section loudnorm
  3690. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3691. Support for both single pass (livestreams, files) and double pass (files) modes.
  3692. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3693. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3694. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3695. The filter accepts the following options:
  3696. @table @option
  3697. @item I, i
  3698. Set integrated loudness target.
  3699. Range is -70.0 - -5.0. Default value is -24.0.
  3700. @item LRA, lra
  3701. Set loudness range target.
  3702. Range is 1.0 - 20.0. Default value is 7.0.
  3703. @item TP, tp
  3704. Set maximum true peak.
  3705. Range is -9.0 - +0.0. Default value is -2.0.
  3706. @item measured_I, measured_i
  3707. Measured IL of input file.
  3708. Range is -99.0 - +0.0.
  3709. @item measured_LRA, measured_lra
  3710. Measured LRA of input file.
  3711. Range is 0.0 - 99.0.
  3712. @item measured_TP, measured_tp
  3713. Measured true peak of input file.
  3714. Range is -99.0 - +99.0.
  3715. @item measured_thresh
  3716. Measured threshold of input file.
  3717. Range is -99.0 - +0.0.
  3718. @item offset
  3719. Set offset gain. Gain is applied before the true-peak limiter.
  3720. Range is -99.0 - +99.0. Default is +0.0.
  3721. @item linear
  3722. Normalize by linearly scaling the source audio.
  3723. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3724. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3725. be lower than source LRA and the change in integrated loudness shouldn't
  3726. result in a true peak which exceeds the target TP. If any of these
  3727. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3728. Options are @code{true} or @code{false}. Default is @code{true}.
  3729. @item dual_mono
  3730. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3731. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3732. If set to @code{true}, this option will compensate for this effect.
  3733. Multi-channel input files are not affected by this option.
  3734. Options are true or false. Default is false.
  3735. @item print_format
  3736. Set print format for stats. Options are summary, json, or none.
  3737. Default value is none.
  3738. @end table
  3739. @section lowpass
  3740. Apply a low-pass filter with 3dB point frequency.
  3741. The filter can be either single-pole or double-pole (the default).
  3742. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3743. The filter accepts the following options:
  3744. @table @option
  3745. @item frequency, f
  3746. Set frequency in Hz. Default is 500.
  3747. @item poles, p
  3748. Set number of poles. Default is 2.
  3749. @item width_type, t
  3750. Set method to specify band-width of filter.
  3751. @table @option
  3752. @item h
  3753. Hz
  3754. @item q
  3755. Q-Factor
  3756. @item o
  3757. octave
  3758. @item s
  3759. slope
  3760. @item k
  3761. kHz
  3762. @end table
  3763. @item width, w
  3764. Specify the band-width of a filter in width_type units.
  3765. Applies only to double-pole filter.
  3766. The default is 0.707q and gives a Butterworth response.
  3767. @item mix, m
  3768. How much to use filtered signal in output. Default is 1.
  3769. Range is between 0 and 1.
  3770. @item channels, c
  3771. Specify which channels to filter, by default all available are filtered.
  3772. @item normalize, n
  3773. Normalize biquad coefficients, by default is disabled.
  3774. Enabling it will normalize magnitude response at DC to 0dB.
  3775. @item transform, a
  3776. Set transform type of IIR filter.
  3777. @table @option
  3778. @item di
  3779. @item dii
  3780. @item tdii
  3781. @item latt
  3782. @end table
  3783. @item precision, r
  3784. Set precison of filtering.
  3785. @table @option
  3786. @item auto
  3787. Pick automatic sample format depending on surround filters.
  3788. @item s16
  3789. Always use signed 16-bit.
  3790. @item s32
  3791. Always use signed 32-bit.
  3792. @item f32
  3793. Always use float 32-bit.
  3794. @item f64
  3795. Always use float 64-bit.
  3796. @end table
  3797. @end table
  3798. @subsection Examples
  3799. @itemize
  3800. @item
  3801. Lowpass only LFE channel, it LFE is not present it does nothing:
  3802. @example
  3803. lowpass=c=LFE
  3804. @end example
  3805. @end itemize
  3806. @subsection Commands
  3807. This filter supports the following commands:
  3808. @table @option
  3809. @item frequency, f
  3810. Change lowpass frequency.
  3811. Syntax for the command is : "@var{frequency}"
  3812. @item width_type, t
  3813. Change lowpass width_type.
  3814. Syntax for the command is : "@var{width_type}"
  3815. @item width, w
  3816. Change lowpass width.
  3817. Syntax for the command is : "@var{width}"
  3818. @item mix, m
  3819. Change lowpass mix.
  3820. Syntax for the command is : "@var{mix}"
  3821. @end table
  3822. @section lv2
  3823. Load a LV2 (LADSPA Version 2) plugin.
  3824. To enable compilation of this filter you need to configure FFmpeg with
  3825. @code{--enable-lv2}.
  3826. @table @option
  3827. @item plugin, p
  3828. Specifies the plugin URI. You may need to escape ':'.
  3829. @item controls, c
  3830. Set the '|' separated list of controls which are zero or more floating point
  3831. values that determine the behavior of the loaded plugin (for example delay,
  3832. threshold or gain).
  3833. If @option{controls} is set to @code{help}, all available controls and
  3834. their valid ranges are printed.
  3835. @item sample_rate, s
  3836. Specify the sample rate, default to 44100. Only used if plugin have
  3837. zero inputs.
  3838. @item nb_samples, n
  3839. Set the number of samples per channel per each output frame, default
  3840. is 1024. Only used if plugin have zero inputs.
  3841. @item duration, d
  3842. Set the minimum duration of the sourced audio. See
  3843. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3844. for the accepted syntax.
  3845. Note that the resulting duration may be greater than the specified duration,
  3846. as the generated audio is always cut at the end of a complete frame.
  3847. If not specified, or the expressed duration is negative, the audio is
  3848. supposed to be generated forever.
  3849. Only used if plugin have zero inputs.
  3850. @end table
  3851. @subsection Examples
  3852. @itemize
  3853. @item
  3854. Apply bass enhancer plugin from Calf:
  3855. @example
  3856. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3857. @end example
  3858. @item
  3859. Apply vinyl plugin from Calf:
  3860. @example
  3861. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3862. @end example
  3863. @item
  3864. Apply bit crusher plugin from ArtyFX:
  3865. @example
  3866. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3867. @end example
  3868. @end itemize
  3869. @section mcompand
  3870. Multiband Compress or expand the audio's dynamic range.
  3871. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3872. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3873. response when absent compander action.
  3874. It accepts the following parameters:
  3875. @table @option
  3876. @item args
  3877. This option syntax is:
  3878. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3879. For explanation of each item refer to compand filter documentation.
  3880. @end table
  3881. @anchor{pan}
  3882. @section pan
  3883. Mix channels with specific gain levels. The filter accepts the output
  3884. channel layout followed by a set of channels definitions.
  3885. This filter is also designed to efficiently remap the channels of an audio
  3886. stream.
  3887. The filter accepts parameters of the form:
  3888. "@var{l}|@var{outdef}|@var{outdef}|..."
  3889. @table @option
  3890. @item l
  3891. output channel layout or number of channels
  3892. @item outdef
  3893. output channel specification, of the form:
  3894. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3895. @item out_name
  3896. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3897. number (c0, c1, etc.)
  3898. @item gain
  3899. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3900. @item in_name
  3901. input channel to use, see out_name for details; it is not possible to mix
  3902. named and numbered input channels
  3903. @end table
  3904. If the `=' in a channel specification is replaced by `<', then the gains for
  3905. that specification will be renormalized so that the total is 1, thus
  3906. avoiding clipping noise.
  3907. @subsection Mixing examples
  3908. For example, if you want to down-mix from stereo to mono, but with a bigger
  3909. factor for the left channel:
  3910. @example
  3911. pan=1c|c0=0.9*c0+0.1*c1
  3912. @end example
  3913. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3914. 7-channels surround:
  3915. @example
  3916. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3917. @end example
  3918. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3919. that should be preferred (see "-ac" option) unless you have very specific
  3920. needs.
  3921. @subsection Remapping examples
  3922. The channel remapping will be effective if, and only if:
  3923. @itemize
  3924. @item gain coefficients are zeroes or ones,
  3925. @item only one input per channel output,
  3926. @end itemize
  3927. If all these conditions are satisfied, the filter will notify the user ("Pure
  3928. channel mapping detected"), and use an optimized and lossless method to do the
  3929. remapping.
  3930. For example, if you have a 5.1 source and want a stereo audio stream by
  3931. dropping the extra channels:
  3932. @example
  3933. pan="stereo| c0=FL | c1=FR"
  3934. @end example
  3935. Given the same source, you can also switch front left and front right channels
  3936. and keep the input channel layout:
  3937. @example
  3938. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3939. @end example
  3940. If the input is a stereo audio stream, you can mute the front left channel (and
  3941. still keep the stereo channel layout) with:
  3942. @example
  3943. pan="stereo|c1=c1"
  3944. @end example
  3945. Still with a stereo audio stream input, you can copy the right channel in both
  3946. front left and right:
  3947. @example
  3948. pan="stereo| c0=FR | c1=FR"
  3949. @end example
  3950. @section replaygain
  3951. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3952. outputs it unchanged.
  3953. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3954. @section resample
  3955. Convert the audio sample format, sample rate and channel layout. It is
  3956. not meant to be used directly.
  3957. @section rubberband
  3958. Apply time-stretching and pitch-shifting with librubberband.
  3959. To enable compilation of this filter, you need to configure FFmpeg with
  3960. @code{--enable-librubberband}.
  3961. The filter accepts the following options:
  3962. @table @option
  3963. @item tempo
  3964. Set tempo scale factor.
  3965. @item pitch
  3966. Set pitch scale factor.
  3967. @item transients
  3968. Set transients detector.
  3969. Possible values are:
  3970. @table @var
  3971. @item crisp
  3972. @item mixed
  3973. @item smooth
  3974. @end table
  3975. @item detector
  3976. Set detector.
  3977. Possible values are:
  3978. @table @var
  3979. @item compound
  3980. @item percussive
  3981. @item soft
  3982. @end table
  3983. @item phase
  3984. Set phase.
  3985. Possible values are:
  3986. @table @var
  3987. @item laminar
  3988. @item independent
  3989. @end table
  3990. @item window
  3991. Set processing window size.
  3992. Possible values are:
  3993. @table @var
  3994. @item standard
  3995. @item short
  3996. @item long
  3997. @end table
  3998. @item smoothing
  3999. Set smoothing.
  4000. Possible values are:
  4001. @table @var
  4002. @item off
  4003. @item on
  4004. @end table
  4005. @item formant
  4006. Enable formant preservation when shift pitching.
  4007. Possible values are:
  4008. @table @var
  4009. @item shifted
  4010. @item preserved
  4011. @end table
  4012. @item pitchq
  4013. Set pitch quality.
  4014. Possible values are:
  4015. @table @var
  4016. @item quality
  4017. @item speed
  4018. @item consistency
  4019. @end table
  4020. @item channels
  4021. Set channels.
  4022. Possible values are:
  4023. @table @var
  4024. @item apart
  4025. @item together
  4026. @end table
  4027. @end table
  4028. @subsection Commands
  4029. This filter supports the following commands:
  4030. @table @option
  4031. @item tempo
  4032. Change filter tempo scale factor.
  4033. Syntax for the command is : "@var{tempo}"
  4034. @item pitch
  4035. Change filter pitch scale factor.
  4036. Syntax for the command is : "@var{pitch}"
  4037. @end table
  4038. @section sidechaincompress
  4039. This filter acts like normal compressor but has the ability to compress
  4040. detected signal using second input signal.
  4041. It needs two input streams and returns one output stream.
  4042. First input stream will be processed depending on second stream signal.
  4043. The filtered signal then can be filtered with other filters in later stages of
  4044. processing. See @ref{pan} and @ref{amerge} filter.
  4045. The filter accepts the following options:
  4046. @table @option
  4047. @item level_in
  4048. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4049. @item mode
  4050. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4051. Default is @code{downward}.
  4052. @item threshold
  4053. If a signal of second stream raises above this level it will affect the gain
  4054. reduction of first stream.
  4055. By default is 0.125. Range is between 0.00097563 and 1.
  4056. @item ratio
  4057. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4058. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4059. Default is 2. Range is between 1 and 20.
  4060. @item attack
  4061. Amount of milliseconds the signal has to rise above the threshold before gain
  4062. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4063. @item release
  4064. Amount of milliseconds the signal has to fall below the threshold before
  4065. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4066. @item makeup
  4067. Set the amount by how much signal will be amplified after processing.
  4068. Default is 1. Range is from 1 to 64.
  4069. @item knee
  4070. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4071. Default is 2.82843. Range is between 1 and 8.
  4072. @item link
  4073. Choose if the @code{average} level between all channels of side-chain stream
  4074. or the louder(@code{maximum}) channel of side-chain stream affects the
  4075. reduction. Default is @code{average}.
  4076. @item detection
  4077. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4078. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4079. @item level_sc
  4080. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4081. @item mix
  4082. How much to use compressed signal in output. Default is 1.
  4083. Range is between 0 and 1.
  4084. @end table
  4085. @subsection Commands
  4086. This filter supports the all above options as @ref{commands}.
  4087. @subsection Examples
  4088. @itemize
  4089. @item
  4090. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4091. depending on the signal of 2nd input and later compressed signal to be
  4092. merged with 2nd input:
  4093. @example
  4094. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4095. @end example
  4096. @end itemize
  4097. @section sidechaingate
  4098. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4099. filter the detected signal before sending it to the gain reduction stage.
  4100. Normally a gate uses the full range signal to detect a level above the
  4101. threshold.
  4102. For example: If you cut all lower frequencies from your sidechain signal
  4103. the gate will decrease the volume of your track only if not enough highs
  4104. appear. With this technique you are able to reduce the resonation of a
  4105. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4106. guitar.
  4107. It needs two input streams and returns one output stream.
  4108. First input stream will be processed depending on second stream signal.
  4109. The filter accepts the following options:
  4110. @table @option
  4111. @item level_in
  4112. Set input level before filtering.
  4113. Default is 1. Allowed range is from 0.015625 to 64.
  4114. @item mode
  4115. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4116. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4117. will be amplified, expanding dynamic range in upward direction.
  4118. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4119. @item range
  4120. Set the level of gain reduction when the signal is below the threshold.
  4121. Default is 0.06125. Allowed range is from 0 to 1.
  4122. Setting this to 0 disables reduction and then filter behaves like expander.
  4123. @item threshold
  4124. If a signal rises above this level the gain reduction is released.
  4125. Default is 0.125. Allowed range is from 0 to 1.
  4126. @item ratio
  4127. Set a ratio about which the signal is reduced.
  4128. Default is 2. Allowed range is from 1 to 9000.
  4129. @item attack
  4130. Amount of milliseconds the signal has to rise above the threshold before gain
  4131. reduction stops.
  4132. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4133. @item release
  4134. Amount of milliseconds the signal has to fall below the threshold before the
  4135. reduction is increased again. Default is 250 milliseconds.
  4136. Allowed range is from 0.01 to 9000.
  4137. @item makeup
  4138. Set amount of amplification of signal after processing.
  4139. Default is 1. Allowed range is from 1 to 64.
  4140. @item knee
  4141. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4142. Default is 2.828427125. Allowed range is from 1 to 8.
  4143. @item detection
  4144. Choose if exact signal should be taken for detection or an RMS like one.
  4145. Default is rms. Can be peak or rms.
  4146. @item link
  4147. Choose if the average level between all channels or the louder channel affects
  4148. the reduction.
  4149. Default is average. Can be average or maximum.
  4150. @item level_sc
  4151. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4152. @end table
  4153. @subsection Commands
  4154. This filter supports the all above options as @ref{commands}.
  4155. @section silencedetect
  4156. Detect silence in an audio stream.
  4157. This filter logs a message when it detects that the input audio volume is less
  4158. or equal to a noise tolerance value for a duration greater or equal to the
  4159. minimum detected noise duration.
  4160. The printed times and duration are expressed in seconds. The
  4161. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4162. is set on the first frame whose timestamp equals or exceeds the detection
  4163. duration and it contains the timestamp of the first frame of the silence.
  4164. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4165. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4166. keys are set on the first frame after the silence. If @option{mono} is
  4167. enabled, and each channel is evaluated separately, the @code{.X}
  4168. suffixed keys are used, and @code{X} corresponds to the channel number.
  4169. The filter accepts the following options:
  4170. @table @option
  4171. @item noise, n
  4172. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4173. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4174. @item duration, d
  4175. Set silence duration until notification (default is 2 seconds). See
  4176. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4177. for the accepted syntax.
  4178. @item mono, m
  4179. Process each channel separately, instead of combined. By default is disabled.
  4180. @end table
  4181. @subsection Examples
  4182. @itemize
  4183. @item
  4184. Detect 5 seconds of silence with -50dB noise tolerance:
  4185. @example
  4186. silencedetect=n=-50dB:d=5
  4187. @end example
  4188. @item
  4189. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4190. tolerance in @file{silence.mp3}:
  4191. @example
  4192. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4193. @end example
  4194. @end itemize
  4195. @section silenceremove
  4196. Remove silence from the beginning, middle or end of the audio.
  4197. The filter accepts the following options:
  4198. @table @option
  4199. @item start_periods
  4200. This value is used to indicate if audio should be trimmed at beginning of
  4201. the audio. A value of zero indicates no silence should be trimmed from the
  4202. beginning. When specifying a non-zero value, it trims audio up until it
  4203. finds non-silence. Normally, when trimming silence from beginning of audio
  4204. the @var{start_periods} will be @code{1} but it can be increased to higher
  4205. values to trim all audio up to specific count of non-silence periods.
  4206. Default value is @code{0}.
  4207. @item start_duration
  4208. Specify the amount of time that non-silence must be detected before it stops
  4209. trimming audio. By increasing the duration, bursts of noises can be treated
  4210. as silence and trimmed off. Default value is @code{0}.
  4211. @item start_threshold
  4212. This indicates what sample value should be treated as silence. For digital
  4213. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4214. you may wish to increase the value to account for background noise.
  4215. Can be specified in dB (in case "dB" is appended to the specified value)
  4216. or amplitude ratio. Default value is @code{0}.
  4217. @item start_silence
  4218. Specify max duration of silence at beginning that will be kept after
  4219. trimming. Default is 0, which is equal to trimming all samples detected
  4220. as silence.
  4221. @item start_mode
  4222. Specify mode of detection of silence end in start of multi-channel audio.
  4223. Can be @var{any} or @var{all}. Default is @var{any}.
  4224. With @var{any}, any sample that is detected as non-silence will cause
  4225. stopped trimming of silence.
  4226. With @var{all}, only if all channels are detected as non-silence will cause
  4227. stopped trimming of silence.
  4228. @item stop_periods
  4229. Set the count for trimming silence from the end of audio.
  4230. To remove silence from the middle of a file, specify a @var{stop_periods}
  4231. that is negative. This value is then treated as a positive value and is
  4232. used to indicate the effect should restart processing as specified by
  4233. @var{start_periods}, making it suitable for removing periods of silence
  4234. in the middle of the audio.
  4235. Default value is @code{0}.
  4236. @item stop_duration
  4237. Specify a duration of silence that must exist before audio is not copied any
  4238. more. By specifying a higher duration, silence that is wanted can be left in
  4239. the audio.
  4240. Default value is @code{0}.
  4241. @item stop_threshold
  4242. This is the same as @option{start_threshold} but for trimming silence from
  4243. the end of audio.
  4244. Can be specified in dB (in case "dB" is appended to the specified value)
  4245. or amplitude ratio. Default value is @code{0}.
  4246. @item stop_silence
  4247. Specify max duration of silence at end that will be kept after
  4248. trimming. Default is 0, which is equal to trimming all samples detected
  4249. as silence.
  4250. @item stop_mode
  4251. Specify mode of detection of silence start in end of multi-channel audio.
  4252. Can be @var{any} or @var{all}. Default is @var{any}.
  4253. With @var{any}, any sample that is detected as non-silence will cause
  4254. stopped trimming of silence.
  4255. With @var{all}, only if all channels are detected as non-silence will cause
  4256. stopped trimming of silence.
  4257. @item detection
  4258. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4259. and works better with digital silence which is exactly 0.
  4260. Default value is @code{rms}.
  4261. @item window
  4262. Set duration in number of seconds used to calculate size of window in number
  4263. of samples for detecting silence.
  4264. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4265. @end table
  4266. @subsection Examples
  4267. @itemize
  4268. @item
  4269. The following example shows how this filter can be used to start a recording
  4270. that does not contain the delay at the start which usually occurs between
  4271. pressing the record button and the start of the performance:
  4272. @example
  4273. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4274. @end example
  4275. @item
  4276. Trim all silence encountered from beginning to end where there is more than 1
  4277. second of silence in audio:
  4278. @example
  4279. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4280. @end example
  4281. @item
  4282. Trim all digital silence samples, using peak detection, from beginning to end
  4283. where there is more than 0 samples of digital silence in audio and digital
  4284. silence is detected in all channels at same positions in stream:
  4285. @example
  4286. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4287. @end example
  4288. @end itemize
  4289. @section sofalizer
  4290. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4291. loudspeakers around the user for binaural listening via headphones (audio
  4292. formats up to 9 channels supported).
  4293. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4294. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4295. Austrian Academy of Sciences.
  4296. To enable compilation of this filter you need to configure FFmpeg with
  4297. @code{--enable-libmysofa}.
  4298. The filter accepts the following options:
  4299. @table @option
  4300. @item sofa
  4301. Set the SOFA file used for rendering.
  4302. @item gain
  4303. Set gain applied to audio. Value is in dB. Default is 0.
  4304. @item rotation
  4305. Set rotation of virtual loudspeakers in deg. Default is 0.
  4306. @item elevation
  4307. Set elevation of virtual speakers in deg. Default is 0.
  4308. @item radius
  4309. Set distance in meters between loudspeakers and the listener with near-field
  4310. HRTFs. Default is 1.
  4311. @item type
  4312. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4313. processing audio in time domain which is slow.
  4314. @var{freq} is processing audio in frequency domain which is fast.
  4315. Default is @var{freq}.
  4316. @item speakers
  4317. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4318. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4319. Each virtual loudspeaker is described with short channel name following with
  4320. azimuth and elevation in degrees.
  4321. Each virtual loudspeaker description is separated by '|'.
  4322. For example to override front left and front right channel positions use:
  4323. 'speakers=FL 45 15|FR 345 15'.
  4324. Descriptions with unrecognised channel names are ignored.
  4325. @item lfegain
  4326. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4327. @item framesize
  4328. Set custom frame size in number of samples. Default is 1024.
  4329. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4330. is set to @var{freq}.
  4331. @item normalize
  4332. Should all IRs be normalized upon importing SOFA file.
  4333. By default is enabled.
  4334. @item interpolate
  4335. Should nearest IRs be interpolated with neighbor IRs if exact position
  4336. does not match. By default is disabled.
  4337. @item minphase
  4338. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4339. @item anglestep
  4340. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4341. @item radstep
  4342. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4343. @end table
  4344. @subsection Examples
  4345. @itemize
  4346. @item
  4347. Using ClubFritz6 sofa file:
  4348. @example
  4349. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4350. @end example
  4351. @item
  4352. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4353. @example
  4354. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4355. @end example
  4356. @item
  4357. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4358. and also with custom gain:
  4359. @example
  4360. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4361. @end example
  4362. @end itemize
  4363. @section speechnorm
  4364. Speech Normalizer.
  4365. This filter expands or compresses each half-cycle of audio samples
  4366. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4367. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4368. The filter accepts the following options:
  4369. @table @option
  4370. @item peak, p
  4371. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4372. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4373. @item expansion, e
  4374. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4375. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4376. would be such that local peak value reaches target peak value but never to surpass it and that
  4377. ratio between new and previous peak value does not surpass this option value.
  4378. @item compression, c
  4379. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4380. This option controls maximum local half-cycle of samples compression. This option is used
  4381. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4382. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4383. that peak's half-cycle will be compressed by current compression factor.
  4384. @item threshold, t
  4385. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4386. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4387. Any half-cycle samples with their local peak value below or same as this option value will be
  4388. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4389. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4390. @item raise, r
  4391. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4392. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4393. each new half-cycle until it reaches @option{expansion} value.
  4394. Setting this options too high may lead to distortions.
  4395. @item fall, f
  4396. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4397. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4398. each new half-cycle until it reaches @option{compression} value.
  4399. @item channels, h
  4400. Specify which channels to filter, by default all available channels are filtered.
  4401. @item invert, i
  4402. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4403. option. When enabled any half-cycle of samples with their local peak value below or same as
  4404. @option{threshold} option will be expanded otherwise it will be compressed.
  4405. @item link, l
  4406. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4407. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4408. is enabled the minimum of all possible gains for each filtered channel is used.
  4409. @end table
  4410. @subsection Commands
  4411. This filter supports the all above options as @ref{commands}.
  4412. @section stereotools
  4413. This filter has some handy utilities to manage stereo signals, for converting
  4414. M/S stereo recordings to L/R signal while having control over the parameters
  4415. or spreading the stereo image of master track.
  4416. The filter accepts the following options:
  4417. @table @option
  4418. @item level_in
  4419. Set input level before filtering for both channels. Defaults is 1.
  4420. Allowed range is from 0.015625 to 64.
  4421. @item level_out
  4422. Set output level after filtering for both channels. Defaults is 1.
  4423. Allowed range is from 0.015625 to 64.
  4424. @item balance_in
  4425. Set input balance between both channels. Default is 0.
  4426. Allowed range is from -1 to 1.
  4427. @item balance_out
  4428. Set output balance between both channels. Default is 0.
  4429. Allowed range is from -1 to 1.
  4430. @item softclip
  4431. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4432. clipping. Disabled by default.
  4433. @item mutel
  4434. Mute the left channel. Disabled by default.
  4435. @item muter
  4436. Mute the right channel. Disabled by default.
  4437. @item phasel
  4438. Change the phase of the left channel. Disabled by default.
  4439. @item phaser
  4440. Change the phase of the right channel. Disabled by default.
  4441. @item mode
  4442. Set stereo mode. Available values are:
  4443. @table @samp
  4444. @item lr>lr
  4445. Left/Right to Left/Right, this is default.
  4446. @item lr>ms
  4447. Left/Right to Mid/Side.
  4448. @item ms>lr
  4449. Mid/Side to Left/Right.
  4450. @item lr>ll
  4451. Left/Right to Left/Left.
  4452. @item lr>rr
  4453. Left/Right to Right/Right.
  4454. @item lr>l+r
  4455. Left/Right to Left + Right.
  4456. @item lr>rl
  4457. Left/Right to Right/Left.
  4458. @item ms>ll
  4459. Mid/Side to Left/Left.
  4460. @item ms>rr
  4461. Mid/Side to Right/Right.
  4462. @item ms>rl
  4463. Mid/Side to Right/Left.
  4464. @item lr>l-r
  4465. Left/Right to Left - Right.
  4466. @end table
  4467. @item slev
  4468. Set level of side signal. Default is 1.
  4469. Allowed range is from 0.015625 to 64.
  4470. @item sbal
  4471. Set balance of side signal. Default is 0.
  4472. Allowed range is from -1 to 1.
  4473. @item mlev
  4474. Set level of the middle signal. Default is 1.
  4475. Allowed range is from 0.015625 to 64.
  4476. @item mpan
  4477. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4478. @item base
  4479. Set stereo base between mono and inversed channels. Default is 0.
  4480. Allowed range is from -1 to 1.
  4481. @item delay
  4482. Set delay in milliseconds how much to delay left from right channel and
  4483. vice versa. Default is 0. Allowed range is from -20 to 20.
  4484. @item sclevel
  4485. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4486. @item phase
  4487. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4488. @item bmode_in, bmode_out
  4489. Set balance mode for balance_in/balance_out option.
  4490. Can be one of the following:
  4491. @table @samp
  4492. @item balance
  4493. Classic balance mode. Attenuate one channel at time.
  4494. Gain is raised up to 1.
  4495. @item amplitude
  4496. Similar as classic mode above but gain is raised up to 2.
  4497. @item power
  4498. Equal power distribution, from -6dB to +6dB range.
  4499. @end table
  4500. @end table
  4501. @subsection Commands
  4502. This filter supports the all above options as @ref{commands}.
  4503. @subsection Examples
  4504. @itemize
  4505. @item
  4506. Apply karaoke like effect:
  4507. @example
  4508. stereotools=mlev=0.015625
  4509. @end example
  4510. @item
  4511. Convert M/S signal to L/R:
  4512. @example
  4513. "stereotools=mode=ms>lr"
  4514. @end example
  4515. @end itemize
  4516. @section stereowiden
  4517. This filter enhance the stereo effect by suppressing signal common to both
  4518. channels and by delaying the signal of left into right and vice versa,
  4519. thereby widening the stereo effect.
  4520. The filter accepts the following options:
  4521. @table @option
  4522. @item delay
  4523. Time in milliseconds of the delay of left signal into right and vice versa.
  4524. Default is 20 milliseconds.
  4525. @item feedback
  4526. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4527. effect of left signal in right output and vice versa which gives widening
  4528. effect. Default is 0.3.
  4529. @item crossfeed
  4530. Cross feed of left into right with inverted phase. This helps in suppressing
  4531. the mono. If the value is 1 it will cancel all the signal common to both
  4532. channels. Default is 0.3.
  4533. @item drymix
  4534. Set level of input signal of original channel. Default is 0.8.
  4535. @end table
  4536. @subsection Commands
  4537. This filter supports the all above options except @code{delay} as @ref{commands}.
  4538. @section superequalizer
  4539. Apply 18 band equalizer.
  4540. The filter accepts the following options:
  4541. @table @option
  4542. @item 1b
  4543. Set 65Hz band gain.
  4544. @item 2b
  4545. Set 92Hz band gain.
  4546. @item 3b
  4547. Set 131Hz band gain.
  4548. @item 4b
  4549. Set 185Hz band gain.
  4550. @item 5b
  4551. Set 262Hz band gain.
  4552. @item 6b
  4553. Set 370Hz band gain.
  4554. @item 7b
  4555. Set 523Hz band gain.
  4556. @item 8b
  4557. Set 740Hz band gain.
  4558. @item 9b
  4559. Set 1047Hz band gain.
  4560. @item 10b
  4561. Set 1480Hz band gain.
  4562. @item 11b
  4563. Set 2093Hz band gain.
  4564. @item 12b
  4565. Set 2960Hz band gain.
  4566. @item 13b
  4567. Set 4186Hz band gain.
  4568. @item 14b
  4569. Set 5920Hz band gain.
  4570. @item 15b
  4571. Set 8372Hz band gain.
  4572. @item 16b
  4573. Set 11840Hz band gain.
  4574. @item 17b
  4575. Set 16744Hz band gain.
  4576. @item 18b
  4577. Set 20000Hz band gain.
  4578. @end table
  4579. @section surround
  4580. Apply audio surround upmix filter.
  4581. This filter allows to produce multichannel output from audio stream.
  4582. The filter accepts the following options:
  4583. @table @option
  4584. @item chl_out
  4585. Set output channel layout. By default, this is @var{5.1}.
  4586. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4587. for the required syntax.
  4588. @item chl_in
  4589. Set input channel layout. By default, this is @var{stereo}.
  4590. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4591. for the required syntax.
  4592. @item level_in
  4593. Set input volume level. By default, this is @var{1}.
  4594. @item level_out
  4595. Set output volume level. By default, this is @var{1}.
  4596. @item lfe
  4597. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4598. @item lfe_low
  4599. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4600. @item lfe_high
  4601. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4602. @item lfe_mode
  4603. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4604. In @var{add} mode, LFE channel is created from input audio and added to output.
  4605. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4606. also all non-LFE output channels are subtracted with output LFE channel.
  4607. @item angle
  4608. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4609. Default is @var{90}.
  4610. @item fc_in
  4611. Set front center input volume. By default, this is @var{1}.
  4612. @item fc_out
  4613. Set front center output volume. By default, this is @var{1}.
  4614. @item fl_in
  4615. Set front left input volume. By default, this is @var{1}.
  4616. @item fl_out
  4617. Set front left output volume. By default, this is @var{1}.
  4618. @item fr_in
  4619. Set front right input volume. By default, this is @var{1}.
  4620. @item fr_out
  4621. Set front right output volume. By default, this is @var{1}.
  4622. @item sl_in
  4623. Set side left input volume. By default, this is @var{1}.
  4624. @item sl_out
  4625. Set side left output volume. By default, this is @var{1}.
  4626. @item sr_in
  4627. Set side right input volume. By default, this is @var{1}.
  4628. @item sr_out
  4629. Set side right output volume. By default, this is @var{1}.
  4630. @item bl_in
  4631. Set back left input volume. By default, this is @var{1}.
  4632. @item bl_out
  4633. Set back left output volume. By default, this is @var{1}.
  4634. @item br_in
  4635. Set back right input volume. By default, this is @var{1}.
  4636. @item br_out
  4637. Set back right output volume. By default, this is @var{1}.
  4638. @item bc_in
  4639. Set back center input volume. By default, this is @var{1}.
  4640. @item bc_out
  4641. Set back center output volume. By default, this is @var{1}.
  4642. @item lfe_in
  4643. Set LFE input volume. By default, this is @var{1}.
  4644. @item lfe_out
  4645. Set LFE output volume. By default, this is @var{1}.
  4646. @item allx
  4647. Set spread usage of stereo image across X axis for all channels.
  4648. @item ally
  4649. Set spread usage of stereo image across Y axis for all channels.
  4650. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4651. Set spread usage of stereo image across X axis for each channel.
  4652. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4653. Set spread usage of stereo image across Y axis for each channel.
  4654. @item win_size
  4655. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4656. @item win_func
  4657. Set window function.
  4658. It accepts the following values:
  4659. @table @samp
  4660. @item rect
  4661. @item bartlett
  4662. @item hann, hanning
  4663. @item hamming
  4664. @item blackman
  4665. @item welch
  4666. @item flattop
  4667. @item bharris
  4668. @item bnuttall
  4669. @item bhann
  4670. @item sine
  4671. @item nuttall
  4672. @item lanczos
  4673. @item gauss
  4674. @item tukey
  4675. @item dolph
  4676. @item cauchy
  4677. @item parzen
  4678. @item poisson
  4679. @item bohman
  4680. @end table
  4681. Default is @code{hann}.
  4682. @item overlap
  4683. Set window overlap. If set to 1, the recommended overlap for selected
  4684. window function will be picked. Default is @code{0.5}.
  4685. @end table
  4686. @section treble, highshelf
  4687. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4688. shelving filter with a response similar to that of a standard
  4689. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4690. The filter accepts the following options:
  4691. @table @option
  4692. @item gain, g
  4693. Give the gain at whichever is the lower of ~22 kHz and the
  4694. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4695. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4696. @item frequency, f
  4697. Set the filter's central frequency and so can be used
  4698. to extend or reduce the frequency range to be boosted or cut.
  4699. The default value is @code{3000} Hz.
  4700. @item width_type, t
  4701. Set method to specify band-width of filter.
  4702. @table @option
  4703. @item h
  4704. Hz
  4705. @item q
  4706. Q-Factor
  4707. @item o
  4708. octave
  4709. @item s
  4710. slope
  4711. @item k
  4712. kHz
  4713. @end table
  4714. @item width, w
  4715. Determine how steep is the filter's shelf transition.
  4716. @item poles, p
  4717. Set number of poles. Default is 2.
  4718. @item mix, m
  4719. How much to use filtered signal in output. Default is 1.
  4720. Range is between 0 and 1.
  4721. @item channels, c
  4722. Specify which channels to filter, by default all available are filtered.
  4723. @item normalize, n
  4724. Normalize biquad coefficients, by default is disabled.
  4725. Enabling it will normalize magnitude response at DC to 0dB.
  4726. @item transform, a
  4727. Set transform type of IIR filter.
  4728. @table @option
  4729. @item di
  4730. @item dii
  4731. @item tdii
  4732. @item latt
  4733. @end table
  4734. @item precision, r
  4735. Set precison of filtering.
  4736. @table @option
  4737. @item auto
  4738. Pick automatic sample format depending on surround filters.
  4739. @item s16
  4740. Always use signed 16-bit.
  4741. @item s32
  4742. Always use signed 32-bit.
  4743. @item f32
  4744. Always use float 32-bit.
  4745. @item f64
  4746. Always use float 64-bit.
  4747. @end table
  4748. @end table
  4749. @subsection Commands
  4750. This filter supports the following commands:
  4751. @table @option
  4752. @item frequency, f
  4753. Change treble frequency.
  4754. Syntax for the command is : "@var{frequency}"
  4755. @item width_type, t
  4756. Change treble width_type.
  4757. Syntax for the command is : "@var{width_type}"
  4758. @item width, w
  4759. Change treble width.
  4760. Syntax for the command is : "@var{width}"
  4761. @item gain, g
  4762. Change treble gain.
  4763. Syntax for the command is : "@var{gain}"
  4764. @item mix, m
  4765. Change treble mix.
  4766. Syntax for the command is : "@var{mix}"
  4767. @end table
  4768. @section tremolo
  4769. Sinusoidal amplitude modulation.
  4770. The filter accepts the following options:
  4771. @table @option
  4772. @item f
  4773. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4774. (20 Hz or lower) will result in a tremolo effect.
  4775. This filter may also be used as a ring modulator by specifying
  4776. a modulation frequency higher than 20 Hz.
  4777. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4778. @item d
  4779. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4780. Default value is 0.5.
  4781. @end table
  4782. @section vibrato
  4783. Sinusoidal phase modulation.
  4784. The filter accepts the following options:
  4785. @table @option
  4786. @item f
  4787. Modulation frequency in Hertz.
  4788. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4789. @item d
  4790. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4791. Default value is 0.5.
  4792. @end table
  4793. @section volume
  4794. Adjust the input audio volume.
  4795. It accepts the following parameters:
  4796. @table @option
  4797. @item volume
  4798. Set audio volume expression.
  4799. Output values are clipped to the maximum value.
  4800. The output audio volume is given by the relation:
  4801. @example
  4802. @var{output_volume} = @var{volume} * @var{input_volume}
  4803. @end example
  4804. The default value for @var{volume} is "1.0".
  4805. @item precision
  4806. This parameter represents the mathematical precision.
  4807. It determines which input sample formats will be allowed, which affects the
  4808. precision of the volume scaling.
  4809. @table @option
  4810. @item fixed
  4811. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4812. @item float
  4813. 32-bit floating-point; this limits input sample format to FLT. (default)
  4814. @item double
  4815. 64-bit floating-point; this limits input sample format to DBL.
  4816. @end table
  4817. @item replaygain
  4818. Choose the behaviour on encountering ReplayGain side data in input frames.
  4819. @table @option
  4820. @item drop
  4821. Remove ReplayGain side data, ignoring its contents (the default).
  4822. @item ignore
  4823. Ignore ReplayGain side data, but leave it in the frame.
  4824. @item track
  4825. Prefer the track gain, if present.
  4826. @item album
  4827. Prefer the album gain, if present.
  4828. @end table
  4829. @item replaygain_preamp
  4830. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4831. Default value for @var{replaygain_preamp} is 0.0.
  4832. @item replaygain_noclip
  4833. Prevent clipping by limiting the gain applied.
  4834. Default value for @var{replaygain_noclip} is 1.
  4835. @item eval
  4836. Set when the volume expression is evaluated.
  4837. It accepts the following values:
  4838. @table @samp
  4839. @item once
  4840. only evaluate expression once during the filter initialization, or
  4841. when the @samp{volume} command is sent
  4842. @item frame
  4843. evaluate expression for each incoming frame
  4844. @end table
  4845. Default value is @samp{once}.
  4846. @end table
  4847. The volume expression can contain the following parameters.
  4848. @table @option
  4849. @item n
  4850. frame number (starting at zero)
  4851. @item nb_channels
  4852. number of channels
  4853. @item nb_consumed_samples
  4854. number of samples consumed by the filter
  4855. @item nb_samples
  4856. number of samples in the current frame
  4857. @item pos
  4858. original frame position in the file
  4859. @item pts
  4860. frame PTS
  4861. @item sample_rate
  4862. sample rate
  4863. @item startpts
  4864. PTS at start of stream
  4865. @item startt
  4866. time at start of stream
  4867. @item t
  4868. frame time
  4869. @item tb
  4870. timestamp timebase
  4871. @item volume
  4872. last set volume value
  4873. @end table
  4874. Note that when @option{eval} is set to @samp{once} only the
  4875. @var{sample_rate} and @var{tb} variables are available, all other
  4876. variables will evaluate to NAN.
  4877. @subsection Commands
  4878. This filter supports the following commands:
  4879. @table @option
  4880. @item volume
  4881. Modify the volume expression.
  4882. The command accepts the same syntax of the corresponding option.
  4883. If the specified expression is not valid, it is kept at its current
  4884. value.
  4885. @end table
  4886. @subsection Examples
  4887. @itemize
  4888. @item
  4889. Halve the input audio volume:
  4890. @example
  4891. volume=volume=0.5
  4892. volume=volume=1/2
  4893. volume=volume=-6.0206dB
  4894. @end example
  4895. In all the above example the named key for @option{volume} can be
  4896. omitted, for example like in:
  4897. @example
  4898. volume=0.5
  4899. @end example
  4900. @item
  4901. Increase input audio power by 6 decibels using fixed-point precision:
  4902. @example
  4903. volume=volume=6dB:precision=fixed
  4904. @end example
  4905. @item
  4906. Fade volume after time 10 with an annihilation period of 5 seconds:
  4907. @example
  4908. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4909. @end example
  4910. @end itemize
  4911. @section volumedetect
  4912. Detect the volume of the input video.
  4913. The filter has no parameters. The input is not modified. Statistics about
  4914. the volume will be printed in the log when the input stream end is reached.
  4915. In particular it will show the mean volume (root mean square), maximum
  4916. volume (on a per-sample basis), and the beginning of a histogram of the
  4917. registered volume values (from the maximum value to a cumulated 1/1000 of
  4918. the samples).
  4919. All volumes are in decibels relative to the maximum PCM value.
  4920. @subsection Examples
  4921. Here is an excerpt of the output:
  4922. @example
  4923. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4924. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4925. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4926. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4927. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4928. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4929. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4930. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4931. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4932. @end example
  4933. It means that:
  4934. @itemize
  4935. @item
  4936. The mean square energy is approximately -27 dB, or 10^-2.7.
  4937. @item
  4938. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4939. @item
  4940. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4941. @end itemize
  4942. In other words, raising the volume by +4 dB does not cause any clipping,
  4943. raising it by +5 dB causes clipping for 6 samples, etc.
  4944. @c man end AUDIO FILTERS
  4945. @chapter Audio Sources
  4946. @c man begin AUDIO SOURCES
  4947. Below is a description of the currently available audio sources.
  4948. @section abuffer
  4949. Buffer audio frames, and make them available to the filter chain.
  4950. This source is mainly intended for a programmatic use, in particular
  4951. through the interface defined in @file{libavfilter/buffersrc.h}.
  4952. It accepts the following parameters:
  4953. @table @option
  4954. @item time_base
  4955. The timebase which will be used for timestamps of submitted frames. It must be
  4956. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4957. @item sample_rate
  4958. The sample rate of the incoming audio buffers.
  4959. @item sample_fmt
  4960. The sample format of the incoming audio buffers.
  4961. Either a sample format name or its corresponding integer representation from
  4962. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4963. @item channel_layout
  4964. The channel layout of the incoming audio buffers.
  4965. Either a channel layout name from channel_layout_map in
  4966. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4967. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4968. @item channels
  4969. The number of channels of the incoming audio buffers.
  4970. If both @var{channels} and @var{channel_layout} are specified, then they
  4971. must be consistent.
  4972. @end table
  4973. @subsection Examples
  4974. @example
  4975. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4976. @end example
  4977. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4978. Since the sample format with name "s16p" corresponds to the number
  4979. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4980. equivalent to:
  4981. @example
  4982. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4983. @end example
  4984. @section aevalsrc
  4985. Generate an audio signal specified by an expression.
  4986. This source accepts in input one or more expressions (one for each
  4987. channel), which are evaluated and used to generate a corresponding
  4988. audio signal.
  4989. This source accepts the following options:
  4990. @table @option
  4991. @item exprs
  4992. Set the '|'-separated expressions list for each separate channel. In case the
  4993. @option{channel_layout} option is not specified, the selected channel layout
  4994. depends on the number of provided expressions. Otherwise the last
  4995. specified expression is applied to the remaining output channels.
  4996. @item channel_layout, c
  4997. Set the channel layout. The number of channels in the specified layout
  4998. must be equal to the number of specified expressions.
  4999. @item duration, d
  5000. Set the minimum duration of the sourced audio. See
  5001. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5002. for the accepted syntax.
  5003. Note that the resulting duration may be greater than the specified
  5004. duration, as the generated audio is always cut at the end of a
  5005. complete frame.
  5006. If not specified, or the expressed duration is negative, the audio is
  5007. supposed to be generated forever.
  5008. @item nb_samples, n
  5009. Set the number of samples per channel per each output frame,
  5010. default to 1024.
  5011. @item sample_rate, s
  5012. Specify the sample rate, default to 44100.
  5013. @end table
  5014. Each expression in @var{exprs} can contain the following constants:
  5015. @table @option
  5016. @item n
  5017. number of the evaluated sample, starting from 0
  5018. @item t
  5019. time of the evaluated sample expressed in seconds, starting from 0
  5020. @item s
  5021. sample rate
  5022. @end table
  5023. @subsection Examples
  5024. @itemize
  5025. @item
  5026. Generate silence:
  5027. @example
  5028. aevalsrc=0
  5029. @end example
  5030. @item
  5031. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5032. 8000 Hz:
  5033. @example
  5034. aevalsrc="sin(440*2*PI*t):s=8000"
  5035. @end example
  5036. @item
  5037. Generate a two channels signal, specify the channel layout (Front
  5038. Center + Back Center) explicitly:
  5039. @example
  5040. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  5041. @end example
  5042. @item
  5043. Generate white noise:
  5044. @example
  5045. aevalsrc="-2+random(0)"
  5046. @end example
  5047. @item
  5048. Generate an amplitude modulated signal:
  5049. @example
  5050. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5051. @end example
  5052. @item
  5053. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5054. @example
  5055. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5056. @end example
  5057. @end itemize
  5058. @section afirsrc
  5059. Generate a FIR coefficients using frequency sampling method.
  5060. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5061. The filter accepts the following options:
  5062. @table @option
  5063. @item taps, t
  5064. Set number of filter coefficents in output audio stream.
  5065. Default value is 1025.
  5066. @item frequency, f
  5067. Set frequency points from where magnitude and phase are set.
  5068. This must be in non decreasing order, and first element must be 0, while last element
  5069. must be 1. Elements are separated by white spaces.
  5070. @item magnitude, m
  5071. Set magnitude value for every frequency point set by @option{frequency}.
  5072. Number of values must be same as number of frequency points.
  5073. Values are separated by white spaces.
  5074. @item phase, p
  5075. Set phase value for every frequency point set by @option{frequency}.
  5076. Number of values must be same as number of frequency points.
  5077. Values are separated by white spaces.
  5078. @item sample_rate, r
  5079. Set sample rate, default is 44100.
  5080. @item nb_samples, n
  5081. Set number of samples per each frame. Default is 1024.
  5082. @item win_func, w
  5083. Set window function. Default is blackman.
  5084. @end table
  5085. @section anullsrc
  5086. The null audio source, return unprocessed audio frames. It is mainly useful
  5087. as a template and to be employed in analysis / debugging tools, or as
  5088. the source for filters which ignore the input data (for example the sox
  5089. synth filter).
  5090. This source accepts the following options:
  5091. @table @option
  5092. @item channel_layout, cl
  5093. Specifies the channel layout, and can be either an integer or a string
  5094. representing a channel layout. The default value of @var{channel_layout}
  5095. is "stereo".
  5096. Check the channel_layout_map definition in
  5097. @file{libavutil/channel_layout.c} for the mapping between strings and
  5098. channel layout values.
  5099. @item sample_rate, r
  5100. Specifies the sample rate, and defaults to 44100.
  5101. @item nb_samples, n
  5102. Set the number of samples per requested frames.
  5103. @item duration, d
  5104. Set the duration of the sourced audio. See
  5105. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5106. for the accepted syntax.
  5107. If not specified, or the expressed duration is negative, the audio is
  5108. supposed to be generated forever.
  5109. @end table
  5110. @subsection Examples
  5111. @itemize
  5112. @item
  5113. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5114. @example
  5115. anullsrc=r=48000:cl=4
  5116. @end example
  5117. @item
  5118. Do the same operation with a more obvious syntax:
  5119. @example
  5120. anullsrc=r=48000:cl=mono
  5121. @end example
  5122. @end itemize
  5123. All the parameters need to be explicitly defined.
  5124. @section flite
  5125. Synthesize a voice utterance using the libflite library.
  5126. To enable compilation of this filter you need to configure FFmpeg with
  5127. @code{--enable-libflite}.
  5128. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5129. The filter accepts the following options:
  5130. @table @option
  5131. @item list_voices
  5132. If set to 1, list the names of the available voices and exit
  5133. immediately. Default value is 0.
  5134. @item nb_samples, n
  5135. Set the maximum number of samples per frame. Default value is 512.
  5136. @item textfile
  5137. Set the filename containing the text to speak.
  5138. @item text
  5139. Set the text to speak.
  5140. @item voice, v
  5141. Set the voice to use for the speech synthesis. Default value is
  5142. @code{kal}. See also the @var{list_voices} option.
  5143. @end table
  5144. @subsection Examples
  5145. @itemize
  5146. @item
  5147. Read from file @file{speech.txt}, and synthesize the text using the
  5148. standard flite voice:
  5149. @example
  5150. flite=textfile=speech.txt
  5151. @end example
  5152. @item
  5153. Read the specified text selecting the @code{slt} voice:
  5154. @example
  5155. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5156. @end example
  5157. @item
  5158. Input text to ffmpeg:
  5159. @example
  5160. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5161. @end example
  5162. @item
  5163. Make @file{ffplay} speak the specified text, using @code{flite} and
  5164. the @code{lavfi} device:
  5165. @example
  5166. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5167. @end example
  5168. @end itemize
  5169. For more information about libflite, check:
  5170. @url{http://www.festvox.org/flite/}
  5171. @section anoisesrc
  5172. Generate a noise audio signal.
  5173. The filter accepts the following options:
  5174. @table @option
  5175. @item sample_rate, r
  5176. Specify the sample rate. Default value is 48000 Hz.
  5177. @item amplitude, a
  5178. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  5179. is 1.0.
  5180. @item duration, d
  5181. Specify the duration of the generated audio stream. Not specifying this option
  5182. results in noise with an infinite length.
  5183. @item color, colour, c
  5184. Specify the color of noise. Available noise colors are white, pink, brown,
  5185. blue, violet and velvet. Default color is white.
  5186. @item seed, s
  5187. Specify a value used to seed the PRNG.
  5188. @item nb_samples, n
  5189. Set the number of samples per each output frame, default is 1024.
  5190. @end table
  5191. @subsection Examples
  5192. @itemize
  5193. @item
  5194. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  5195. @example
  5196. anoisesrc=d=60:c=pink:r=44100:a=0.5
  5197. @end example
  5198. @end itemize
  5199. @section hilbert
  5200. Generate odd-tap Hilbert transform FIR coefficients.
  5201. The resulting stream can be used with @ref{afir} filter for phase-shifting
  5202. the signal by 90 degrees.
  5203. This is used in many matrix coding schemes and for analytic signal generation.
  5204. The process is often written as a multiplication by i (or j), the imaginary unit.
  5205. The filter accepts the following options:
  5206. @table @option
  5207. @item sample_rate, s
  5208. Set sample rate, default is 44100.
  5209. @item taps, t
  5210. Set length of FIR filter, default is 22051.
  5211. @item nb_samples, n
  5212. Set number of samples per each frame.
  5213. @item win_func, w
  5214. Set window function to be used when generating FIR coefficients.
  5215. @end table
  5216. @section sinc
  5217. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5218. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5219. The filter accepts the following options:
  5220. @table @option
  5221. @item sample_rate, r
  5222. Set sample rate, default is 44100.
  5223. @item nb_samples, n
  5224. Set number of samples per each frame. Default is 1024.
  5225. @item hp
  5226. Set high-pass frequency. Default is 0.
  5227. @item lp
  5228. Set low-pass frequency. Default is 0.
  5229. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  5230. is higher than 0 then filter will create band-pass filter coefficients,
  5231. otherwise band-reject filter coefficients.
  5232. @item phase
  5233. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  5234. @item beta
  5235. Set Kaiser window beta.
  5236. @item att
  5237. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  5238. @item round
  5239. Enable rounding, by default is disabled.
  5240. @item hptaps
  5241. Set number of taps for high-pass filter.
  5242. @item lptaps
  5243. Set number of taps for low-pass filter.
  5244. @end table
  5245. @section sine
  5246. Generate an audio signal made of a sine wave with amplitude 1/8.
  5247. The audio signal is bit-exact.
  5248. The filter accepts the following options:
  5249. @table @option
  5250. @item frequency, f
  5251. Set the carrier frequency. Default is 440 Hz.
  5252. @item beep_factor, b
  5253. Enable a periodic beep every second with frequency @var{beep_factor} times
  5254. the carrier frequency. Default is 0, meaning the beep is disabled.
  5255. @item sample_rate, r
  5256. Specify the sample rate, default is 44100.
  5257. @item duration, d
  5258. Specify the duration of the generated audio stream.
  5259. @item samples_per_frame
  5260. Set the number of samples per output frame.
  5261. The expression can contain the following constants:
  5262. @table @option
  5263. @item n
  5264. The (sequential) number of the output audio frame, starting from 0.
  5265. @item pts
  5266. The PTS (Presentation TimeStamp) of the output audio frame,
  5267. expressed in @var{TB} units.
  5268. @item t
  5269. The PTS of the output audio frame, expressed in seconds.
  5270. @item TB
  5271. The timebase of the output audio frames.
  5272. @end table
  5273. Default is @code{1024}.
  5274. @end table
  5275. @subsection Examples
  5276. @itemize
  5277. @item
  5278. Generate a simple 440 Hz sine wave:
  5279. @example
  5280. sine
  5281. @end example
  5282. @item
  5283. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5284. @example
  5285. sine=220:4:d=5
  5286. sine=f=220:b=4:d=5
  5287. sine=frequency=220:beep_factor=4:duration=5
  5288. @end example
  5289. @item
  5290. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5291. pattern:
  5292. @example
  5293. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5294. @end example
  5295. @end itemize
  5296. @c man end AUDIO SOURCES
  5297. @chapter Audio Sinks
  5298. @c man begin AUDIO SINKS
  5299. Below is a description of the currently available audio sinks.
  5300. @section abuffersink
  5301. Buffer audio frames, and make them available to the end of filter chain.
  5302. This sink is mainly intended for programmatic use, in particular
  5303. through the interface defined in @file{libavfilter/buffersink.h}
  5304. or the options system.
  5305. It accepts a pointer to an AVABufferSinkContext structure, which
  5306. defines the incoming buffers' formats, to be passed as the opaque
  5307. parameter to @code{avfilter_init_filter} for initialization.
  5308. @section anullsink
  5309. Null audio sink; do absolutely nothing with the input audio. It is
  5310. mainly useful as a template and for use in analysis / debugging
  5311. tools.
  5312. @c man end AUDIO SINKS
  5313. @chapter Video Filters
  5314. @c man begin VIDEO FILTERS
  5315. When you configure your FFmpeg build, you can disable any of the
  5316. existing filters using @code{--disable-filters}.
  5317. The configure output will show the video filters included in your
  5318. build.
  5319. Below is a description of the currently available video filters.
  5320. @section addroi
  5321. Mark a region of interest in a video frame.
  5322. The frame data is passed through unchanged, but metadata is attached
  5323. to the frame indicating regions of interest which can affect the
  5324. behaviour of later encoding. Multiple regions can be marked by
  5325. applying the filter multiple times.
  5326. @table @option
  5327. @item x
  5328. Region distance in pixels from the left edge of the frame.
  5329. @item y
  5330. Region distance in pixels from the top edge of the frame.
  5331. @item w
  5332. Region width in pixels.
  5333. @item h
  5334. Region height in pixels.
  5335. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5336. and may contain the following variables:
  5337. @table @option
  5338. @item iw
  5339. Width of the input frame.
  5340. @item ih
  5341. Height of the input frame.
  5342. @end table
  5343. @item qoffset
  5344. Quantisation offset to apply within the region.
  5345. This must be a real value in the range -1 to +1. A value of zero
  5346. indicates no quality change. A negative value asks for better quality
  5347. (less quantisation), while a positive value asks for worse quality
  5348. (greater quantisation).
  5349. The range is calibrated so that the extreme values indicate the
  5350. largest possible offset - if the rest of the frame is encoded with the
  5351. worst possible quality, an offset of -1 indicates that this region
  5352. should be encoded with the best possible quality anyway. Intermediate
  5353. values are then interpolated in some codec-dependent way.
  5354. For example, in 10-bit H.264 the quantisation parameter varies between
  5355. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5356. this region should be encoded with a QP around one-tenth of the full
  5357. range better than the rest of the frame. So, if most of the frame
  5358. were to be encoded with a QP of around 30, this region would get a QP
  5359. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5360. An extreme value of -1 would indicate that this region should be
  5361. encoded with the best possible quality regardless of the treatment of
  5362. the rest of the frame - that is, should be encoded at a QP of -12.
  5363. @item clear
  5364. If set to true, remove any existing regions of interest marked on the
  5365. frame before adding the new one.
  5366. @end table
  5367. @subsection Examples
  5368. @itemize
  5369. @item
  5370. Mark the centre quarter of the frame as interesting.
  5371. @example
  5372. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5373. @end example
  5374. @item
  5375. Mark the 100-pixel-wide region on the left edge of the frame as very
  5376. uninteresting (to be encoded at much lower quality than the rest of
  5377. the frame).
  5378. @example
  5379. addroi=0:0:100:ih:+1/5
  5380. @end example
  5381. @end itemize
  5382. @section alphaextract
  5383. Extract the alpha component from the input as a grayscale video. This
  5384. is especially useful with the @var{alphamerge} filter.
  5385. @section alphamerge
  5386. Add or replace the alpha component of the primary input with the
  5387. grayscale value of a second input. This is intended for use with
  5388. @var{alphaextract} to allow the transmission or storage of frame
  5389. sequences that have alpha in a format that doesn't support an alpha
  5390. channel.
  5391. For example, to reconstruct full frames from a normal YUV-encoded video
  5392. and a separate video created with @var{alphaextract}, you might use:
  5393. @example
  5394. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5395. @end example
  5396. @section amplify
  5397. Amplify differences between current pixel and pixels of adjacent frames in
  5398. same pixel location.
  5399. This filter accepts the following options:
  5400. @table @option
  5401. @item radius
  5402. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5403. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5404. @item factor
  5405. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5406. @item threshold
  5407. Set threshold for difference amplification. Any difference greater or equal to
  5408. this value will not alter source pixel. Default is 10.
  5409. Allowed range is from 0 to 65535.
  5410. @item tolerance
  5411. Set tolerance for difference amplification. Any difference lower to
  5412. this value will not alter source pixel. Default is 0.
  5413. Allowed range is from 0 to 65535.
  5414. @item low
  5415. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5416. This option controls maximum possible value that will decrease source pixel value.
  5417. @item high
  5418. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5419. This option controls maximum possible value that will increase source pixel value.
  5420. @item planes
  5421. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5422. @end table
  5423. @subsection Commands
  5424. This filter supports the following @ref{commands} that corresponds to option of same name:
  5425. @table @option
  5426. @item factor
  5427. @item threshold
  5428. @item tolerance
  5429. @item low
  5430. @item high
  5431. @item planes
  5432. @end table
  5433. @section ass
  5434. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5435. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5436. Substation Alpha) subtitles files.
  5437. This filter accepts the following option in addition to the common options from
  5438. the @ref{subtitles} filter:
  5439. @table @option
  5440. @item shaping
  5441. Set the shaping engine
  5442. Available values are:
  5443. @table @samp
  5444. @item auto
  5445. The default libass shaping engine, which is the best available.
  5446. @item simple
  5447. Fast, font-agnostic shaper that can do only substitutions
  5448. @item complex
  5449. Slower shaper using OpenType for substitutions and positioning
  5450. @end table
  5451. The default is @code{auto}.
  5452. @end table
  5453. @section atadenoise
  5454. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5455. The filter accepts the following options:
  5456. @table @option
  5457. @item 0a
  5458. Set threshold A for 1st plane. Default is 0.02.
  5459. Valid range is 0 to 0.3.
  5460. @item 0b
  5461. Set threshold B for 1st plane. Default is 0.04.
  5462. Valid range is 0 to 5.
  5463. @item 1a
  5464. Set threshold A for 2nd plane. Default is 0.02.
  5465. Valid range is 0 to 0.3.
  5466. @item 1b
  5467. Set threshold B for 2nd plane. Default is 0.04.
  5468. Valid range is 0 to 5.
  5469. @item 2a
  5470. Set threshold A for 3rd plane. Default is 0.02.
  5471. Valid range is 0 to 0.3.
  5472. @item 2b
  5473. Set threshold B for 3rd plane. Default is 0.04.
  5474. Valid range is 0 to 5.
  5475. Threshold A is designed to react on abrupt changes in the input signal and
  5476. threshold B is designed to react on continuous changes in the input signal.
  5477. @item s
  5478. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5479. number in range [5, 129].
  5480. @item p
  5481. Set what planes of frame filter will use for averaging. Default is all.
  5482. @item a
  5483. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5484. Alternatively can be set to @code{s} serial.
  5485. Parallel can be faster then serial, while other way around is never true.
  5486. Parallel will abort early on first change being greater then thresholds, while serial
  5487. will continue processing other side of frames if they are equal or below thresholds.
  5488. @end table
  5489. @subsection Commands
  5490. This filter supports same @ref{commands} as options except option @code{s}.
  5491. The command accepts the same syntax of the corresponding option.
  5492. @section avgblur
  5493. Apply average blur filter.
  5494. The filter accepts the following options:
  5495. @table @option
  5496. @item sizeX
  5497. Set horizontal radius size.
  5498. @item planes
  5499. Set which planes to filter. By default all planes are filtered.
  5500. @item sizeY
  5501. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5502. Default is @code{0}.
  5503. @end table
  5504. @subsection Commands
  5505. This filter supports same commands as options.
  5506. The command accepts the same syntax of the corresponding option.
  5507. If the specified expression is not valid, it is kept at its current
  5508. value.
  5509. @section bbox
  5510. Compute the bounding box for the non-black pixels in the input frame
  5511. luminance plane.
  5512. This filter computes the bounding box containing all the pixels with a
  5513. luminance value greater than the minimum allowed value.
  5514. The parameters describing the bounding box are printed on the filter
  5515. log.
  5516. The filter accepts the following option:
  5517. @table @option
  5518. @item min_val
  5519. Set the minimal luminance value. Default is @code{16}.
  5520. @end table
  5521. @section bilateral
  5522. Apply bilateral filter, spatial smoothing while preserving edges.
  5523. The filter accepts the following options:
  5524. @table @option
  5525. @item sigmaS
  5526. Set sigma of gaussian function to calculate spatial weight.
  5527. Allowed range is 0 to 512. Default is 0.1.
  5528. @item sigmaR
  5529. Set sigma of gaussian function to calculate range weight.
  5530. Allowed range is 0 to 1. Default is 0.1.
  5531. @item planes
  5532. Set planes to filter. Default is first only.
  5533. @end table
  5534. @subsection Commands
  5535. This filter supports the all above options as @ref{commands}.
  5536. @section bitplanenoise
  5537. Show and measure bit plane noise.
  5538. The filter accepts the following options:
  5539. @table @option
  5540. @item bitplane
  5541. Set which plane to analyze. Default is @code{1}.
  5542. @item filter
  5543. Filter out noisy pixels from @code{bitplane} set above.
  5544. Default is disabled.
  5545. @end table
  5546. @section blackdetect
  5547. Detect video intervals that are (almost) completely black. Can be
  5548. useful to detect chapter transitions, commercials, or invalid
  5549. recordings.
  5550. The filter outputs its detection analysis to both the log as well as
  5551. frame metadata. If a black segment of at least the specified minimum
  5552. duration is found, a line with the start and end timestamps as well
  5553. as duration is printed to the log with level @code{info}. In addition,
  5554. a log line with level @code{debug} is printed per frame showing the
  5555. black amount detected for that frame.
  5556. The filter also attaches metadata to the first frame of a black
  5557. segment with key @code{lavfi.black_start} and to the first frame
  5558. after the black segment ends with key @code{lavfi.black_end}. The
  5559. value is the frame's timestamp. This metadata is added regardless
  5560. of the minimum duration specified.
  5561. The filter accepts the following options:
  5562. @table @option
  5563. @item black_min_duration, d
  5564. Set the minimum detected black duration expressed in seconds. It must
  5565. be a non-negative floating point number.
  5566. Default value is 2.0.
  5567. @item picture_black_ratio_th, pic_th
  5568. Set the threshold for considering a picture "black".
  5569. Express the minimum value for the ratio:
  5570. @example
  5571. @var{nb_black_pixels} / @var{nb_pixels}
  5572. @end example
  5573. for which a picture is considered black.
  5574. Default value is 0.98.
  5575. @item pixel_black_th, pix_th
  5576. Set the threshold for considering a pixel "black".
  5577. The threshold expresses the maximum pixel luminance value for which a
  5578. pixel is considered "black". The provided value is scaled according to
  5579. the following equation:
  5580. @example
  5581. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5582. @end example
  5583. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5584. the input video format, the range is [0-255] for YUV full-range
  5585. formats and [16-235] for YUV non full-range formats.
  5586. Default value is 0.10.
  5587. @end table
  5588. The following example sets the maximum pixel threshold to the minimum
  5589. value, and detects only black intervals of 2 or more seconds:
  5590. @example
  5591. blackdetect=d=2:pix_th=0.00
  5592. @end example
  5593. @section blackframe
  5594. Detect frames that are (almost) completely black. Can be useful to
  5595. detect chapter transitions or commercials. Output lines consist of
  5596. the frame number of the detected frame, the percentage of blackness,
  5597. the position in the file if known or -1 and the timestamp in seconds.
  5598. In order to display the output lines, you need to set the loglevel at
  5599. least to the AV_LOG_INFO value.
  5600. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5601. The value represents the percentage of pixels in the picture that
  5602. are below the threshold value.
  5603. It accepts the following parameters:
  5604. @table @option
  5605. @item amount
  5606. The percentage of the pixels that have to be below the threshold; it defaults to
  5607. @code{98}.
  5608. @item threshold, thresh
  5609. The threshold below which a pixel value is considered black; it defaults to
  5610. @code{32}.
  5611. @end table
  5612. @anchor{blend}
  5613. @section blend
  5614. Blend two video frames into each other.
  5615. The @code{blend} filter takes two input streams and outputs one
  5616. stream, the first input is the "top" layer and second input is
  5617. "bottom" layer. By default, the output terminates when the longest input terminates.
  5618. The @code{tblend} (time blend) filter takes two consecutive frames
  5619. from one single stream, and outputs the result obtained by blending
  5620. the new frame on top of the old frame.
  5621. A description of the accepted options follows.
  5622. @table @option
  5623. @item c0_mode
  5624. @item c1_mode
  5625. @item c2_mode
  5626. @item c3_mode
  5627. @item all_mode
  5628. Set blend mode for specific pixel component or all pixel components in case
  5629. of @var{all_mode}. Default value is @code{normal}.
  5630. Available values for component modes are:
  5631. @table @samp
  5632. @item addition
  5633. @item grainmerge
  5634. @item and
  5635. @item average
  5636. @item burn
  5637. @item darken
  5638. @item difference
  5639. @item grainextract
  5640. @item divide
  5641. @item dodge
  5642. @item freeze
  5643. @item exclusion
  5644. @item extremity
  5645. @item glow
  5646. @item hardlight
  5647. @item hardmix
  5648. @item heat
  5649. @item lighten
  5650. @item linearlight
  5651. @item multiply
  5652. @item multiply128
  5653. @item negation
  5654. @item normal
  5655. @item or
  5656. @item overlay
  5657. @item phoenix
  5658. @item pinlight
  5659. @item reflect
  5660. @item screen
  5661. @item softlight
  5662. @item subtract
  5663. @item vividlight
  5664. @item xor
  5665. @end table
  5666. @item c0_opacity
  5667. @item c1_opacity
  5668. @item c2_opacity
  5669. @item c3_opacity
  5670. @item all_opacity
  5671. Set blend opacity for specific pixel component or all pixel components in case
  5672. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5673. @item c0_expr
  5674. @item c1_expr
  5675. @item c2_expr
  5676. @item c3_expr
  5677. @item all_expr
  5678. Set blend expression for specific pixel component or all pixel components in case
  5679. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5680. The expressions can use the following variables:
  5681. @table @option
  5682. @item N
  5683. The sequential number of the filtered frame, starting from @code{0}.
  5684. @item X
  5685. @item Y
  5686. the coordinates of the current sample
  5687. @item W
  5688. @item H
  5689. the width and height of currently filtered plane
  5690. @item SW
  5691. @item SH
  5692. Width and height scale for the plane being filtered. It is the
  5693. ratio between the dimensions of the current plane to the luma plane,
  5694. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5695. the luma plane and @code{0.5,0.5} for the chroma planes.
  5696. @item T
  5697. Time of the current frame, expressed in seconds.
  5698. @item TOP, A
  5699. Value of pixel component at current location for first video frame (top layer).
  5700. @item BOTTOM, B
  5701. Value of pixel component at current location for second video frame (bottom layer).
  5702. @end table
  5703. @end table
  5704. The @code{blend} filter also supports the @ref{framesync} options.
  5705. @subsection Examples
  5706. @itemize
  5707. @item
  5708. Apply transition from bottom layer to top layer in first 10 seconds:
  5709. @example
  5710. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5711. @end example
  5712. @item
  5713. Apply linear horizontal transition from top layer to bottom layer:
  5714. @example
  5715. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5716. @end example
  5717. @item
  5718. Apply 1x1 checkerboard effect:
  5719. @example
  5720. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5721. @end example
  5722. @item
  5723. Apply uncover left effect:
  5724. @example
  5725. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5726. @end example
  5727. @item
  5728. Apply uncover down effect:
  5729. @example
  5730. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5731. @end example
  5732. @item
  5733. Apply uncover up-left effect:
  5734. @example
  5735. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5736. @end example
  5737. @item
  5738. Split diagonally video and shows top and bottom layer on each side:
  5739. @example
  5740. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5741. @end example
  5742. @item
  5743. Display differences between the current and the previous frame:
  5744. @example
  5745. tblend=all_mode=grainextract
  5746. @end example
  5747. @end itemize
  5748. @section bm3d
  5749. Denoise frames using Block-Matching 3D algorithm.
  5750. The filter accepts the following options.
  5751. @table @option
  5752. @item sigma
  5753. Set denoising strength. Default value is 1.
  5754. Allowed range is from 0 to 999.9.
  5755. The denoising algorithm is very sensitive to sigma, so adjust it
  5756. according to the source.
  5757. @item block
  5758. Set local patch size. This sets dimensions in 2D.
  5759. @item bstep
  5760. Set sliding step for processing blocks. Default value is 4.
  5761. Allowed range is from 1 to 64.
  5762. Smaller values allows processing more reference blocks and is slower.
  5763. @item group
  5764. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5765. When set to 1, no block matching is done. Larger values allows more blocks
  5766. in single group.
  5767. Allowed range is from 1 to 256.
  5768. @item range
  5769. Set radius for search block matching. Default is 9.
  5770. Allowed range is from 1 to INT32_MAX.
  5771. @item mstep
  5772. Set step between two search locations for block matching. Default is 1.
  5773. Allowed range is from 1 to 64. Smaller is slower.
  5774. @item thmse
  5775. Set threshold of mean square error for block matching. Valid range is 0 to
  5776. INT32_MAX.
  5777. @item hdthr
  5778. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5779. Larger values results in stronger hard-thresholding filtering in frequency
  5780. domain.
  5781. @item estim
  5782. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5783. Default is @code{basic}.
  5784. @item ref
  5785. If enabled, filter will use 2nd stream for block matching.
  5786. Default is disabled for @code{basic} value of @var{estim} option,
  5787. and always enabled if value of @var{estim} is @code{final}.
  5788. @item planes
  5789. Set planes to filter. Default is all available except alpha.
  5790. @end table
  5791. @subsection Examples
  5792. @itemize
  5793. @item
  5794. Basic filtering with bm3d:
  5795. @example
  5796. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5797. @end example
  5798. @item
  5799. Same as above, but filtering only luma:
  5800. @example
  5801. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5802. @end example
  5803. @item
  5804. Same as above, but with both estimation modes:
  5805. @example
  5806. 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
  5807. @end example
  5808. @item
  5809. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5810. @example
  5811. 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
  5812. @end example
  5813. @end itemize
  5814. @section boxblur
  5815. Apply a boxblur algorithm to the input video.
  5816. It accepts the following parameters:
  5817. @table @option
  5818. @item luma_radius, lr
  5819. @item luma_power, lp
  5820. @item chroma_radius, cr
  5821. @item chroma_power, cp
  5822. @item alpha_radius, ar
  5823. @item alpha_power, ap
  5824. @end table
  5825. A description of the accepted options follows.
  5826. @table @option
  5827. @item luma_radius, lr
  5828. @item chroma_radius, cr
  5829. @item alpha_radius, ar
  5830. Set an expression for the box radius in pixels used for blurring the
  5831. corresponding input plane.
  5832. The radius value must be a non-negative number, and must not be
  5833. greater than the value of the expression @code{min(w,h)/2} for the
  5834. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5835. planes.
  5836. Default value for @option{luma_radius} is "2". If not specified,
  5837. @option{chroma_radius} and @option{alpha_radius} default to the
  5838. corresponding value set for @option{luma_radius}.
  5839. The expressions can contain the following constants:
  5840. @table @option
  5841. @item w
  5842. @item h
  5843. The input width and height in pixels.
  5844. @item cw
  5845. @item ch
  5846. The input chroma image width and height in pixels.
  5847. @item hsub
  5848. @item vsub
  5849. The horizontal and vertical chroma subsample values. For example, for the
  5850. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5851. @end table
  5852. @item luma_power, lp
  5853. @item chroma_power, cp
  5854. @item alpha_power, ap
  5855. Specify how many times the boxblur filter is applied to the
  5856. corresponding plane.
  5857. Default value for @option{luma_power} is 2. If not specified,
  5858. @option{chroma_power} and @option{alpha_power} default to the
  5859. corresponding value set for @option{luma_power}.
  5860. A value of 0 will disable the effect.
  5861. @end table
  5862. @subsection Examples
  5863. @itemize
  5864. @item
  5865. Apply a boxblur filter with the luma, chroma, and alpha radii
  5866. set to 2:
  5867. @example
  5868. boxblur=luma_radius=2:luma_power=1
  5869. boxblur=2:1
  5870. @end example
  5871. @item
  5872. Set the luma radius to 2, and alpha and chroma radius to 0:
  5873. @example
  5874. boxblur=2:1:cr=0:ar=0
  5875. @end example
  5876. @item
  5877. Set the luma and chroma radii to a fraction of the video dimension:
  5878. @example
  5879. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5880. @end example
  5881. @end itemize
  5882. @section bwdif
  5883. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5884. Deinterlacing Filter").
  5885. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5886. interpolation algorithms.
  5887. It accepts the following parameters:
  5888. @table @option
  5889. @item mode
  5890. The interlacing mode to adopt. It accepts one of the following values:
  5891. @table @option
  5892. @item 0, send_frame
  5893. Output one frame for each frame.
  5894. @item 1, send_field
  5895. Output one frame for each field.
  5896. @end table
  5897. The default value is @code{send_field}.
  5898. @item parity
  5899. The picture field parity assumed for the input interlaced video. It accepts one
  5900. of the following values:
  5901. @table @option
  5902. @item 0, tff
  5903. Assume the top field is first.
  5904. @item 1, bff
  5905. Assume the bottom field is first.
  5906. @item -1, auto
  5907. Enable automatic detection of field parity.
  5908. @end table
  5909. The default value is @code{auto}.
  5910. If the interlacing is unknown or the decoder does not export this information,
  5911. top field first will be assumed.
  5912. @item deint
  5913. Specify which frames to deinterlace. Accepts one of the following
  5914. values:
  5915. @table @option
  5916. @item 0, all
  5917. Deinterlace all frames.
  5918. @item 1, interlaced
  5919. Only deinterlace frames marked as interlaced.
  5920. @end table
  5921. The default value is @code{all}.
  5922. @end table
  5923. @section cas
  5924. Apply Contrast Adaptive Sharpen filter to video stream.
  5925. The filter accepts the following options:
  5926. @table @option
  5927. @item strength
  5928. Set the sharpening strength. Default value is 0.
  5929. @item planes
  5930. Set planes to filter. Default value is to filter all
  5931. planes except alpha plane.
  5932. @end table
  5933. @subsection Commands
  5934. This filter supports same @ref{commands} as options.
  5935. @section chromahold
  5936. Remove all color information for all colors except for certain one.
  5937. The filter accepts the following options:
  5938. @table @option
  5939. @item color
  5940. The color which will not be replaced with neutral chroma.
  5941. @item similarity
  5942. Similarity percentage with the above color.
  5943. 0.01 matches only the exact key color, while 1.0 matches everything.
  5944. @item blend
  5945. Blend percentage.
  5946. 0.0 makes pixels either fully gray, or not gray at all.
  5947. Higher values result in more preserved color.
  5948. @item yuv
  5949. Signals that the color passed is already in YUV instead of RGB.
  5950. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5951. This can be used to pass exact YUV values as hexadecimal numbers.
  5952. @end table
  5953. @subsection Commands
  5954. This filter supports same @ref{commands} as options.
  5955. The command accepts the same syntax of the corresponding option.
  5956. If the specified expression is not valid, it is kept at its current
  5957. value.
  5958. @section chromakey
  5959. YUV colorspace color/chroma keying.
  5960. The filter accepts the following options:
  5961. @table @option
  5962. @item color
  5963. The color which will be replaced with transparency.
  5964. @item similarity
  5965. Similarity percentage with the key color.
  5966. 0.01 matches only the exact key color, while 1.0 matches everything.
  5967. @item blend
  5968. Blend percentage.
  5969. 0.0 makes pixels either fully transparent, or not transparent at all.
  5970. Higher values result in semi-transparent pixels, with a higher transparency
  5971. the more similar the pixels color is to the key color.
  5972. @item yuv
  5973. Signals that the color passed is already in YUV instead of RGB.
  5974. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5975. This can be used to pass exact YUV values as hexadecimal numbers.
  5976. @end table
  5977. @subsection Commands
  5978. This filter supports same @ref{commands} as options.
  5979. The command accepts the same syntax of the corresponding option.
  5980. If the specified expression is not valid, it is kept at its current
  5981. value.
  5982. @subsection Examples
  5983. @itemize
  5984. @item
  5985. Make every green pixel in the input image transparent:
  5986. @example
  5987. ffmpeg -i input.png -vf chromakey=green out.png
  5988. @end example
  5989. @item
  5990. Overlay a greenscreen-video on top of a static black background.
  5991. @example
  5992. 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
  5993. @end example
  5994. @end itemize
  5995. @section chromanr
  5996. Reduce chrominance noise.
  5997. The filter accepts the following options:
  5998. @table @option
  5999. @item thres
  6000. Set threshold for averaging chrominance values.
  6001. Sum of absolute difference of Y, U and V pixel components of current
  6002. pixel and neighbour pixels lower than this threshold will be used in
  6003. averaging. Luma component is left unchanged and is copied to output.
  6004. Default value is 30. Allowed range is from 1 to 200.
  6005. @item sizew
  6006. Set horizontal radius of rectangle used for averaging.
  6007. Allowed range is from 1 to 100. Default value is 5.
  6008. @item sizeh
  6009. Set vertical radius of rectangle used for averaging.
  6010. Allowed range is from 1 to 100. Default value is 5.
  6011. @item stepw
  6012. Set horizontal step when averaging. Default value is 1.
  6013. Allowed range is from 1 to 50.
  6014. Mostly useful to speed-up filtering.
  6015. @item steph
  6016. Set vertical step when averaging. Default value is 1.
  6017. Allowed range is from 1 to 50.
  6018. Mostly useful to speed-up filtering.
  6019. @item threy
  6020. Set Y threshold for averaging chrominance values.
  6021. Set finer control for max allowed difference between Y components
  6022. of current pixel and neigbour pixels.
  6023. Default value is 200. Allowed range is from 1 to 200.
  6024. @item threu
  6025. Set U threshold for averaging chrominance values.
  6026. Set finer control for max allowed difference between U components
  6027. of current pixel and neigbour pixels.
  6028. Default value is 200. Allowed range is from 1 to 200.
  6029. @item threv
  6030. Set V threshold for averaging chrominance values.
  6031. Set finer control for max allowed difference between V components
  6032. of current pixel and neigbour pixels.
  6033. Default value is 200. Allowed range is from 1 to 200.
  6034. @end table
  6035. @subsection Commands
  6036. This filter supports same @ref{commands} as options.
  6037. The command accepts the same syntax of the corresponding option.
  6038. @section chromashift
  6039. Shift chroma pixels horizontally and/or vertically.
  6040. The filter accepts the following options:
  6041. @table @option
  6042. @item cbh
  6043. Set amount to shift chroma-blue horizontally.
  6044. @item cbv
  6045. Set amount to shift chroma-blue vertically.
  6046. @item crh
  6047. Set amount to shift chroma-red horizontally.
  6048. @item crv
  6049. Set amount to shift chroma-red vertically.
  6050. @item edge
  6051. Set edge mode, can be @var{smear}, default, or @var{warp}.
  6052. @end table
  6053. @subsection Commands
  6054. This filter supports the all above options as @ref{commands}.
  6055. @section ciescope
  6056. Display CIE color diagram with pixels overlaid onto it.
  6057. The filter accepts the following options:
  6058. @table @option
  6059. @item system
  6060. Set color system.
  6061. @table @samp
  6062. @item ntsc, 470m
  6063. @item ebu, 470bg
  6064. @item smpte
  6065. @item 240m
  6066. @item apple
  6067. @item widergb
  6068. @item cie1931
  6069. @item rec709, hdtv
  6070. @item uhdtv, rec2020
  6071. @item dcip3
  6072. @end table
  6073. @item cie
  6074. Set CIE system.
  6075. @table @samp
  6076. @item xyy
  6077. @item ucs
  6078. @item luv
  6079. @end table
  6080. @item gamuts
  6081. Set what gamuts to draw.
  6082. See @code{system} option for available values.
  6083. @item size, s
  6084. Set ciescope size, by default set to 512.
  6085. @item intensity, i
  6086. Set intensity used to map input pixel values to CIE diagram.
  6087. @item contrast
  6088. Set contrast used to draw tongue colors that are out of active color system gamut.
  6089. @item corrgamma
  6090. Correct gamma displayed on scope, by default enabled.
  6091. @item showwhite
  6092. Show white point on CIE diagram, by default disabled.
  6093. @item gamma
  6094. Set input gamma. Used only with XYZ input color space.
  6095. @end table
  6096. @section codecview
  6097. Visualize information exported by some codecs.
  6098. Some codecs can export information through frames using side-data or other
  6099. means. For example, some MPEG based codecs export motion vectors through the
  6100. @var{export_mvs} flag in the codec @option{flags2} option.
  6101. The filter accepts the following option:
  6102. @table @option
  6103. @item mv
  6104. Set motion vectors to visualize.
  6105. Available flags for @var{mv} are:
  6106. @table @samp
  6107. @item pf
  6108. forward predicted MVs of P-frames
  6109. @item bf
  6110. forward predicted MVs of B-frames
  6111. @item bb
  6112. backward predicted MVs of B-frames
  6113. @end table
  6114. @item qp
  6115. Display quantization parameters using the chroma planes.
  6116. @item mv_type, mvt
  6117. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  6118. Available flags for @var{mv_type} are:
  6119. @table @samp
  6120. @item fp
  6121. forward predicted MVs
  6122. @item bp
  6123. backward predicted MVs
  6124. @end table
  6125. @item frame_type, ft
  6126. Set frame type to visualize motion vectors of.
  6127. Available flags for @var{frame_type} are:
  6128. @table @samp
  6129. @item if
  6130. intra-coded frames (I-frames)
  6131. @item pf
  6132. predicted frames (P-frames)
  6133. @item bf
  6134. bi-directionally predicted frames (B-frames)
  6135. @end table
  6136. @end table
  6137. @subsection Examples
  6138. @itemize
  6139. @item
  6140. Visualize forward predicted MVs of all frames using @command{ffplay}:
  6141. @example
  6142. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  6143. @end example
  6144. @item
  6145. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  6146. @example
  6147. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  6148. @end example
  6149. @end itemize
  6150. @section colorbalance
  6151. Modify intensity of primary colors (red, green and blue) of input frames.
  6152. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  6153. regions for the red-cyan, green-magenta or blue-yellow balance.
  6154. A positive adjustment value shifts the balance towards the primary color, a negative
  6155. value towards the complementary color.
  6156. The filter accepts the following options:
  6157. @table @option
  6158. @item rs
  6159. @item gs
  6160. @item bs
  6161. Adjust red, green and blue shadows (darkest pixels).
  6162. @item rm
  6163. @item gm
  6164. @item bm
  6165. Adjust red, green and blue midtones (medium pixels).
  6166. @item rh
  6167. @item gh
  6168. @item bh
  6169. Adjust red, green and blue highlights (brightest pixels).
  6170. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6171. @item pl
  6172. Preserve lightness when changing color balance. Default is disabled.
  6173. @end table
  6174. @subsection Examples
  6175. @itemize
  6176. @item
  6177. Add red color cast to shadows:
  6178. @example
  6179. colorbalance=rs=.3
  6180. @end example
  6181. @end itemize
  6182. @subsection Commands
  6183. This filter supports the all above options as @ref{commands}.
  6184. @section colorchannelmixer
  6185. Adjust video input frames by re-mixing color channels.
  6186. This filter modifies a color channel by adding the values associated to
  6187. the other channels of the same pixels. For example if the value to
  6188. modify is red, the output value will be:
  6189. @example
  6190. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  6191. @end example
  6192. The filter accepts the following options:
  6193. @table @option
  6194. @item rr
  6195. @item rg
  6196. @item rb
  6197. @item ra
  6198. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  6199. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  6200. @item gr
  6201. @item gg
  6202. @item gb
  6203. @item ga
  6204. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  6205. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  6206. @item br
  6207. @item bg
  6208. @item bb
  6209. @item ba
  6210. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  6211. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  6212. @item ar
  6213. @item ag
  6214. @item ab
  6215. @item aa
  6216. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  6217. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  6218. Allowed ranges for options are @code{[-2.0, 2.0]}.
  6219. @end table
  6220. @subsection Examples
  6221. @itemize
  6222. @item
  6223. Convert source to grayscale:
  6224. @example
  6225. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  6226. @end example
  6227. @item
  6228. Simulate sepia tones:
  6229. @example
  6230. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  6231. @end example
  6232. @end itemize
  6233. @subsection Commands
  6234. This filter supports the all above options as @ref{commands}.
  6235. @section colorkey
  6236. RGB colorspace color keying.
  6237. The filter accepts the following options:
  6238. @table @option
  6239. @item color
  6240. The color which will be replaced with transparency.
  6241. @item similarity
  6242. Similarity percentage with the key color.
  6243. 0.01 matches only the exact key color, while 1.0 matches everything.
  6244. @item blend
  6245. Blend percentage.
  6246. 0.0 makes pixels either fully transparent, or not transparent at all.
  6247. Higher values result in semi-transparent pixels, with a higher transparency
  6248. the more similar the pixels color is to the key color.
  6249. @end table
  6250. @subsection Examples
  6251. @itemize
  6252. @item
  6253. Make every green pixel in the input image transparent:
  6254. @example
  6255. ffmpeg -i input.png -vf colorkey=green out.png
  6256. @end example
  6257. @item
  6258. Overlay a greenscreen-video on top of a static background image.
  6259. @example
  6260. 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
  6261. @end example
  6262. @end itemize
  6263. @subsection Commands
  6264. This filter supports same @ref{commands} as options.
  6265. The command accepts the same syntax of the corresponding option.
  6266. If the specified expression is not valid, it is kept at its current
  6267. value.
  6268. @section colorhold
  6269. Remove all color information for all RGB colors except for certain one.
  6270. The filter accepts the following options:
  6271. @table @option
  6272. @item color
  6273. The color which will not be replaced with neutral gray.
  6274. @item similarity
  6275. Similarity percentage with the above color.
  6276. 0.01 matches only the exact key color, while 1.0 matches everything.
  6277. @item blend
  6278. Blend percentage. 0.0 makes pixels fully gray.
  6279. Higher values result in more preserved color.
  6280. @end table
  6281. @subsection Commands
  6282. This filter supports same @ref{commands} as options.
  6283. The command accepts the same syntax of the corresponding option.
  6284. If the specified expression is not valid, it is kept at its current
  6285. value.
  6286. @section colorlevels
  6287. Adjust video input frames using levels.
  6288. The filter accepts the following options:
  6289. @table @option
  6290. @item rimin
  6291. @item gimin
  6292. @item bimin
  6293. @item aimin
  6294. Adjust red, green, blue and alpha input black point.
  6295. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6296. @item rimax
  6297. @item gimax
  6298. @item bimax
  6299. @item aimax
  6300. Adjust red, green, blue and alpha input white point.
  6301. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6302. Input levels are used to lighten highlights (bright tones), darken shadows
  6303. (dark tones), change the balance of bright and dark tones.
  6304. @item romin
  6305. @item gomin
  6306. @item bomin
  6307. @item aomin
  6308. Adjust red, green, blue and alpha output black point.
  6309. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6310. @item romax
  6311. @item gomax
  6312. @item bomax
  6313. @item aomax
  6314. Adjust red, green, blue and alpha output white point.
  6315. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6316. Output levels allows manual selection of a constrained output level range.
  6317. @end table
  6318. @subsection Examples
  6319. @itemize
  6320. @item
  6321. Make video output darker:
  6322. @example
  6323. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6324. @end example
  6325. @item
  6326. Increase contrast:
  6327. @example
  6328. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6329. @end example
  6330. @item
  6331. Make video output lighter:
  6332. @example
  6333. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6334. @end example
  6335. @item
  6336. Increase brightness:
  6337. @example
  6338. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6339. @end example
  6340. @end itemize
  6341. @subsection Commands
  6342. This filter supports the all above options as @ref{commands}.
  6343. @section colormatrix
  6344. Convert color matrix.
  6345. The filter accepts the following options:
  6346. @table @option
  6347. @item src
  6348. @item dst
  6349. Specify the source and destination color matrix. Both values must be
  6350. specified.
  6351. The accepted values are:
  6352. @table @samp
  6353. @item bt709
  6354. BT.709
  6355. @item fcc
  6356. FCC
  6357. @item bt601
  6358. BT.601
  6359. @item bt470
  6360. BT.470
  6361. @item bt470bg
  6362. BT.470BG
  6363. @item smpte170m
  6364. SMPTE-170M
  6365. @item smpte240m
  6366. SMPTE-240M
  6367. @item bt2020
  6368. BT.2020
  6369. @end table
  6370. @end table
  6371. For example to convert from BT.601 to SMPTE-240M, use the command:
  6372. @example
  6373. colormatrix=bt601:smpte240m
  6374. @end example
  6375. @section colorspace
  6376. Convert colorspace, transfer characteristics or color primaries.
  6377. Input video needs to have an even size.
  6378. The filter accepts the following options:
  6379. @table @option
  6380. @anchor{all}
  6381. @item all
  6382. Specify all color properties at once.
  6383. The accepted values are:
  6384. @table @samp
  6385. @item bt470m
  6386. BT.470M
  6387. @item bt470bg
  6388. BT.470BG
  6389. @item bt601-6-525
  6390. BT.601-6 525
  6391. @item bt601-6-625
  6392. BT.601-6 625
  6393. @item bt709
  6394. BT.709
  6395. @item smpte170m
  6396. SMPTE-170M
  6397. @item smpte240m
  6398. SMPTE-240M
  6399. @item bt2020
  6400. BT.2020
  6401. @end table
  6402. @anchor{space}
  6403. @item space
  6404. Specify output colorspace.
  6405. The accepted values are:
  6406. @table @samp
  6407. @item bt709
  6408. BT.709
  6409. @item fcc
  6410. FCC
  6411. @item bt470bg
  6412. BT.470BG or BT.601-6 625
  6413. @item smpte170m
  6414. SMPTE-170M or BT.601-6 525
  6415. @item smpte240m
  6416. SMPTE-240M
  6417. @item ycgco
  6418. YCgCo
  6419. @item bt2020ncl
  6420. BT.2020 with non-constant luminance
  6421. @end table
  6422. @anchor{trc}
  6423. @item trc
  6424. Specify output transfer characteristics.
  6425. The accepted values are:
  6426. @table @samp
  6427. @item bt709
  6428. BT.709
  6429. @item bt470m
  6430. BT.470M
  6431. @item bt470bg
  6432. BT.470BG
  6433. @item gamma22
  6434. Constant gamma of 2.2
  6435. @item gamma28
  6436. Constant gamma of 2.8
  6437. @item smpte170m
  6438. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6439. @item smpte240m
  6440. SMPTE-240M
  6441. @item srgb
  6442. SRGB
  6443. @item iec61966-2-1
  6444. iec61966-2-1
  6445. @item iec61966-2-4
  6446. iec61966-2-4
  6447. @item xvycc
  6448. xvycc
  6449. @item bt2020-10
  6450. BT.2020 for 10-bits content
  6451. @item bt2020-12
  6452. BT.2020 for 12-bits content
  6453. @end table
  6454. @anchor{primaries}
  6455. @item primaries
  6456. Specify output color primaries.
  6457. The accepted values are:
  6458. @table @samp
  6459. @item bt709
  6460. BT.709
  6461. @item bt470m
  6462. BT.470M
  6463. @item bt470bg
  6464. BT.470BG or BT.601-6 625
  6465. @item smpte170m
  6466. SMPTE-170M or BT.601-6 525
  6467. @item smpte240m
  6468. SMPTE-240M
  6469. @item film
  6470. film
  6471. @item smpte431
  6472. SMPTE-431
  6473. @item smpte432
  6474. SMPTE-432
  6475. @item bt2020
  6476. BT.2020
  6477. @item jedec-p22
  6478. JEDEC P22 phosphors
  6479. @end table
  6480. @anchor{range}
  6481. @item range
  6482. Specify output color range.
  6483. The accepted values are:
  6484. @table @samp
  6485. @item tv
  6486. TV (restricted) range
  6487. @item mpeg
  6488. MPEG (restricted) range
  6489. @item pc
  6490. PC (full) range
  6491. @item jpeg
  6492. JPEG (full) range
  6493. @end table
  6494. @item format
  6495. Specify output color format.
  6496. The accepted values are:
  6497. @table @samp
  6498. @item yuv420p
  6499. YUV 4:2:0 planar 8-bits
  6500. @item yuv420p10
  6501. YUV 4:2:0 planar 10-bits
  6502. @item yuv420p12
  6503. YUV 4:2:0 planar 12-bits
  6504. @item yuv422p
  6505. YUV 4:2:2 planar 8-bits
  6506. @item yuv422p10
  6507. YUV 4:2:2 planar 10-bits
  6508. @item yuv422p12
  6509. YUV 4:2:2 planar 12-bits
  6510. @item yuv444p
  6511. YUV 4:4:4 planar 8-bits
  6512. @item yuv444p10
  6513. YUV 4:4:4 planar 10-bits
  6514. @item yuv444p12
  6515. YUV 4:4:4 planar 12-bits
  6516. @end table
  6517. @item fast
  6518. Do a fast conversion, which skips gamma/primary correction. This will take
  6519. significantly less CPU, but will be mathematically incorrect. To get output
  6520. compatible with that produced by the colormatrix filter, use fast=1.
  6521. @item dither
  6522. Specify dithering mode.
  6523. The accepted values are:
  6524. @table @samp
  6525. @item none
  6526. No dithering
  6527. @item fsb
  6528. Floyd-Steinberg dithering
  6529. @end table
  6530. @item wpadapt
  6531. Whitepoint adaptation mode.
  6532. The accepted values are:
  6533. @table @samp
  6534. @item bradford
  6535. Bradford whitepoint adaptation
  6536. @item vonkries
  6537. von Kries whitepoint adaptation
  6538. @item identity
  6539. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6540. @end table
  6541. @item iall
  6542. Override all input properties at once. Same accepted values as @ref{all}.
  6543. @item ispace
  6544. Override input colorspace. Same accepted values as @ref{space}.
  6545. @item iprimaries
  6546. Override input color primaries. Same accepted values as @ref{primaries}.
  6547. @item itrc
  6548. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6549. @item irange
  6550. Override input color range. Same accepted values as @ref{range}.
  6551. @end table
  6552. The filter converts the transfer characteristics, color space and color
  6553. primaries to the specified user values. The output value, if not specified,
  6554. is set to a default value based on the "all" property. If that property is
  6555. also not specified, the filter will log an error. The output color range and
  6556. format default to the same value as the input color range and format. The
  6557. input transfer characteristics, color space, color primaries and color range
  6558. should be set on the input data. If any of these are missing, the filter will
  6559. log an error and no conversion will take place.
  6560. For example to convert the input to SMPTE-240M, use the command:
  6561. @example
  6562. colorspace=smpte240m
  6563. @end example
  6564. @section convolution
  6565. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6566. The filter accepts the following options:
  6567. @table @option
  6568. @item 0m
  6569. @item 1m
  6570. @item 2m
  6571. @item 3m
  6572. Set matrix for each plane.
  6573. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6574. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6575. @item 0rdiv
  6576. @item 1rdiv
  6577. @item 2rdiv
  6578. @item 3rdiv
  6579. Set multiplier for calculated value for each plane.
  6580. If unset or 0, it will be sum of all matrix elements.
  6581. @item 0bias
  6582. @item 1bias
  6583. @item 2bias
  6584. @item 3bias
  6585. Set bias for each plane. This value is added to the result of the multiplication.
  6586. Useful for making the overall image brighter or darker. Default is 0.0.
  6587. @item 0mode
  6588. @item 1mode
  6589. @item 2mode
  6590. @item 3mode
  6591. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6592. Default is @var{square}.
  6593. @end table
  6594. @subsection Commands
  6595. This filter supports the all above options as @ref{commands}.
  6596. @subsection Examples
  6597. @itemize
  6598. @item
  6599. Apply sharpen:
  6600. @example
  6601. 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"
  6602. @end example
  6603. @item
  6604. Apply blur:
  6605. @example
  6606. 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"
  6607. @end example
  6608. @item
  6609. Apply edge enhance:
  6610. @example
  6611. 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"
  6612. @end example
  6613. @item
  6614. Apply edge detect:
  6615. @example
  6616. 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"
  6617. @end example
  6618. @item
  6619. Apply laplacian edge detector which includes diagonals:
  6620. @example
  6621. 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"
  6622. @end example
  6623. @item
  6624. Apply emboss:
  6625. @example
  6626. 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"
  6627. @end example
  6628. @end itemize
  6629. @section convolve
  6630. Apply 2D convolution of video stream in frequency domain using second stream
  6631. as impulse.
  6632. The filter accepts the following options:
  6633. @table @option
  6634. @item planes
  6635. Set which planes to process.
  6636. @item impulse
  6637. Set which impulse video frames will be processed, can be @var{first}
  6638. or @var{all}. Default is @var{all}.
  6639. @end table
  6640. The @code{convolve} filter also supports the @ref{framesync} options.
  6641. @section copy
  6642. Copy the input video source unchanged to the output. This is mainly useful for
  6643. testing purposes.
  6644. @anchor{coreimage}
  6645. @section coreimage
  6646. Video filtering on GPU using Apple's CoreImage API on OSX.
  6647. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6648. processed by video hardware. However, software-based OpenGL implementations
  6649. exist which means there is no guarantee for hardware processing. It depends on
  6650. the respective OSX.
  6651. There are many filters and image generators provided by Apple that come with a
  6652. large variety of options. The filter has to be referenced by its name along
  6653. with its options.
  6654. The coreimage filter accepts the following options:
  6655. @table @option
  6656. @item list_filters
  6657. List all available filters and generators along with all their respective
  6658. options as well as possible minimum and maximum values along with the default
  6659. values.
  6660. @example
  6661. list_filters=true
  6662. @end example
  6663. @item filter
  6664. Specify all filters by their respective name and options.
  6665. Use @var{list_filters} to determine all valid filter names and options.
  6666. Numerical options are specified by a float value and are automatically clamped
  6667. to their respective value range. Vector and color options have to be specified
  6668. by a list of space separated float values. Character escaping has to be done.
  6669. A special option name @code{default} is available to use default options for a
  6670. filter.
  6671. It is required to specify either @code{default} or at least one of the filter options.
  6672. All omitted options are used with their default values.
  6673. The syntax of the filter string is as follows:
  6674. @example
  6675. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6676. @end example
  6677. @item output_rect
  6678. Specify a rectangle where the output of the filter chain is copied into the
  6679. input image. It is given by a list of space separated float values:
  6680. @example
  6681. output_rect=x\ y\ width\ height
  6682. @end example
  6683. If not given, the output rectangle equals the dimensions of the input image.
  6684. The output rectangle is automatically cropped at the borders of the input
  6685. image. Negative values are valid for each component.
  6686. @example
  6687. output_rect=25\ 25\ 100\ 100
  6688. @end example
  6689. @end table
  6690. Several filters can be chained for successive processing without GPU-HOST
  6691. transfers allowing for fast processing of complex filter chains.
  6692. Currently, only filters with zero (generators) or exactly one (filters) input
  6693. image and one output image are supported. Also, transition filters are not yet
  6694. usable as intended.
  6695. Some filters generate output images with additional padding depending on the
  6696. respective filter kernel. The padding is automatically removed to ensure the
  6697. filter output has the same size as the input image.
  6698. For image generators, the size of the output image is determined by the
  6699. previous output image of the filter chain or the input image of the whole
  6700. filterchain, respectively. The generators do not use the pixel information of
  6701. this image to generate their output. However, the generated output is
  6702. blended onto this image, resulting in partial or complete coverage of the
  6703. output image.
  6704. The @ref{coreimagesrc} video source can be used for generating input images
  6705. which are directly fed into the filter chain. By using it, providing input
  6706. images by another video source or an input video is not required.
  6707. @subsection Examples
  6708. @itemize
  6709. @item
  6710. List all filters available:
  6711. @example
  6712. coreimage=list_filters=true
  6713. @end example
  6714. @item
  6715. Use the CIBoxBlur filter with default options to blur an image:
  6716. @example
  6717. coreimage=filter=CIBoxBlur@@default
  6718. @end example
  6719. @item
  6720. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6721. its center at 100x100 and a radius of 50 pixels:
  6722. @example
  6723. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6724. @end example
  6725. @item
  6726. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6727. given as complete and escaped command-line for Apple's standard bash shell:
  6728. @example
  6729. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6730. @end example
  6731. @end itemize
  6732. @section cover_rect
  6733. Cover a rectangular object
  6734. It accepts the following options:
  6735. @table @option
  6736. @item cover
  6737. Filepath of the optional cover image, needs to be in yuv420.
  6738. @item mode
  6739. Set covering mode.
  6740. It accepts the following values:
  6741. @table @samp
  6742. @item cover
  6743. cover it by the supplied image
  6744. @item blur
  6745. cover it by interpolating the surrounding pixels
  6746. @end table
  6747. Default value is @var{blur}.
  6748. @end table
  6749. @subsection Examples
  6750. @itemize
  6751. @item
  6752. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6753. @example
  6754. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6755. @end example
  6756. @end itemize
  6757. @section crop
  6758. Crop the input video to given dimensions.
  6759. It accepts the following parameters:
  6760. @table @option
  6761. @item w, out_w
  6762. The width of the output video. It defaults to @code{iw}.
  6763. This expression is evaluated only once during the filter
  6764. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6765. @item h, out_h
  6766. The height of the output video. It defaults to @code{ih}.
  6767. This expression is evaluated only once during the filter
  6768. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6769. @item x
  6770. The horizontal position, in the input video, of the left edge of the output
  6771. video. It defaults to @code{(in_w-out_w)/2}.
  6772. This expression is evaluated per-frame.
  6773. @item y
  6774. The vertical position, in the input video, of the top edge of the output video.
  6775. It defaults to @code{(in_h-out_h)/2}.
  6776. This expression is evaluated per-frame.
  6777. @item keep_aspect
  6778. If set to 1 will force the output display aspect ratio
  6779. to be the same of the input, by changing the output sample aspect
  6780. ratio. It defaults to 0.
  6781. @item exact
  6782. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6783. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6784. It defaults to 0.
  6785. @end table
  6786. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6787. expressions containing the following constants:
  6788. @table @option
  6789. @item x
  6790. @item y
  6791. The computed values for @var{x} and @var{y}. They are evaluated for
  6792. each new frame.
  6793. @item in_w
  6794. @item in_h
  6795. The input width and height.
  6796. @item iw
  6797. @item ih
  6798. These are the same as @var{in_w} and @var{in_h}.
  6799. @item out_w
  6800. @item out_h
  6801. The output (cropped) width and height.
  6802. @item ow
  6803. @item oh
  6804. These are the same as @var{out_w} and @var{out_h}.
  6805. @item a
  6806. same as @var{iw} / @var{ih}
  6807. @item sar
  6808. input sample aspect ratio
  6809. @item dar
  6810. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6811. @item hsub
  6812. @item vsub
  6813. horizontal and vertical chroma subsample values. For example for the
  6814. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6815. @item n
  6816. The number of the input frame, starting from 0.
  6817. @item pos
  6818. the position in the file of the input frame, NAN if unknown
  6819. @item t
  6820. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6821. @end table
  6822. The expression for @var{out_w} may depend on the value of @var{out_h},
  6823. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6824. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6825. evaluated after @var{out_w} and @var{out_h}.
  6826. The @var{x} and @var{y} parameters specify the expressions for the
  6827. position of the top-left corner of the output (non-cropped) area. They
  6828. are evaluated for each frame. If the evaluated value is not valid, it
  6829. is approximated to the nearest valid value.
  6830. The expression for @var{x} may depend on @var{y}, and the expression
  6831. for @var{y} may depend on @var{x}.
  6832. @subsection Examples
  6833. @itemize
  6834. @item
  6835. Crop area with size 100x100 at position (12,34).
  6836. @example
  6837. crop=100:100:12:34
  6838. @end example
  6839. Using named options, the example above becomes:
  6840. @example
  6841. crop=w=100:h=100:x=12:y=34
  6842. @end example
  6843. @item
  6844. Crop the central input area with size 100x100:
  6845. @example
  6846. crop=100:100
  6847. @end example
  6848. @item
  6849. Crop the central input area with size 2/3 of the input video:
  6850. @example
  6851. crop=2/3*in_w:2/3*in_h
  6852. @end example
  6853. @item
  6854. Crop the input video central square:
  6855. @example
  6856. crop=out_w=in_h
  6857. crop=in_h
  6858. @end example
  6859. @item
  6860. Delimit the rectangle with the top-left corner placed at position
  6861. 100:100 and the right-bottom corner corresponding to the right-bottom
  6862. corner of the input image.
  6863. @example
  6864. crop=in_w-100:in_h-100:100:100
  6865. @end example
  6866. @item
  6867. Crop 10 pixels from the left and right borders, and 20 pixels from
  6868. the top and bottom borders
  6869. @example
  6870. crop=in_w-2*10:in_h-2*20
  6871. @end example
  6872. @item
  6873. Keep only the bottom right quarter of the input image:
  6874. @example
  6875. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6876. @end example
  6877. @item
  6878. Crop height for getting Greek harmony:
  6879. @example
  6880. crop=in_w:1/PHI*in_w
  6881. @end example
  6882. @item
  6883. Apply trembling effect:
  6884. @example
  6885. 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)
  6886. @end example
  6887. @item
  6888. Apply erratic camera effect depending on timestamp:
  6889. @example
  6890. 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)"
  6891. @end example
  6892. @item
  6893. Set x depending on the value of y:
  6894. @example
  6895. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6896. @end example
  6897. @end itemize
  6898. @subsection Commands
  6899. This filter supports the following commands:
  6900. @table @option
  6901. @item w, out_w
  6902. @item h, out_h
  6903. @item x
  6904. @item y
  6905. Set width/height of the output video and the horizontal/vertical position
  6906. in the input video.
  6907. The command accepts the same syntax of the corresponding option.
  6908. If the specified expression is not valid, it is kept at its current
  6909. value.
  6910. @end table
  6911. @section cropdetect
  6912. Auto-detect the crop size.
  6913. It calculates the necessary cropping parameters and prints the
  6914. recommended parameters via the logging system. The detected dimensions
  6915. correspond to the non-black area of the input video.
  6916. It accepts the following parameters:
  6917. @table @option
  6918. @item limit
  6919. Set higher black value threshold, which can be optionally specified
  6920. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6921. value greater to the set value is considered non-black. It defaults to 24.
  6922. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6923. on the bitdepth of the pixel format.
  6924. @item round
  6925. The value which the width/height should be divisible by. It defaults to
  6926. 16. The offset is automatically adjusted to center the video. Use 2 to
  6927. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6928. encoding to most video codecs.
  6929. @item skip
  6930. Set the number of initial frames for which evaluation is skipped.
  6931. Default is 2. Range is 0 to INT_MAX.
  6932. @item reset_count, reset
  6933. Set the counter that determines after how many frames cropdetect will
  6934. reset the previously detected largest video area and start over to
  6935. detect the current optimal crop area. Default value is 0.
  6936. This can be useful when channel logos distort the video area. 0
  6937. indicates 'never reset', and returns the largest area encountered during
  6938. playback.
  6939. @end table
  6940. @anchor{cue}
  6941. @section cue
  6942. Delay video filtering until a given wallclock timestamp. The filter first
  6943. passes on @option{preroll} amount of frames, then it buffers at most
  6944. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6945. it forwards the buffered frames and also any subsequent frames coming in its
  6946. input.
  6947. The filter can be used synchronize the output of multiple ffmpeg processes for
  6948. realtime output devices like decklink. By putting the delay in the filtering
  6949. chain and pre-buffering frames the process can pass on data to output almost
  6950. immediately after the target wallclock timestamp is reached.
  6951. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6952. some use cases.
  6953. @table @option
  6954. @item cue
  6955. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6956. @item preroll
  6957. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6958. @item buffer
  6959. The maximum duration of content to buffer before waiting for the cue expressed
  6960. in seconds. Default is 0.
  6961. @end table
  6962. @anchor{curves}
  6963. @section curves
  6964. Apply color adjustments using curves.
  6965. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6966. component (red, green and blue) has its values defined by @var{N} key points
  6967. tied from each other using a smooth curve. The x-axis represents the pixel
  6968. values from the input frame, and the y-axis the new pixel values to be set for
  6969. the output frame.
  6970. By default, a component curve is defined by the two points @var{(0;0)} and
  6971. @var{(1;1)}. This creates a straight line where each original pixel value is
  6972. "adjusted" to its own value, which means no change to the image.
  6973. The filter allows you to redefine these two points and add some more. A new
  6974. curve (using a natural cubic spline interpolation) will be define to pass
  6975. smoothly through all these new coordinates. The new defined points needs to be
  6976. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6977. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6978. the vector spaces, the values will be clipped accordingly.
  6979. The filter accepts the following options:
  6980. @table @option
  6981. @item preset
  6982. Select one of the available color presets. This option can be used in addition
  6983. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6984. options takes priority on the preset values.
  6985. Available presets are:
  6986. @table @samp
  6987. @item none
  6988. @item color_negative
  6989. @item cross_process
  6990. @item darker
  6991. @item increase_contrast
  6992. @item lighter
  6993. @item linear_contrast
  6994. @item medium_contrast
  6995. @item negative
  6996. @item strong_contrast
  6997. @item vintage
  6998. @end table
  6999. Default is @code{none}.
  7000. @item master, m
  7001. Set the master key points. These points will define a second pass mapping. It
  7002. is sometimes called a "luminance" or "value" mapping. It can be used with
  7003. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  7004. post-processing LUT.
  7005. @item red, r
  7006. Set the key points for the red component.
  7007. @item green, g
  7008. Set the key points for the green component.
  7009. @item blue, b
  7010. Set the key points for the blue component.
  7011. @item all
  7012. Set the key points for all components (not including master).
  7013. Can be used in addition to the other key points component
  7014. options. In this case, the unset component(s) will fallback on this
  7015. @option{all} setting.
  7016. @item psfile
  7017. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  7018. @item plot
  7019. Save Gnuplot script of the curves in specified file.
  7020. @end table
  7021. To avoid some filtergraph syntax conflicts, each key points list need to be
  7022. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  7023. @subsection Examples
  7024. @itemize
  7025. @item
  7026. Increase slightly the middle level of blue:
  7027. @example
  7028. curves=blue='0/0 0.5/0.58 1/1'
  7029. @end example
  7030. @item
  7031. Vintage effect:
  7032. @example
  7033. 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'
  7034. @end example
  7035. Here we obtain the following coordinates for each components:
  7036. @table @var
  7037. @item red
  7038. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  7039. @item green
  7040. @code{(0;0) (0.50;0.48) (1;1)}
  7041. @item blue
  7042. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  7043. @end table
  7044. @item
  7045. The previous example can also be achieved with the associated built-in preset:
  7046. @example
  7047. curves=preset=vintage
  7048. @end example
  7049. @item
  7050. Or simply:
  7051. @example
  7052. curves=vintage
  7053. @end example
  7054. @item
  7055. Use a Photoshop preset and redefine the points of the green component:
  7056. @example
  7057. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  7058. @end example
  7059. @item
  7060. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  7061. and @command{gnuplot}:
  7062. @example
  7063. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  7064. gnuplot -p /tmp/curves.plt
  7065. @end example
  7066. @end itemize
  7067. @section datascope
  7068. Video data analysis filter.
  7069. This filter shows hexadecimal pixel values of part of video.
  7070. The filter accepts the following options:
  7071. @table @option
  7072. @item size, s
  7073. Set output video size.
  7074. @item x
  7075. Set x offset from where to pick pixels.
  7076. @item y
  7077. Set y offset from where to pick pixels.
  7078. @item mode
  7079. Set scope mode, can be one of the following:
  7080. @table @samp
  7081. @item mono
  7082. Draw hexadecimal pixel values with white color on black background.
  7083. @item color
  7084. Draw hexadecimal pixel values with input video pixel color on black
  7085. background.
  7086. @item color2
  7087. Draw hexadecimal pixel values on color background picked from input video,
  7088. the text color is picked in such way so its always visible.
  7089. @end table
  7090. @item axis
  7091. Draw rows and columns numbers on left and top of video.
  7092. @item opacity
  7093. Set background opacity.
  7094. @item format
  7095. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  7096. @end table
  7097. @section dblur
  7098. Apply Directional blur filter.
  7099. The filter accepts the following options:
  7100. @table @option
  7101. @item angle
  7102. Set angle of directional blur. Default is @code{45}.
  7103. @item radius
  7104. Set radius of directional blur. Default is @code{5}.
  7105. @item planes
  7106. Set which planes to filter. By default all planes are filtered.
  7107. @end table
  7108. @subsection Commands
  7109. This filter supports same @ref{commands} as options.
  7110. The command accepts the same syntax of the corresponding option.
  7111. If the specified expression is not valid, it is kept at its current
  7112. value.
  7113. @section dctdnoiz
  7114. Denoise frames using 2D DCT (frequency domain filtering).
  7115. This filter is not designed for real time.
  7116. The filter accepts the following options:
  7117. @table @option
  7118. @item sigma, s
  7119. Set the noise sigma constant.
  7120. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  7121. coefficient (absolute value) below this threshold with be dropped.
  7122. If you need a more advanced filtering, see @option{expr}.
  7123. Default is @code{0}.
  7124. @item overlap
  7125. Set number overlapping pixels for each block. Since the filter can be slow, you
  7126. may want to reduce this value, at the cost of a less effective filter and the
  7127. risk of various artefacts.
  7128. If the overlapping value doesn't permit processing the whole input width or
  7129. height, a warning will be displayed and according borders won't be denoised.
  7130. Default value is @var{blocksize}-1, which is the best possible setting.
  7131. @item expr, e
  7132. Set the coefficient factor expression.
  7133. For each coefficient of a DCT block, this expression will be evaluated as a
  7134. multiplier value for the coefficient.
  7135. If this is option is set, the @option{sigma} option will be ignored.
  7136. The absolute value of the coefficient can be accessed through the @var{c}
  7137. variable.
  7138. @item n
  7139. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  7140. @var{blocksize}, which is the width and height of the processed blocks.
  7141. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  7142. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  7143. on the speed processing. Also, a larger block size does not necessarily means a
  7144. better de-noising.
  7145. @end table
  7146. @subsection Examples
  7147. Apply a denoise with a @option{sigma} of @code{4.5}:
  7148. @example
  7149. dctdnoiz=4.5
  7150. @end example
  7151. The same operation can be achieved using the expression system:
  7152. @example
  7153. dctdnoiz=e='gte(c, 4.5*3)'
  7154. @end example
  7155. Violent denoise using a block size of @code{16x16}:
  7156. @example
  7157. dctdnoiz=15:n=4
  7158. @end example
  7159. @section deband
  7160. Remove banding artifacts from input video.
  7161. It works by replacing banded pixels with average value of referenced pixels.
  7162. The filter accepts the following options:
  7163. @table @option
  7164. @item 1thr
  7165. @item 2thr
  7166. @item 3thr
  7167. @item 4thr
  7168. Set banding detection threshold for each plane. Default is 0.02.
  7169. Valid range is 0.00003 to 0.5.
  7170. If difference between current pixel and reference pixel is less than threshold,
  7171. it will be considered as banded.
  7172. @item range, r
  7173. Banding detection range in pixels. Default is 16. If positive, random number
  7174. in range 0 to set value will be used. If negative, exact absolute value
  7175. will be used.
  7176. The range defines square of four pixels around current pixel.
  7177. @item direction, d
  7178. Set direction in radians from which four pixel will be compared. If positive,
  7179. random direction from 0 to set direction will be picked. If negative, exact of
  7180. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  7181. will pick only pixels on same row and -PI/2 will pick only pixels on same
  7182. column.
  7183. @item blur, b
  7184. If enabled, current pixel is compared with average value of all four
  7185. surrounding pixels. The default is enabled. If disabled current pixel is
  7186. compared with all four surrounding pixels. The pixel is considered banded
  7187. if only all four differences with surrounding pixels are less than threshold.
  7188. @item coupling, c
  7189. If enabled, current pixel is changed if and only if all pixel components are banded,
  7190. e.g. banding detection threshold is triggered for all color components.
  7191. The default is disabled.
  7192. @end table
  7193. @section deblock
  7194. Remove blocking artifacts from input video.
  7195. The filter accepts the following options:
  7196. @table @option
  7197. @item filter
  7198. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  7199. This controls what kind of deblocking is applied.
  7200. @item block
  7201. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  7202. @item alpha
  7203. @item beta
  7204. @item gamma
  7205. @item delta
  7206. Set blocking detection thresholds. Allowed range is 0 to 1.
  7207. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  7208. Using higher threshold gives more deblocking strength.
  7209. Setting @var{alpha} controls threshold detection at exact edge of block.
  7210. Remaining options controls threshold detection near the edge. Each one for
  7211. below/above or left/right. Setting any of those to @var{0} disables
  7212. deblocking.
  7213. @item planes
  7214. Set planes to filter. Default is to filter all available planes.
  7215. @end table
  7216. @subsection Examples
  7217. @itemize
  7218. @item
  7219. Deblock using weak filter and block size of 4 pixels.
  7220. @example
  7221. deblock=filter=weak:block=4
  7222. @end example
  7223. @item
  7224. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  7225. deblocking more edges.
  7226. @example
  7227. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  7228. @end example
  7229. @item
  7230. Similar as above, but filter only first plane.
  7231. @example
  7232. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  7233. @end example
  7234. @item
  7235. Similar as above, but filter only second and third plane.
  7236. @example
  7237. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  7238. @end example
  7239. @end itemize
  7240. @anchor{decimate}
  7241. @section decimate
  7242. Drop duplicated frames at regular intervals.
  7243. The filter accepts the following options:
  7244. @table @option
  7245. @item cycle
  7246. Set the number of frames from which one will be dropped. Setting this to
  7247. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  7248. Default is @code{5}.
  7249. @item dupthresh
  7250. Set the threshold for duplicate detection. If the difference metric for a frame
  7251. is less than or equal to this value, then it is declared as duplicate. Default
  7252. is @code{1.1}
  7253. @item scthresh
  7254. Set scene change threshold. Default is @code{15}.
  7255. @item blockx
  7256. @item blocky
  7257. Set the size of the x and y-axis blocks used during metric calculations.
  7258. Larger blocks give better noise suppression, but also give worse detection of
  7259. small movements. Must be a power of two. Default is @code{32}.
  7260. @item ppsrc
  7261. Mark main input as a pre-processed input and activate clean source input
  7262. stream. This allows the input to be pre-processed with various filters to help
  7263. the metrics calculation while keeping the frame selection lossless. When set to
  7264. @code{1}, the first stream is for the pre-processed input, and the second
  7265. stream is the clean source from where the kept frames are chosen. Default is
  7266. @code{0}.
  7267. @item chroma
  7268. Set whether or not chroma is considered in the metric calculations. Default is
  7269. @code{1}.
  7270. @end table
  7271. @section deconvolve
  7272. Apply 2D deconvolution of video stream in frequency domain using second stream
  7273. as impulse.
  7274. The filter accepts the following options:
  7275. @table @option
  7276. @item planes
  7277. Set which planes to process.
  7278. @item impulse
  7279. Set which impulse video frames will be processed, can be @var{first}
  7280. or @var{all}. Default is @var{all}.
  7281. @item noise
  7282. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  7283. and height are not same and not power of 2 or if stream prior to convolving
  7284. had noise.
  7285. @end table
  7286. The @code{deconvolve} filter also supports the @ref{framesync} options.
  7287. @section dedot
  7288. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  7289. It accepts the following options:
  7290. @table @option
  7291. @item m
  7292. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  7293. @var{rainbows} for cross-color reduction.
  7294. @item lt
  7295. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  7296. @item tl
  7297. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  7298. @item tc
  7299. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  7300. @item ct
  7301. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7302. @end table
  7303. @section deflate
  7304. Apply deflate effect to the video.
  7305. This filter replaces the pixel by the local(3x3) average by taking into account
  7306. only values lower than the pixel.
  7307. It accepts the following options:
  7308. @table @option
  7309. @item threshold0
  7310. @item threshold1
  7311. @item threshold2
  7312. @item threshold3
  7313. Limit the maximum change for each plane, default is 65535.
  7314. If 0, plane will remain unchanged.
  7315. @end table
  7316. @subsection Commands
  7317. This filter supports the all above options as @ref{commands}.
  7318. @section deflicker
  7319. Remove temporal frame luminance variations.
  7320. It accepts the following options:
  7321. @table @option
  7322. @item size, s
  7323. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7324. @item mode, m
  7325. Set averaging mode to smooth temporal luminance variations.
  7326. Available values are:
  7327. @table @samp
  7328. @item am
  7329. Arithmetic mean
  7330. @item gm
  7331. Geometric mean
  7332. @item hm
  7333. Harmonic mean
  7334. @item qm
  7335. Quadratic mean
  7336. @item cm
  7337. Cubic mean
  7338. @item pm
  7339. Power mean
  7340. @item median
  7341. Median
  7342. @end table
  7343. @item bypass
  7344. Do not actually modify frame. Useful when one only wants metadata.
  7345. @end table
  7346. @section dejudder
  7347. Remove judder produced by partially interlaced telecined content.
  7348. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7349. source was partially telecined content then the output of @code{pullup,dejudder}
  7350. will have a variable frame rate. May change the recorded frame rate of the
  7351. container. Aside from that change, this filter will not affect constant frame
  7352. rate video.
  7353. The option available in this filter is:
  7354. @table @option
  7355. @item cycle
  7356. Specify the length of the window over which the judder repeats.
  7357. Accepts any integer greater than 1. Useful values are:
  7358. @table @samp
  7359. @item 4
  7360. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7361. @item 5
  7362. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7363. @item 20
  7364. If a mixture of the two.
  7365. @end table
  7366. The default is @samp{4}.
  7367. @end table
  7368. @section delogo
  7369. Suppress a TV station logo by a simple interpolation of the surrounding
  7370. pixels. Just set a rectangle covering the logo and watch it disappear
  7371. (and sometimes something even uglier appear - your mileage may vary).
  7372. It accepts the following parameters:
  7373. @table @option
  7374. @item x
  7375. @item y
  7376. Specify the top left corner coordinates of the logo. They must be
  7377. specified.
  7378. @item w
  7379. @item h
  7380. Specify the width and height of the logo to clear. They must be
  7381. specified.
  7382. @item band, t
  7383. Specify the thickness of the fuzzy edge of the rectangle (added to
  7384. @var{w} and @var{h}). The default value is 1. This option is
  7385. deprecated, setting higher values should no longer be necessary and
  7386. is not recommended.
  7387. @item show
  7388. When set to 1, a green rectangle is drawn on the screen to simplify
  7389. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7390. The default value is 0.
  7391. The rectangle is drawn on the outermost pixels which will be (partly)
  7392. replaced with interpolated values. The values of the next pixels
  7393. immediately outside this rectangle in each direction will be used to
  7394. compute the interpolated pixel values inside the rectangle.
  7395. @end table
  7396. @subsection Examples
  7397. @itemize
  7398. @item
  7399. Set a rectangle covering the area with top left corner coordinates 0,0
  7400. and size 100x77, and a band of size 10:
  7401. @example
  7402. delogo=x=0:y=0:w=100:h=77:band=10
  7403. @end example
  7404. @end itemize
  7405. @anchor{derain}
  7406. @section derain
  7407. Remove the rain in the input image/video by applying the derain methods based on
  7408. convolutional neural networks. Supported models:
  7409. @itemize
  7410. @item
  7411. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7412. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7413. @end itemize
  7414. Training as well as model generation scripts are provided in
  7415. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7416. Native model files (.model) can be generated from TensorFlow model
  7417. files (.pb) by using tools/python/convert.py
  7418. The filter accepts the following options:
  7419. @table @option
  7420. @item filter_type
  7421. Specify which filter to use. This option accepts the following values:
  7422. @table @samp
  7423. @item derain
  7424. Derain filter. To conduct derain filter, you need to use a derain model.
  7425. @item dehaze
  7426. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7427. @end table
  7428. Default value is @samp{derain}.
  7429. @item dnn_backend
  7430. Specify which DNN backend to use for model loading and execution. This option accepts
  7431. the following values:
  7432. @table @samp
  7433. @item native
  7434. Native implementation of DNN loading and execution.
  7435. @item tensorflow
  7436. TensorFlow backend. To enable this backend you
  7437. need to install the TensorFlow for C library (see
  7438. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7439. @code{--enable-libtensorflow}
  7440. @end table
  7441. Default value is @samp{native}.
  7442. @item model
  7443. Set path to model file specifying network architecture and its parameters.
  7444. Note that different backends use different file formats. TensorFlow and native
  7445. backend can load files for only its format.
  7446. @end table
  7447. It can also be finished with @ref{dnn_processing} filter.
  7448. @section deshake
  7449. Attempt to fix small changes in horizontal and/or vertical shift. This
  7450. filter helps remove camera shake from hand-holding a camera, bumping a
  7451. tripod, moving on a vehicle, etc.
  7452. The filter accepts the following options:
  7453. @table @option
  7454. @item x
  7455. @item y
  7456. @item w
  7457. @item h
  7458. Specify a rectangular area where to limit the search for motion
  7459. vectors.
  7460. If desired the search for motion vectors can be limited to a
  7461. rectangular area of the frame defined by its top left corner, width
  7462. and height. These parameters have the same meaning as the drawbox
  7463. filter which can be used to visualise the position of the bounding
  7464. box.
  7465. This is useful when simultaneous movement of subjects within the frame
  7466. might be confused for camera motion by the motion vector search.
  7467. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7468. then the full frame is used. This allows later options to be set
  7469. without specifying the bounding box for the motion vector search.
  7470. Default - search the whole frame.
  7471. @item rx
  7472. @item ry
  7473. Specify the maximum extent of movement in x and y directions in the
  7474. range 0-64 pixels. Default 16.
  7475. @item edge
  7476. Specify how to generate pixels to fill blanks at the edge of the
  7477. frame. Available values are:
  7478. @table @samp
  7479. @item blank, 0
  7480. Fill zeroes at blank locations
  7481. @item original, 1
  7482. Original image at blank locations
  7483. @item clamp, 2
  7484. Extruded edge value at blank locations
  7485. @item mirror, 3
  7486. Mirrored edge at blank locations
  7487. @end table
  7488. Default value is @samp{mirror}.
  7489. @item blocksize
  7490. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7491. default 8.
  7492. @item contrast
  7493. Specify the contrast threshold for blocks. Only blocks with more than
  7494. the specified contrast (difference between darkest and lightest
  7495. pixels) will be considered. Range 1-255, default 125.
  7496. @item search
  7497. Specify the search strategy. Available values are:
  7498. @table @samp
  7499. @item exhaustive, 0
  7500. Set exhaustive search
  7501. @item less, 1
  7502. Set less exhaustive search.
  7503. @end table
  7504. Default value is @samp{exhaustive}.
  7505. @item filename
  7506. If set then a detailed log of the motion search is written to the
  7507. specified file.
  7508. @end table
  7509. @section despill
  7510. Remove unwanted contamination of foreground colors, caused by reflected color of
  7511. greenscreen or bluescreen.
  7512. This filter accepts the following options:
  7513. @table @option
  7514. @item type
  7515. Set what type of despill to use.
  7516. @item mix
  7517. Set how spillmap will be generated.
  7518. @item expand
  7519. Set how much to get rid of still remaining spill.
  7520. @item red
  7521. Controls amount of red in spill area.
  7522. @item green
  7523. Controls amount of green in spill area.
  7524. Should be -1 for greenscreen.
  7525. @item blue
  7526. Controls amount of blue in spill area.
  7527. Should be -1 for bluescreen.
  7528. @item brightness
  7529. Controls brightness of spill area, preserving colors.
  7530. @item alpha
  7531. Modify alpha from generated spillmap.
  7532. @end table
  7533. @subsection Commands
  7534. This filter supports the all above options as @ref{commands}.
  7535. @section detelecine
  7536. Apply an exact inverse of the telecine operation. It requires a predefined
  7537. pattern specified using the pattern option which must be the same as that passed
  7538. to the telecine filter.
  7539. This filter accepts the following options:
  7540. @table @option
  7541. @item first_field
  7542. @table @samp
  7543. @item top, t
  7544. top field first
  7545. @item bottom, b
  7546. bottom field first
  7547. The default value is @code{top}.
  7548. @end table
  7549. @item pattern
  7550. A string of numbers representing the pulldown pattern you wish to apply.
  7551. The default value is @code{23}.
  7552. @item start_frame
  7553. A number representing position of the first frame with respect to the telecine
  7554. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7555. @end table
  7556. @section dilation
  7557. Apply dilation effect to the video.
  7558. This filter replaces the pixel by the local(3x3) maximum.
  7559. It accepts the following options:
  7560. @table @option
  7561. @item threshold0
  7562. @item threshold1
  7563. @item threshold2
  7564. @item threshold3
  7565. Limit the maximum change for each plane, default is 65535.
  7566. If 0, plane will remain unchanged.
  7567. @item coordinates
  7568. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7569. pixels are used.
  7570. Flags to local 3x3 coordinates maps like this:
  7571. 1 2 3
  7572. 4 5
  7573. 6 7 8
  7574. @end table
  7575. @subsection Commands
  7576. This filter supports the all above options as @ref{commands}.
  7577. @section displace
  7578. Displace pixels as indicated by second and third input stream.
  7579. It takes three input streams and outputs one stream, the first input is the
  7580. source, and second and third input are displacement maps.
  7581. The second input specifies how much to displace pixels along the
  7582. x-axis, while the third input specifies how much to displace pixels
  7583. along the y-axis.
  7584. If one of displacement map streams terminates, last frame from that
  7585. displacement map will be used.
  7586. Note that once generated, displacements maps can be reused over and over again.
  7587. A description of the accepted options follows.
  7588. @table @option
  7589. @item edge
  7590. Set displace behavior for pixels that are out of range.
  7591. Available values are:
  7592. @table @samp
  7593. @item blank
  7594. Missing pixels are replaced by black pixels.
  7595. @item smear
  7596. Adjacent pixels will spread out to replace missing pixels.
  7597. @item wrap
  7598. Out of range pixels are wrapped so they point to pixels of other side.
  7599. @item mirror
  7600. Out of range pixels will be replaced with mirrored pixels.
  7601. @end table
  7602. Default is @samp{smear}.
  7603. @end table
  7604. @subsection Examples
  7605. @itemize
  7606. @item
  7607. Add ripple effect to rgb input of video size hd720:
  7608. @example
  7609. 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
  7610. @end example
  7611. @item
  7612. Add wave effect to rgb input of video size hd720:
  7613. @example
  7614. 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
  7615. @end example
  7616. @end itemize
  7617. @anchor{dnn_processing}
  7618. @section dnn_processing
  7619. Do image processing with deep neural networks. It works together with another filter
  7620. which converts the pixel format of the Frame to what the dnn network requires.
  7621. The filter accepts the following options:
  7622. @table @option
  7623. @item dnn_backend
  7624. Specify which DNN backend to use for model loading and execution. This option accepts
  7625. the following values:
  7626. @table @samp
  7627. @item native
  7628. Native implementation of DNN loading and execution.
  7629. @item tensorflow
  7630. TensorFlow backend. To enable this backend you
  7631. need to install the TensorFlow for C library (see
  7632. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7633. @code{--enable-libtensorflow}
  7634. @item openvino
  7635. OpenVINO backend. To enable this backend you
  7636. need to build and install the OpenVINO for C library (see
  7637. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7638. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7639. be needed if the header files and libraries are not installed into system path)
  7640. @end table
  7641. Default value is @samp{native}.
  7642. @item model
  7643. Set path to model file specifying network architecture and its parameters.
  7644. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7645. backend can load files for only its format.
  7646. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7647. @item input
  7648. Set the input name of the dnn network.
  7649. @item output
  7650. Set the output name of the dnn network.
  7651. @item async
  7652. use DNN async execution if set (default: set),
  7653. roll back to sync execution if the backend does not support async.
  7654. @end table
  7655. @subsection Examples
  7656. @itemize
  7657. @item
  7658. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7659. @example
  7660. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7661. @end example
  7662. @item
  7663. Halve the pixel value of the frame with format gray32f:
  7664. @example
  7665. 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
  7666. @end example
  7667. @item
  7668. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7669. @example
  7670. ./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
  7671. @end example
  7672. @item
  7673. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7674. @example
  7675. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7676. @end example
  7677. @end itemize
  7678. @section drawbox
  7679. Draw a colored box on the input image.
  7680. It accepts the following parameters:
  7681. @table @option
  7682. @item x
  7683. @item y
  7684. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7685. @item width, w
  7686. @item height, h
  7687. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7688. the input width and height. It defaults to 0.
  7689. @item color, c
  7690. Specify the color of the box to write. For the general syntax of this option,
  7691. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7692. value @code{invert} is used, the box edge color is the same as the
  7693. video with inverted luma.
  7694. @item thickness, t
  7695. The expression which sets the thickness of the box edge.
  7696. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7697. See below for the list of accepted constants.
  7698. @item replace
  7699. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7700. will overwrite the video's color and alpha pixels.
  7701. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7702. @end table
  7703. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7704. following constants:
  7705. @table @option
  7706. @item dar
  7707. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7708. @item hsub
  7709. @item vsub
  7710. horizontal and vertical chroma subsample values. For example for the
  7711. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7712. @item in_h, ih
  7713. @item in_w, iw
  7714. The input width and height.
  7715. @item sar
  7716. The input sample aspect ratio.
  7717. @item x
  7718. @item y
  7719. The x and y offset coordinates where the box is drawn.
  7720. @item w
  7721. @item h
  7722. The width and height of the drawn box.
  7723. @item t
  7724. The thickness of the drawn box.
  7725. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7726. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7727. @end table
  7728. @subsection Examples
  7729. @itemize
  7730. @item
  7731. Draw a black box around the edge of the input image:
  7732. @example
  7733. drawbox
  7734. @end example
  7735. @item
  7736. Draw a box with color red and an opacity of 50%:
  7737. @example
  7738. drawbox=10:20:200:60:red@@0.5
  7739. @end example
  7740. The previous example can be specified as:
  7741. @example
  7742. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7743. @end example
  7744. @item
  7745. Fill the box with pink color:
  7746. @example
  7747. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7748. @end example
  7749. @item
  7750. Draw a 2-pixel red 2.40:1 mask:
  7751. @example
  7752. 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
  7753. @end example
  7754. @end itemize
  7755. @subsection Commands
  7756. This filter supports same commands as options.
  7757. The command accepts the same syntax of the corresponding option.
  7758. If the specified expression is not valid, it is kept at its current
  7759. value.
  7760. @anchor{drawgraph}
  7761. @section drawgraph
  7762. Draw a graph using input video metadata.
  7763. It accepts the following parameters:
  7764. @table @option
  7765. @item m1
  7766. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7767. @item fg1
  7768. Set 1st foreground color expression.
  7769. @item m2
  7770. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7771. @item fg2
  7772. Set 2nd foreground color expression.
  7773. @item m3
  7774. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7775. @item fg3
  7776. Set 3rd foreground color expression.
  7777. @item m4
  7778. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7779. @item fg4
  7780. Set 4th foreground color expression.
  7781. @item min
  7782. Set minimal value of metadata value.
  7783. @item max
  7784. Set maximal value of metadata value.
  7785. @item bg
  7786. Set graph background color. Default is white.
  7787. @item mode
  7788. Set graph mode.
  7789. Available values for mode is:
  7790. @table @samp
  7791. @item bar
  7792. @item dot
  7793. @item line
  7794. @end table
  7795. Default is @code{line}.
  7796. @item slide
  7797. Set slide mode.
  7798. Available values for slide is:
  7799. @table @samp
  7800. @item frame
  7801. Draw new frame when right border is reached.
  7802. @item replace
  7803. Replace old columns with new ones.
  7804. @item scroll
  7805. Scroll from right to left.
  7806. @item rscroll
  7807. Scroll from left to right.
  7808. @item picture
  7809. Draw single picture.
  7810. @end table
  7811. Default is @code{frame}.
  7812. @item size
  7813. Set size of graph video. For the syntax of this option, check the
  7814. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7815. The default value is @code{900x256}.
  7816. @item rate, r
  7817. Set the output frame rate. Default value is @code{25}.
  7818. The foreground color expressions can use the following variables:
  7819. @table @option
  7820. @item MIN
  7821. Minimal value of metadata value.
  7822. @item MAX
  7823. Maximal value of metadata value.
  7824. @item VAL
  7825. Current metadata key value.
  7826. @end table
  7827. The color is defined as 0xAABBGGRR.
  7828. @end table
  7829. Example using metadata from @ref{signalstats} filter:
  7830. @example
  7831. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7832. @end example
  7833. Example using metadata from @ref{ebur128} filter:
  7834. @example
  7835. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7836. @end example
  7837. @section drawgrid
  7838. Draw a grid on the input image.
  7839. It accepts the following parameters:
  7840. @table @option
  7841. @item x
  7842. @item y
  7843. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7844. @item width, w
  7845. @item height, h
  7846. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7847. input width and height, respectively, minus @code{thickness}, so image gets
  7848. framed. Default to 0.
  7849. @item color, c
  7850. Specify the color of the grid. For the general syntax of this option,
  7851. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7852. value @code{invert} is used, the grid color is the same as the
  7853. video with inverted luma.
  7854. @item thickness, t
  7855. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7856. See below for the list of accepted constants.
  7857. @item replace
  7858. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7859. will overwrite the video's color and alpha pixels.
  7860. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7861. @end table
  7862. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7863. following constants:
  7864. @table @option
  7865. @item dar
  7866. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7867. @item hsub
  7868. @item vsub
  7869. horizontal and vertical chroma subsample values. For example for the
  7870. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7871. @item in_h, ih
  7872. @item in_w, iw
  7873. The input grid cell width and height.
  7874. @item sar
  7875. The input sample aspect ratio.
  7876. @item x
  7877. @item y
  7878. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7879. @item w
  7880. @item h
  7881. The width and height of the drawn cell.
  7882. @item t
  7883. The thickness of the drawn cell.
  7884. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7885. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7886. @end table
  7887. @subsection Examples
  7888. @itemize
  7889. @item
  7890. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7891. @example
  7892. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7893. @end example
  7894. @item
  7895. Draw a white 3x3 grid with an opacity of 50%:
  7896. @example
  7897. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7898. @end example
  7899. @end itemize
  7900. @subsection Commands
  7901. This filter supports same commands as options.
  7902. The command accepts the same syntax of the corresponding option.
  7903. If the specified expression is not valid, it is kept at its current
  7904. value.
  7905. @anchor{drawtext}
  7906. @section drawtext
  7907. Draw a text string or text from a specified file on top of a video, using the
  7908. libfreetype library.
  7909. To enable compilation of this filter, you need to configure FFmpeg with
  7910. @code{--enable-libfreetype}.
  7911. To enable default font fallback and the @var{font} option you need to
  7912. configure FFmpeg with @code{--enable-libfontconfig}.
  7913. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7914. @code{--enable-libfribidi}.
  7915. @subsection Syntax
  7916. It accepts the following parameters:
  7917. @table @option
  7918. @item box
  7919. Used to draw a box around text using the background color.
  7920. The value must be either 1 (enable) or 0 (disable).
  7921. The default value of @var{box} is 0.
  7922. @item boxborderw
  7923. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7924. The default value of @var{boxborderw} is 0.
  7925. @item boxcolor
  7926. The color to be used for drawing box around text. For the syntax of this
  7927. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7928. The default value of @var{boxcolor} is "white".
  7929. @item line_spacing
  7930. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7931. The default value of @var{line_spacing} is 0.
  7932. @item borderw
  7933. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7934. The default value of @var{borderw} is 0.
  7935. @item bordercolor
  7936. Set the color to be used for drawing border around text. For the syntax of this
  7937. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7938. The default value of @var{bordercolor} is "black".
  7939. @item expansion
  7940. Select how the @var{text} is expanded. Can be either @code{none},
  7941. @code{strftime} (deprecated) or
  7942. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7943. below for details.
  7944. @item basetime
  7945. Set a start time for the count. Value is in microseconds. Only applied
  7946. in the deprecated strftime expansion mode. To emulate in normal expansion
  7947. mode use the @code{pts} function, supplying the start time (in seconds)
  7948. as the second argument.
  7949. @item fix_bounds
  7950. If true, check and fix text coords to avoid clipping.
  7951. @item fontcolor
  7952. The color to be used for drawing fonts. For the syntax of this option, check
  7953. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7954. The default value of @var{fontcolor} is "black".
  7955. @item fontcolor_expr
  7956. String which is expanded the same way as @var{text} to obtain dynamic
  7957. @var{fontcolor} value. By default this option has empty value and is not
  7958. processed. When this option is set, it overrides @var{fontcolor} option.
  7959. @item font
  7960. The font family to be used for drawing text. By default Sans.
  7961. @item fontfile
  7962. The font file to be used for drawing text. The path must be included.
  7963. This parameter is mandatory if the fontconfig support is disabled.
  7964. @item alpha
  7965. Draw the text applying alpha blending. The value can
  7966. be a number between 0.0 and 1.0.
  7967. The expression accepts the same variables @var{x, y} as well.
  7968. The default value is 1.
  7969. Please see @var{fontcolor_expr}.
  7970. @item fontsize
  7971. The font size to be used for drawing text.
  7972. The default value of @var{fontsize} is 16.
  7973. @item text_shaping
  7974. If set to 1, attempt to shape the text (for example, reverse the order of
  7975. right-to-left text and join Arabic characters) before drawing it.
  7976. Otherwise, just draw the text exactly as given.
  7977. By default 1 (if supported).
  7978. @item ft_load_flags
  7979. The flags to be used for loading the fonts.
  7980. The flags map the corresponding flags supported by libfreetype, and are
  7981. a combination of the following values:
  7982. @table @var
  7983. @item default
  7984. @item no_scale
  7985. @item no_hinting
  7986. @item render
  7987. @item no_bitmap
  7988. @item vertical_layout
  7989. @item force_autohint
  7990. @item crop_bitmap
  7991. @item pedantic
  7992. @item ignore_global_advance_width
  7993. @item no_recurse
  7994. @item ignore_transform
  7995. @item monochrome
  7996. @item linear_design
  7997. @item no_autohint
  7998. @end table
  7999. Default value is "default".
  8000. For more information consult the documentation for the FT_LOAD_*
  8001. libfreetype flags.
  8002. @item shadowcolor
  8003. The color to be used for drawing a shadow behind the drawn text. For the
  8004. syntax of this option, check the @ref{color syntax,,"Color" section in the
  8005. ffmpeg-utils manual,ffmpeg-utils}.
  8006. The default value of @var{shadowcolor} is "black".
  8007. @item shadowx
  8008. @item shadowy
  8009. The x and y offsets for the text shadow position with respect to the
  8010. position of the text. They can be either positive or negative
  8011. values. The default value for both is "0".
  8012. @item start_number
  8013. The starting frame number for the n/frame_num variable. The default value
  8014. is "0".
  8015. @item tabsize
  8016. The size in number of spaces to use for rendering the tab.
  8017. Default value is 4.
  8018. @item timecode
  8019. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  8020. format. It can be used with or without text parameter. @var{timecode_rate}
  8021. option must be specified.
  8022. @item timecode_rate, rate, r
  8023. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  8024. integer. Minimum value is "1".
  8025. Drop-frame timecode is supported for frame rates 30 & 60.
  8026. @item tc24hmax
  8027. If set to 1, the output of the timecode option will wrap around at 24 hours.
  8028. Default is 0 (disabled).
  8029. @item text
  8030. The text string to be drawn. The text must be a sequence of UTF-8
  8031. encoded characters.
  8032. This parameter is mandatory if no file is specified with the parameter
  8033. @var{textfile}.
  8034. @item textfile
  8035. A text file containing text to be drawn. The text must be a sequence
  8036. of UTF-8 encoded characters.
  8037. This parameter is mandatory if no text string is specified with the
  8038. parameter @var{text}.
  8039. If both @var{text} and @var{textfile} are specified, an error is thrown.
  8040. @item reload
  8041. If set to 1, the @var{textfile} will be reloaded before each frame.
  8042. Be sure to update it atomically, or it may be read partially, or even fail.
  8043. @item x
  8044. @item y
  8045. The expressions which specify the offsets where text will be drawn
  8046. within the video frame. They are relative to the top/left border of the
  8047. output image.
  8048. The default value of @var{x} and @var{y} is "0".
  8049. See below for the list of accepted constants and functions.
  8050. @end table
  8051. The parameters for @var{x} and @var{y} are expressions containing the
  8052. following constants and functions:
  8053. @table @option
  8054. @item dar
  8055. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  8056. @item hsub
  8057. @item vsub
  8058. horizontal and vertical chroma subsample values. For example for the
  8059. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8060. @item line_h, lh
  8061. the height of each text line
  8062. @item main_h, h, H
  8063. the input height
  8064. @item main_w, w, W
  8065. the input width
  8066. @item max_glyph_a, ascent
  8067. the maximum distance from the baseline to the highest/upper grid
  8068. coordinate used to place a glyph outline point, for all the rendered
  8069. glyphs.
  8070. It is a positive value, due to the grid's orientation with the Y axis
  8071. upwards.
  8072. @item max_glyph_d, descent
  8073. the maximum distance from the baseline to the lowest grid coordinate
  8074. used to place a glyph outline point, for all the rendered glyphs.
  8075. This is a negative value, due to the grid's orientation, with the Y axis
  8076. upwards.
  8077. @item max_glyph_h
  8078. maximum glyph height, that is the maximum height for all the glyphs
  8079. contained in the rendered text, it is equivalent to @var{ascent} -
  8080. @var{descent}.
  8081. @item max_glyph_w
  8082. maximum glyph width, that is the maximum width for all the glyphs
  8083. contained in the rendered text
  8084. @item n
  8085. the number of input frame, starting from 0
  8086. @item rand(min, max)
  8087. return a random number included between @var{min} and @var{max}
  8088. @item sar
  8089. The input sample aspect ratio.
  8090. @item t
  8091. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8092. @item text_h, th
  8093. the height of the rendered text
  8094. @item text_w, tw
  8095. the width of the rendered text
  8096. @item x
  8097. @item y
  8098. the x and y offset coordinates where the text is drawn.
  8099. These parameters allow the @var{x} and @var{y} expressions to refer
  8100. to each other, so you can for example specify @code{y=x/dar}.
  8101. @item pict_type
  8102. A one character description of the current frame's picture type.
  8103. @item pkt_pos
  8104. The current packet's position in the input file or stream
  8105. (in bytes, from the start of the input). A value of -1 indicates
  8106. this info is not available.
  8107. @item pkt_duration
  8108. The current packet's duration, in seconds.
  8109. @item pkt_size
  8110. The current packet's size (in bytes).
  8111. @end table
  8112. @anchor{drawtext_expansion}
  8113. @subsection Text expansion
  8114. If @option{expansion} is set to @code{strftime},
  8115. the filter recognizes strftime() sequences in the provided text and
  8116. expands them accordingly. Check the documentation of strftime(). This
  8117. feature is deprecated.
  8118. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  8119. If @option{expansion} is set to @code{normal} (which is the default),
  8120. the following expansion mechanism is used.
  8121. The backslash character @samp{\}, followed by any character, always expands to
  8122. the second character.
  8123. Sequences of the form @code{%@{...@}} are expanded. The text between the
  8124. braces is a function name, possibly followed by arguments separated by ':'.
  8125. If the arguments contain special characters or delimiters (':' or '@}'),
  8126. they should be escaped.
  8127. Note that they probably must also be escaped as the value for the
  8128. @option{text} option in the filter argument string and as the filter
  8129. argument in the filtergraph description, and possibly also for the shell,
  8130. that makes up to four levels of escaping; using a text file avoids these
  8131. problems.
  8132. The following functions are available:
  8133. @table @command
  8134. @item expr, e
  8135. The expression evaluation result.
  8136. It must take one argument specifying the expression to be evaluated,
  8137. which accepts the same constants and functions as the @var{x} and
  8138. @var{y} values. Note that not all constants should be used, for
  8139. example the text size is not known when evaluating the expression, so
  8140. the constants @var{text_w} and @var{text_h} will have an undefined
  8141. value.
  8142. @item expr_int_format, eif
  8143. Evaluate the expression's value and output as formatted integer.
  8144. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  8145. The second argument specifies the output format. Allowed values are @samp{x},
  8146. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  8147. @code{printf} function.
  8148. The third parameter is optional and sets the number of positions taken by the output.
  8149. It can be used to add padding with zeros from the left.
  8150. @item gmtime
  8151. The time at which the filter is running, expressed in UTC.
  8152. It can accept an argument: a strftime() format string.
  8153. @item localtime
  8154. The time at which the filter is running, expressed in the local time zone.
  8155. It can accept an argument: a strftime() format string.
  8156. @item metadata
  8157. Frame metadata. Takes one or two arguments.
  8158. The first argument is mandatory and specifies the metadata key.
  8159. The second argument is optional and specifies a default value, used when the
  8160. metadata key is not found or empty.
  8161. Available metadata can be identified by inspecting entries
  8162. starting with TAG included within each frame section
  8163. printed by running @code{ffprobe -show_frames}.
  8164. String metadata generated in filters leading to
  8165. the drawtext filter are also available.
  8166. @item n, frame_num
  8167. The frame number, starting from 0.
  8168. @item pict_type
  8169. A one character description of the current picture type.
  8170. @item pts
  8171. The timestamp of the current frame.
  8172. It can take up to three arguments.
  8173. The first argument is the format of the timestamp; it defaults to @code{flt}
  8174. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  8175. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  8176. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  8177. @code{localtime} stands for the timestamp of the frame formatted as
  8178. local time zone time.
  8179. The second argument is an offset added to the timestamp.
  8180. If the format is set to @code{hms}, a third argument @code{24HH} may be
  8181. supplied to present the hour part of the formatted timestamp in 24h format
  8182. (00-23).
  8183. If the format is set to @code{localtime} or @code{gmtime},
  8184. a third argument may be supplied: a strftime() format string.
  8185. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  8186. @end table
  8187. @subsection Commands
  8188. This filter supports altering parameters via commands:
  8189. @table @option
  8190. @item reinit
  8191. Alter existing filter parameters.
  8192. Syntax for the argument is the same as for filter invocation, e.g.
  8193. @example
  8194. fontsize=56:fontcolor=green:text='Hello World'
  8195. @end example
  8196. Full filter invocation with sendcmd would look like this:
  8197. @example
  8198. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  8199. @end example
  8200. @end table
  8201. If the entire argument can't be parsed or applied as valid values then the filter will
  8202. continue with its existing parameters.
  8203. @subsection Examples
  8204. @itemize
  8205. @item
  8206. Draw "Test Text" with font FreeSerif, using the default values for the
  8207. optional parameters.
  8208. @example
  8209. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  8210. @end example
  8211. @item
  8212. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  8213. and y=50 (counting from the top-left corner of the screen), text is
  8214. yellow with a red box around it. Both the text and the box have an
  8215. opacity of 20%.
  8216. @example
  8217. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  8218. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  8219. @end example
  8220. Note that the double quotes are not necessary if spaces are not used
  8221. within the parameter list.
  8222. @item
  8223. Show the text at the center of the video frame:
  8224. @example
  8225. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  8226. @end example
  8227. @item
  8228. Show the text at a random position, switching to a new position every 30 seconds:
  8229. @example
  8230. 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)"
  8231. @end example
  8232. @item
  8233. Show a text line sliding from right to left in the last row of the video
  8234. frame. The file @file{LONG_LINE} is assumed to contain a single line
  8235. with no newlines.
  8236. @example
  8237. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  8238. @end example
  8239. @item
  8240. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  8241. @example
  8242. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  8243. @end example
  8244. @item
  8245. Draw a single green letter "g", at the center of the input video.
  8246. The glyph baseline is placed at half screen height.
  8247. @example
  8248. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  8249. @end example
  8250. @item
  8251. Show text for 1 second every 3 seconds:
  8252. @example
  8253. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  8254. @end example
  8255. @item
  8256. Use fontconfig to set the font. Note that the colons need to be escaped.
  8257. @example
  8258. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  8259. @end example
  8260. @item
  8261. Draw "Test Text" with font size dependent on height of the video.
  8262. @example
  8263. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  8264. @end example
  8265. @item
  8266. Print the date of a real-time encoding (see strftime(3)):
  8267. @example
  8268. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  8269. @end example
  8270. @item
  8271. Show text fading in and out (appearing/disappearing):
  8272. @example
  8273. #!/bin/sh
  8274. DS=1.0 # display start
  8275. DE=10.0 # display end
  8276. FID=1.5 # fade in duration
  8277. FOD=5 # fade out duration
  8278. 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 @}"
  8279. @end example
  8280. @item
  8281. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  8282. and the @option{fontsize} value are included in the @option{y} offset.
  8283. @example
  8284. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  8285. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  8286. @end example
  8287. @item
  8288. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  8289. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  8290. must have option @option{-export_path_metadata 1} for the special metadata fields
  8291. to be available for filters.
  8292. @example
  8293. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  8294. @end example
  8295. @end itemize
  8296. For more information about libfreetype, check:
  8297. @url{http://www.freetype.org/}.
  8298. For more information about fontconfig, check:
  8299. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  8300. For more information about libfribidi, check:
  8301. @url{http://fribidi.org/}.
  8302. @section edgedetect
  8303. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  8304. The filter accepts the following options:
  8305. @table @option
  8306. @item low
  8307. @item high
  8308. Set low and high threshold values used by the Canny thresholding
  8309. algorithm.
  8310. The high threshold selects the "strong" edge pixels, which are then
  8311. connected through 8-connectivity with the "weak" edge pixels selected
  8312. by the low threshold.
  8313. @var{low} and @var{high} threshold values must be chosen in the range
  8314. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8315. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8316. is @code{50/255}.
  8317. @item mode
  8318. Define the drawing mode.
  8319. @table @samp
  8320. @item wires
  8321. Draw white/gray wires on black background.
  8322. @item colormix
  8323. Mix the colors to create a paint/cartoon effect.
  8324. @item canny
  8325. Apply Canny edge detector on all selected planes.
  8326. @end table
  8327. Default value is @var{wires}.
  8328. @item planes
  8329. Select planes for filtering. By default all available planes are filtered.
  8330. @end table
  8331. @subsection Examples
  8332. @itemize
  8333. @item
  8334. Standard edge detection with custom values for the hysteresis thresholding:
  8335. @example
  8336. edgedetect=low=0.1:high=0.4
  8337. @end example
  8338. @item
  8339. Painting effect without thresholding:
  8340. @example
  8341. edgedetect=mode=colormix:high=0
  8342. @end example
  8343. @end itemize
  8344. @section elbg
  8345. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8346. For each input image, the filter will compute the optimal mapping from
  8347. the input to the output given the codebook length, that is the number
  8348. of distinct output colors.
  8349. This filter accepts the following options.
  8350. @table @option
  8351. @item codebook_length, l
  8352. Set codebook length. The value must be a positive integer, and
  8353. represents the number of distinct output colors. Default value is 256.
  8354. @item nb_steps, n
  8355. Set the maximum number of iterations to apply for computing the optimal
  8356. mapping. The higher the value the better the result and the higher the
  8357. computation time. Default value is 1.
  8358. @item seed, s
  8359. Set a random seed, must be an integer included between 0 and
  8360. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8361. will try to use a good random seed on a best effort basis.
  8362. @item pal8
  8363. Set pal8 output pixel format. This option does not work with codebook
  8364. length greater than 256.
  8365. @end table
  8366. @section entropy
  8367. Measure graylevel entropy in histogram of color channels of video frames.
  8368. It accepts the following parameters:
  8369. @table @option
  8370. @item mode
  8371. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8372. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8373. between neighbour histogram values.
  8374. @end table
  8375. @section eq
  8376. Set brightness, contrast, saturation and approximate gamma adjustment.
  8377. The filter accepts the following options:
  8378. @table @option
  8379. @item contrast
  8380. Set the contrast expression. The value must be a float value in range
  8381. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8382. @item brightness
  8383. Set the brightness expression. The value must be a float value in
  8384. range @code{-1.0} to @code{1.0}. The default value is "0".
  8385. @item saturation
  8386. Set the saturation expression. The value must be a float in
  8387. range @code{0.0} to @code{3.0}. The default value is "1".
  8388. @item gamma
  8389. Set the gamma expression. The value must be a float in range
  8390. @code{0.1} to @code{10.0}. The default value is "1".
  8391. @item gamma_r
  8392. Set the gamma expression for red. The value must be a float in
  8393. range @code{0.1} to @code{10.0}. The default value is "1".
  8394. @item gamma_g
  8395. Set the gamma expression for green. The value must be a float in range
  8396. @code{0.1} to @code{10.0}. The default value is "1".
  8397. @item gamma_b
  8398. Set the gamma expression for blue. The value must be a float in range
  8399. @code{0.1} to @code{10.0}. The default value is "1".
  8400. @item gamma_weight
  8401. Set the gamma weight expression. It can be used to reduce the effect
  8402. of a high gamma value on bright image areas, e.g. keep them from
  8403. getting overamplified and just plain white. The value must be a float
  8404. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8405. gamma correction all the way down while @code{1.0} leaves it at its
  8406. full strength. Default is "1".
  8407. @item eval
  8408. Set when the expressions for brightness, contrast, saturation and
  8409. gamma expressions are evaluated.
  8410. It accepts the following values:
  8411. @table @samp
  8412. @item init
  8413. only evaluate expressions once during the filter initialization or
  8414. when a command is processed
  8415. @item frame
  8416. evaluate expressions for each incoming frame
  8417. @end table
  8418. Default value is @samp{init}.
  8419. @end table
  8420. The expressions accept the following parameters:
  8421. @table @option
  8422. @item n
  8423. frame count of the input frame starting from 0
  8424. @item pos
  8425. byte position of the corresponding packet in the input file, NAN if
  8426. unspecified
  8427. @item r
  8428. frame rate of the input video, NAN if the input frame rate is unknown
  8429. @item t
  8430. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8431. @end table
  8432. @subsection Commands
  8433. The filter supports the following commands:
  8434. @table @option
  8435. @item contrast
  8436. Set the contrast expression.
  8437. @item brightness
  8438. Set the brightness expression.
  8439. @item saturation
  8440. Set the saturation expression.
  8441. @item gamma
  8442. Set the gamma expression.
  8443. @item gamma_r
  8444. Set the gamma_r expression.
  8445. @item gamma_g
  8446. Set gamma_g expression.
  8447. @item gamma_b
  8448. Set gamma_b expression.
  8449. @item gamma_weight
  8450. Set gamma_weight expression.
  8451. The command accepts the same syntax of the corresponding option.
  8452. If the specified expression is not valid, it is kept at its current
  8453. value.
  8454. @end table
  8455. @section erosion
  8456. Apply erosion effect to the video.
  8457. This filter replaces the pixel by the local(3x3) minimum.
  8458. It accepts the following options:
  8459. @table @option
  8460. @item threshold0
  8461. @item threshold1
  8462. @item threshold2
  8463. @item threshold3
  8464. Limit the maximum change for each plane, default is 65535.
  8465. If 0, plane will remain unchanged.
  8466. @item coordinates
  8467. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8468. pixels are used.
  8469. Flags to local 3x3 coordinates maps like this:
  8470. 1 2 3
  8471. 4 5
  8472. 6 7 8
  8473. @end table
  8474. @subsection Commands
  8475. This filter supports the all above options as @ref{commands}.
  8476. @section extractplanes
  8477. Extract color channel components from input video stream into
  8478. separate grayscale video streams.
  8479. The filter accepts the following option:
  8480. @table @option
  8481. @item planes
  8482. Set plane(s) to extract.
  8483. Available values for planes are:
  8484. @table @samp
  8485. @item y
  8486. @item u
  8487. @item v
  8488. @item a
  8489. @item r
  8490. @item g
  8491. @item b
  8492. @end table
  8493. Choosing planes not available in the input will result in an error.
  8494. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8495. with @code{y}, @code{u}, @code{v} planes at same time.
  8496. @end table
  8497. @subsection Examples
  8498. @itemize
  8499. @item
  8500. Extract luma, u and v color channel component from input video frame
  8501. into 3 grayscale outputs:
  8502. @example
  8503. 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
  8504. @end example
  8505. @end itemize
  8506. @section fade
  8507. Apply a fade-in/out effect to the input video.
  8508. It accepts the following parameters:
  8509. @table @option
  8510. @item type, t
  8511. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8512. effect.
  8513. Default is @code{in}.
  8514. @item start_frame, s
  8515. Specify the number of the frame to start applying the fade
  8516. effect at. Default is 0.
  8517. @item nb_frames, n
  8518. The number of frames that the fade effect lasts. At the end of the
  8519. fade-in effect, the output video will have the same intensity as the input video.
  8520. At the end of the fade-out transition, the output video will be filled with the
  8521. selected @option{color}.
  8522. Default is 25.
  8523. @item alpha
  8524. If set to 1, fade only alpha channel, if one exists on the input.
  8525. Default value is 0.
  8526. @item start_time, st
  8527. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8528. effect. If both start_frame and start_time are specified, the fade will start at
  8529. whichever comes last. Default is 0.
  8530. @item duration, d
  8531. The number of seconds for which the fade effect has to last. At the end of the
  8532. fade-in effect the output video will have the same intensity as the input video,
  8533. at the end of the fade-out transition the output video will be filled with the
  8534. selected @option{color}.
  8535. If both duration and nb_frames are specified, duration is used. Default is 0
  8536. (nb_frames is used by default).
  8537. @item color, c
  8538. Specify the color of the fade. Default is "black".
  8539. @end table
  8540. @subsection Examples
  8541. @itemize
  8542. @item
  8543. Fade in the first 30 frames of video:
  8544. @example
  8545. fade=in:0:30
  8546. @end example
  8547. The command above is equivalent to:
  8548. @example
  8549. fade=t=in:s=0:n=30
  8550. @end example
  8551. @item
  8552. Fade out the last 45 frames of a 200-frame video:
  8553. @example
  8554. fade=out:155:45
  8555. fade=type=out:start_frame=155:nb_frames=45
  8556. @end example
  8557. @item
  8558. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8559. @example
  8560. fade=in:0:25, fade=out:975:25
  8561. @end example
  8562. @item
  8563. Make the first 5 frames yellow, then fade in from frame 5-24:
  8564. @example
  8565. fade=in:5:20:color=yellow
  8566. @end example
  8567. @item
  8568. Fade in alpha over first 25 frames of video:
  8569. @example
  8570. fade=in:0:25:alpha=1
  8571. @end example
  8572. @item
  8573. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8574. @example
  8575. fade=t=in:st=5.5:d=0.5
  8576. @end example
  8577. @end itemize
  8578. @section fftdnoiz
  8579. Denoise frames using 3D FFT (frequency domain filtering).
  8580. The filter accepts the following options:
  8581. @table @option
  8582. @item sigma
  8583. Set the noise sigma constant. This sets denoising strength.
  8584. Default value is 1. Allowed range is from 0 to 30.
  8585. Using very high sigma with low overlap may give blocking artifacts.
  8586. @item amount
  8587. Set amount of denoising. By default all detected noise is reduced.
  8588. Default value is 1. Allowed range is from 0 to 1.
  8589. @item block
  8590. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8591. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8592. block size in pixels is 2^4 which is 16.
  8593. @item overlap
  8594. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8595. @item prev
  8596. Set number of previous frames to use for denoising. By default is set to 0.
  8597. @item next
  8598. Set number of next frames to to use for denoising. By default is set to 0.
  8599. @item planes
  8600. Set planes which will be filtered, by default are all available filtered
  8601. except alpha.
  8602. @end table
  8603. @section fftfilt
  8604. Apply arbitrary expressions to samples in frequency domain
  8605. @table @option
  8606. @item dc_Y
  8607. Adjust the dc value (gain) of the luma plane of the image. The filter
  8608. accepts an integer value in range @code{0} to @code{1000}. The default
  8609. value is set to @code{0}.
  8610. @item dc_U
  8611. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8612. filter accepts an integer value in range @code{0} to @code{1000}. The
  8613. default value is set to @code{0}.
  8614. @item dc_V
  8615. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8616. filter accepts an integer value in range @code{0} to @code{1000}. The
  8617. default value is set to @code{0}.
  8618. @item weight_Y
  8619. Set the frequency domain weight expression for the luma plane.
  8620. @item weight_U
  8621. Set the frequency domain weight expression for the 1st chroma plane.
  8622. @item weight_V
  8623. Set the frequency domain weight expression for the 2nd chroma plane.
  8624. @item eval
  8625. Set when the expressions are evaluated.
  8626. It accepts the following values:
  8627. @table @samp
  8628. @item init
  8629. Only evaluate expressions once during the filter initialization.
  8630. @item frame
  8631. Evaluate expressions for each incoming frame.
  8632. @end table
  8633. Default value is @samp{init}.
  8634. The filter accepts the following variables:
  8635. @item X
  8636. @item Y
  8637. The coordinates of the current sample.
  8638. @item W
  8639. @item H
  8640. The width and height of the image.
  8641. @item N
  8642. The number of input frame, starting from 0.
  8643. @end table
  8644. @subsection Examples
  8645. @itemize
  8646. @item
  8647. High-pass:
  8648. @example
  8649. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8650. @end example
  8651. @item
  8652. Low-pass:
  8653. @example
  8654. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8655. @end example
  8656. @item
  8657. Sharpen:
  8658. @example
  8659. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8660. @end example
  8661. @item
  8662. Blur:
  8663. @example
  8664. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8665. @end example
  8666. @end itemize
  8667. @section field
  8668. Extract a single field from an interlaced image using stride
  8669. arithmetic to avoid wasting CPU time. The output frames are marked as
  8670. non-interlaced.
  8671. The filter accepts the following options:
  8672. @table @option
  8673. @item type
  8674. Specify whether to extract the top (if the value is @code{0} or
  8675. @code{top}) or the bottom field (if the value is @code{1} or
  8676. @code{bottom}).
  8677. @end table
  8678. @section fieldhint
  8679. Create new frames by copying the top and bottom fields from surrounding frames
  8680. supplied as numbers by the hint file.
  8681. @table @option
  8682. @item hint
  8683. Set file containing hints: absolute/relative frame numbers.
  8684. There must be one line for each frame in a clip. Each line must contain two
  8685. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8686. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8687. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8688. for @code{relative} mode. First number tells from which frame to pick up top
  8689. field and second number tells from which frame to pick up bottom field.
  8690. If optionally followed by @code{+} output frame will be marked as interlaced,
  8691. else if followed by @code{-} output frame will be marked as progressive, else
  8692. it will be marked same as input frame.
  8693. If optionally followed by @code{t} output frame will use only top field, or in
  8694. case of @code{b} it will use only bottom field.
  8695. If line starts with @code{#} or @code{;} that line is skipped.
  8696. @item mode
  8697. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8698. @end table
  8699. Example of first several lines of @code{hint} file for @code{relative} mode:
  8700. @example
  8701. 0,0 - # first frame
  8702. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8703. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8704. 1,0 -
  8705. 0,0 -
  8706. 0,0 -
  8707. 1,0 -
  8708. 1,0 -
  8709. 1,0 -
  8710. 0,0 -
  8711. 0,0 -
  8712. 1,0 -
  8713. 1,0 -
  8714. 1,0 -
  8715. 0,0 -
  8716. @end example
  8717. @section fieldmatch
  8718. Field matching filter for inverse telecine. It is meant to reconstruct the
  8719. progressive frames from a telecined stream. The filter does not drop duplicated
  8720. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8721. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8722. The separation of the field matching and the decimation is notably motivated by
  8723. the possibility of inserting a de-interlacing filter fallback between the two.
  8724. If the source has mixed telecined and real interlaced content,
  8725. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8726. But these remaining combed frames will be marked as interlaced, and thus can be
  8727. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8728. In addition to the various configuration options, @code{fieldmatch} can take an
  8729. optional second stream, activated through the @option{ppsrc} option. If
  8730. enabled, the frames reconstruction will be based on the fields and frames from
  8731. this second stream. This allows the first input to be pre-processed in order to
  8732. help the various algorithms of the filter, while keeping the output lossless
  8733. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8734. or brightness/contrast adjustments can help.
  8735. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8736. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8737. which @code{fieldmatch} is based on. While the semantic and usage are very
  8738. close, some behaviour and options names can differ.
  8739. The @ref{decimate} filter currently only works for constant frame rate input.
  8740. If your input has mixed telecined (30fps) and progressive content with a lower
  8741. framerate like 24fps use the following filterchain to produce the necessary cfr
  8742. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8743. The filter accepts the following options:
  8744. @table @option
  8745. @item order
  8746. Specify the assumed field order of the input stream. Available values are:
  8747. @table @samp
  8748. @item auto
  8749. Auto detect parity (use FFmpeg's internal parity value).
  8750. @item bff
  8751. Assume bottom field first.
  8752. @item tff
  8753. Assume top field first.
  8754. @end table
  8755. Note that it is sometimes recommended not to trust the parity announced by the
  8756. stream.
  8757. Default value is @var{auto}.
  8758. @item mode
  8759. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8760. sense that it won't risk creating jerkiness due to duplicate frames when
  8761. possible, but if there are bad edits or blended fields it will end up
  8762. outputting combed frames when a good match might actually exist. On the other
  8763. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8764. but will almost always find a good frame if there is one. The other values are
  8765. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8766. jerkiness and creating duplicate frames versus finding good matches in sections
  8767. with bad edits, orphaned fields, blended fields, etc.
  8768. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8769. Available values are:
  8770. @table @samp
  8771. @item pc
  8772. 2-way matching (p/c)
  8773. @item pc_n
  8774. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8775. @item pc_u
  8776. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8777. @item pc_n_ub
  8778. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8779. still combed (p/c + n + u/b)
  8780. @item pcn
  8781. 3-way matching (p/c/n)
  8782. @item pcn_ub
  8783. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8784. detected as combed (p/c/n + u/b)
  8785. @end table
  8786. The parenthesis at the end indicate the matches that would be used for that
  8787. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8788. @var{top}).
  8789. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8790. the slowest.
  8791. Default value is @var{pc_n}.
  8792. @item ppsrc
  8793. Mark the main input stream as a pre-processed input, and enable the secondary
  8794. input stream as the clean source to pick the fields from. See the filter
  8795. introduction for more details. It is similar to the @option{clip2} feature from
  8796. VFM/TFM.
  8797. Default value is @code{0} (disabled).
  8798. @item field
  8799. Set the field to match from. It is recommended to set this to the same value as
  8800. @option{order} unless you experience matching failures with that setting. In
  8801. certain circumstances changing the field that is used to match from can have a
  8802. large impact on matching performance. Available values are:
  8803. @table @samp
  8804. @item auto
  8805. Automatic (same value as @option{order}).
  8806. @item bottom
  8807. Match from the bottom field.
  8808. @item top
  8809. Match from the top field.
  8810. @end table
  8811. Default value is @var{auto}.
  8812. @item mchroma
  8813. Set whether or not chroma is included during the match comparisons. In most
  8814. cases it is recommended to leave this enabled. You should set this to @code{0}
  8815. only if your clip has bad chroma problems such as heavy rainbowing or other
  8816. artifacts. Setting this to @code{0} could also be used to speed things up at
  8817. the cost of some accuracy.
  8818. Default value is @code{1}.
  8819. @item y0
  8820. @item y1
  8821. These define an exclusion band which excludes the lines between @option{y0} and
  8822. @option{y1} from being included in the field matching decision. An exclusion
  8823. band can be used to ignore subtitles, a logo, or other things that may
  8824. interfere with the matching. @option{y0} sets the starting scan line and
  8825. @option{y1} sets the ending line; all lines in between @option{y0} and
  8826. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8827. @option{y0} and @option{y1} to the same value will disable the feature.
  8828. @option{y0} and @option{y1} defaults to @code{0}.
  8829. @item scthresh
  8830. Set the scene change detection threshold as a percentage of maximum change on
  8831. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8832. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8833. @option{scthresh} is @code{[0.0, 100.0]}.
  8834. Default value is @code{12.0}.
  8835. @item combmatch
  8836. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8837. account the combed scores of matches when deciding what match to use as the
  8838. final match. Available values are:
  8839. @table @samp
  8840. @item none
  8841. No final matching based on combed scores.
  8842. @item sc
  8843. Combed scores are only used when a scene change is detected.
  8844. @item full
  8845. Use combed scores all the time.
  8846. @end table
  8847. Default is @var{sc}.
  8848. @item combdbg
  8849. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8850. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8851. Available values are:
  8852. @table @samp
  8853. @item none
  8854. No forced calculation.
  8855. @item pcn
  8856. Force p/c/n calculations.
  8857. @item pcnub
  8858. Force p/c/n/u/b calculations.
  8859. @end table
  8860. Default value is @var{none}.
  8861. @item cthresh
  8862. This is the area combing threshold used for combed frame detection. This
  8863. essentially controls how "strong" or "visible" combing must be to be detected.
  8864. Larger values mean combing must be more visible and smaller values mean combing
  8865. can be less visible or strong and still be detected. Valid settings are from
  8866. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8867. be detected as combed). This is basically a pixel difference value. A good
  8868. range is @code{[8, 12]}.
  8869. Default value is @code{9}.
  8870. @item chroma
  8871. Sets whether or not chroma is considered in the combed frame decision. Only
  8872. disable this if your source has chroma problems (rainbowing, etc.) that are
  8873. causing problems for the combed frame detection with chroma enabled. Actually,
  8874. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8875. where there is chroma only combing in the source.
  8876. Default value is @code{0}.
  8877. @item blockx
  8878. @item blocky
  8879. Respectively set the x-axis and y-axis size of the window used during combed
  8880. frame detection. This has to do with the size of the area in which
  8881. @option{combpel} pixels are required to be detected as combed for a frame to be
  8882. declared combed. See the @option{combpel} parameter description for more info.
  8883. Possible values are any number that is a power of 2 starting at 4 and going up
  8884. to 512.
  8885. Default value is @code{16}.
  8886. @item combpel
  8887. The number of combed pixels inside any of the @option{blocky} by
  8888. @option{blockx} size blocks on the frame for the frame to be detected as
  8889. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8890. setting controls "how much" combing there must be in any localized area (a
  8891. window defined by the @option{blockx} and @option{blocky} settings) on the
  8892. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8893. which point no frames will ever be detected as combed). This setting is known
  8894. as @option{MI} in TFM/VFM vocabulary.
  8895. Default value is @code{80}.
  8896. @end table
  8897. @anchor{p/c/n/u/b meaning}
  8898. @subsection p/c/n/u/b meaning
  8899. @subsubsection p/c/n
  8900. We assume the following telecined stream:
  8901. @example
  8902. Top fields: 1 2 2 3 4
  8903. Bottom fields: 1 2 3 4 4
  8904. @end example
  8905. The numbers correspond to the progressive frame the fields relate to. Here, the
  8906. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8907. When @code{fieldmatch} is configured to run a matching from bottom
  8908. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8909. @example
  8910. Input stream:
  8911. T 1 2 2 3 4
  8912. B 1 2 3 4 4 <-- matching reference
  8913. Matches: c c n n c
  8914. Output stream:
  8915. T 1 2 3 4 4
  8916. B 1 2 3 4 4
  8917. @end example
  8918. As a result of the field matching, we can see that some frames get duplicated.
  8919. To perform a complete inverse telecine, you need to rely on a decimation filter
  8920. after this operation. See for instance the @ref{decimate} filter.
  8921. The same operation now matching from top fields (@option{field}=@var{top})
  8922. looks like this:
  8923. @example
  8924. Input stream:
  8925. T 1 2 2 3 4 <-- matching reference
  8926. B 1 2 3 4 4
  8927. Matches: c c p p c
  8928. Output stream:
  8929. T 1 2 2 3 4
  8930. B 1 2 2 3 4
  8931. @end example
  8932. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8933. basically, they refer to the frame and field of the opposite parity:
  8934. @itemize
  8935. @item @var{p} matches the field of the opposite parity in the previous frame
  8936. @item @var{c} matches the field of the opposite parity in the current frame
  8937. @item @var{n} matches the field of the opposite parity in the next frame
  8938. @end itemize
  8939. @subsubsection u/b
  8940. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8941. from the opposite parity flag. In the following examples, we assume that we are
  8942. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8943. 'x' is placed above and below each matched fields.
  8944. With bottom matching (@option{field}=@var{bottom}):
  8945. @example
  8946. Match: c p n b u
  8947. x x x x x
  8948. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8949. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8950. x x x x x
  8951. Output frames:
  8952. 2 1 2 2 2
  8953. 2 2 2 1 3
  8954. @end example
  8955. With top matching (@option{field}=@var{top}):
  8956. @example
  8957. Match: c p n b u
  8958. x x x x x
  8959. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8960. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8961. x x x x x
  8962. Output frames:
  8963. 2 2 2 1 2
  8964. 2 1 3 2 2
  8965. @end example
  8966. @subsection Examples
  8967. Simple IVTC of a top field first telecined stream:
  8968. @example
  8969. fieldmatch=order=tff:combmatch=none, decimate
  8970. @end example
  8971. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8972. @example
  8973. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8974. @end example
  8975. @section fieldorder
  8976. Transform the field order of the input video.
  8977. It accepts the following parameters:
  8978. @table @option
  8979. @item order
  8980. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8981. for bottom field first.
  8982. @end table
  8983. The default value is @samp{tff}.
  8984. The transformation is done by shifting the picture content up or down
  8985. by one line, and filling the remaining line with appropriate picture content.
  8986. This method is consistent with most broadcast field order converters.
  8987. If the input video is not flagged as being interlaced, or it is already
  8988. flagged as being of the required output field order, then this filter does
  8989. not alter the incoming video.
  8990. It is very useful when converting to or from PAL DV material,
  8991. which is bottom field first.
  8992. For example:
  8993. @example
  8994. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8995. @end example
  8996. @section fifo, afifo
  8997. Buffer input images and send them when they are requested.
  8998. It is mainly useful when auto-inserted by the libavfilter
  8999. framework.
  9000. It does not take parameters.
  9001. @section fillborders
  9002. Fill borders of the input video, without changing video stream dimensions.
  9003. Sometimes video can have garbage at the four edges and you may not want to
  9004. crop video input to keep size multiple of some number.
  9005. This filter accepts the following options:
  9006. @table @option
  9007. @item left
  9008. Number of pixels to fill from left border.
  9009. @item right
  9010. Number of pixels to fill from right border.
  9011. @item top
  9012. Number of pixels to fill from top border.
  9013. @item bottom
  9014. Number of pixels to fill from bottom border.
  9015. @item mode
  9016. Set fill mode.
  9017. It accepts the following values:
  9018. @table @samp
  9019. @item smear
  9020. fill pixels using outermost pixels
  9021. @item mirror
  9022. fill pixels using mirroring (half sample symmetric)
  9023. @item fixed
  9024. fill pixels with constant value
  9025. @item reflect
  9026. fill pixels using reflecting (whole sample symmetric)
  9027. @item wrap
  9028. fill pixels using wrapping
  9029. @item fade
  9030. fade pixels to constant value
  9031. @end table
  9032. Default is @var{smear}.
  9033. @item color
  9034. Set color for pixels in fixed or fade mode. Default is @var{black}.
  9035. @end table
  9036. @subsection Commands
  9037. This filter supports same @ref{commands} as options.
  9038. The command accepts the same syntax of the corresponding option.
  9039. If the specified expression is not valid, it is kept at its current
  9040. value.
  9041. @section find_rect
  9042. Find a rectangular object
  9043. It accepts the following options:
  9044. @table @option
  9045. @item object
  9046. Filepath of the object image, needs to be in gray8.
  9047. @item threshold
  9048. Detection threshold, default is 0.5.
  9049. @item mipmaps
  9050. Number of mipmaps, default is 3.
  9051. @item xmin, ymin, xmax, ymax
  9052. Specifies the rectangle in which to search.
  9053. @end table
  9054. @subsection Examples
  9055. @itemize
  9056. @item
  9057. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  9058. @example
  9059. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  9060. @end example
  9061. @end itemize
  9062. @section floodfill
  9063. Flood area with values of same pixel components with another values.
  9064. It accepts the following options:
  9065. @table @option
  9066. @item x
  9067. Set pixel x coordinate.
  9068. @item y
  9069. Set pixel y coordinate.
  9070. @item s0
  9071. Set source #0 component value.
  9072. @item s1
  9073. Set source #1 component value.
  9074. @item s2
  9075. Set source #2 component value.
  9076. @item s3
  9077. Set source #3 component value.
  9078. @item d0
  9079. Set destination #0 component value.
  9080. @item d1
  9081. Set destination #1 component value.
  9082. @item d2
  9083. Set destination #2 component value.
  9084. @item d3
  9085. Set destination #3 component value.
  9086. @end table
  9087. @anchor{format}
  9088. @section format
  9089. Convert the input video to one of the specified pixel formats.
  9090. Libavfilter will try to pick one that is suitable as input to
  9091. the next filter.
  9092. It accepts the following parameters:
  9093. @table @option
  9094. @item pix_fmts
  9095. A '|'-separated list of pixel format names, such as
  9096. "pix_fmts=yuv420p|monow|rgb24".
  9097. @end table
  9098. @subsection Examples
  9099. @itemize
  9100. @item
  9101. Convert the input video to the @var{yuv420p} format
  9102. @example
  9103. format=pix_fmts=yuv420p
  9104. @end example
  9105. Convert the input video to any of the formats in the list
  9106. @example
  9107. format=pix_fmts=yuv420p|yuv444p|yuv410p
  9108. @end example
  9109. @end itemize
  9110. @anchor{fps}
  9111. @section fps
  9112. Convert the video to specified constant frame rate by duplicating or dropping
  9113. frames as necessary.
  9114. It accepts the following parameters:
  9115. @table @option
  9116. @item fps
  9117. The desired output frame rate. The default is @code{25}.
  9118. @item start_time
  9119. Assume the first PTS should be the given value, in seconds. This allows for
  9120. padding/trimming at the start of stream. By default, no assumption is made
  9121. about the first frame's expected PTS, so no padding or trimming is done.
  9122. For example, this could be set to 0 to pad the beginning with duplicates of
  9123. the first frame if a video stream starts after the audio stream or to trim any
  9124. frames with a negative PTS.
  9125. @item round
  9126. Timestamp (PTS) rounding method.
  9127. Possible values are:
  9128. @table @option
  9129. @item zero
  9130. round towards 0
  9131. @item inf
  9132. round away from 0
  9133. @item down
  9134. round towards -infinity
  9135. @item up
  9136. round towards +infinity
  9137. @item near
  9138. round to nearest
  9139. @end table
  9140. The default is @code{near}.
  9141. @item eof_action
  9142. Action performed when reading the last frame.
  9143. Possible values are:
  9144. @table @option
  9145. @item round
  9146. Use same timestamp rounding method as used for other frames.
  9147. @item pass
  9148. Pass through last frame if input duration has not been reached yet.
  9149. @end table
  9150. The default is @code{round}.
  9151. @end table
  9152. Alternatively, the options can be specified as a flat string:
  9153. @var{fps}[:@var{start_time}[:@var{round}]].
  9154. See also the @ref{setpts} filter.
  9155. @subsection Examples
  9156. @itemize
  9157. @item
  9158. A typical usage in order to set the fps to 25:
  9159. @example
  9160. fps=fps=25
  9161. @end example
  9162. @item
  9163. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  9164. @example
  9165. fps=fps=film:round=near
  9166. @end example
  9167. @end itemize
  9168. @section framepack
  9169. Pack two different video streams into a stereoscopic video, setting proper
  9170. metadata on supported codecs. The two views should have the same size and
  9171. framerate and processing will stop when the shorter video ends. Please note
  9172. that you may conveniently adjust view properties with the @ref{scale} and
  9173. @ref{fps} filters.
  9174. It accepts the following parameters:
  9175. @table @option
  9176. @item format
  9177. The desired packing format. Supported values are:
  9178. @table @option
  9179. @item sbs
  9180. The views are next to each other (default).
  9181. @item tab
  9182. The views are on top of each other.
  9183. @item lines
  9184. The views are packed by line.
  9185. @item columns
  9186. The views are packed by column.
  9187. @item frameseq
  9188. The views are temporally interleaved.
  9189. @end table
  9190. @end table
  9191. Some examples:
  9192. @example
  9193. # Convert left and right views into a frame-sequential video
  9194. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  9195. # Convert views into a side-by-side video with the same output resolution as the input
  9196. 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
  9197. @end example
  9198. @section framerate
  9199. Change the frame rate by interpolating new video output frames from the source
  9200. frames.
  9201. This filter is not designed to function correctly with interlaced media. If
  9202. you wish to change the frame rate of interlaced media then you are required
  9203. to deinterlace before this filter and re-interlace after this filter.
  9204. A description of the accepted options follows.
  9205. @table @option
  9206. @item fps
  9207. Specify the output frames per second. This option can also be specified
  9208. as a value alone. The default is @code{50}.
  9209. @item interp_start
  9210. Specify the start of a range where the output frame will be created as a
  9211. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9212. the default is @code{15}.
  9213. @item interp_end
  9214. Specify the end of a range where the output frame will be created as a
  9215. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9216. the default is @code{240}.
  9217. @item scene
  9218. Specify the level at which a scene change is detected as a value between
  9219. 0 and 100 to indicate a new scene; a low value reflects a low
  9220. probability for the current frame to introduce a new scene, while a higher
  9221. value means the current frame is more likely to be one.
  9222. The default is @code{8.2}.
  9223. @item flags
  9224. Specify flags influencing the filter process.
  9225. Available value for @var{flags} is:
  9226. @table @option
  9227. @item scene_change_detect, scd
  9228. Enable scene change detection using the value of the option @var{scene}.
  9229. This flag is enabled by default.
  9230. @end table
  9231. @end table
  9232. @section framestep
  9233. Select one frame every N-th frame.
  9234. This filter accepts the following option:
  9235. @table @option
  9236. @item step
  9237. Select frame after every @code{step} frames.
  9238. Allowed values are positive integers higher than 0. Default value is @code{1}.
  9239. @end table
  9240. @section freezedetect
  9241. Detect frozen video.
  9242. This filter logs a message and sets frame metadata when it detects that the
  9243. input video has no significant change in content during a specified duration.
  9244. Video freeze detection calculates the mean average absolute difference of all
  9245. the components of video frames and compares it to a noise floor.
  9246. The printed times and duration are expressed in seconds. The
  9247. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  9248. whose timestamp equals or exceeds the detection duration and it contains the
  9249. timestamp of the first frame of the freeze. The
  9250. @code{lavfi.freezedetect.freeze_duration} and
  9251. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  9252. after the freeze.
  9253. The filter accepts the following options:
  9254. @table @option
  9255. @item noise, n
  9256. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  9257. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  9258. 0.001.
  9259. @item duration, d
  9260. Set freeze duration until notification (default is 2 seconds).
  9261. @end table
  9262. @section freezeframes
  9263. Freeze video frames.
  9264. This filter freezes video frames using frame from 2nd input.
  9265. The filter accepts the following options:
  9266. @table @option
  9267. @item first
  9268. Set number of first frame from which to start freeze.
  9269. @item last
  9270. Set number of last frame from which to end freeze.
  9271. @item replace
  9272. Set number of frame from 2nd input which will be used instead of replaced frames.
  9273. @end table
  9274. @anchor{frei0r}
  9275. @section frei0r
  9276. Apply a frei0r effect to the input video.
  9277. To enable the compilation of this filter, you need to install the frei0r
  9278. header and configure FFmpeg with @code{--enable-frei0r}.
  9279. It accepts the following parameters:
  9280. @table @option
  9281. @item filter_name
  9282. The name of the frei0r effect to load. If the environment variable
  9283. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  9284. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  9285. Otherwise, the standard frei0r paths are searched, in this order:
  9286. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  9287. @file{/usr/lib/frei0r-1/}.
  9288. @item filter_params
  9289. A '|'-separated list of parameters to pass to the frei0r effect.
  9290. @end table
  9291. A frei0r effect parameter can be a boolean (its value is either
  9292. "y" or "n"), a double, a color (specified as
  9293. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  9294. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  9295. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  9296. a position (specified as @var{X}/@var{Y}, where
  9297. @var{X} and @var{Y} are floating point numbers) and/or a string.
  9298. The number and types of parameters depend on the loaded effect. If an
  9299. effect parameter is not specified, the default value is set.
  9300. @subsection Examples
  9301. @itemize
  9302. @item
  9303. Apply the distort0r effect, setting the first two double parameters:
  9304. @example
  9305. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  9306. @end example
  9307. @item
  9308. Apply the colordistance effect, taking a color as the first parameter:
  9309. @example
  9310. frei0r=colordistance:0.2/0.3/0.4
  9311. frei0r=colordistance:violet
  9312. frei0r=colordistance:0x112233
  9313. @end example
  9314. @item
  9315. Apply the perspective effect, specifying the top left and top right image
  9316. positions:
  9317. @example
  9318. frei0r=perspective:0.2/0.2|0.8/0.2
  9319. @end example
  9320. @end itemize
  9321. For more information, see
  9322. @url{http://frei0r.dyne.org}
  9323. @subsection Commands
  9324. This filter supports the @option{filter_params} option as @ref{commands}.
  9325. @section fspp
  9326. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  9327. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  9328. processing filter, one of them is performed once per block, not per pixel.
  9329. This allows for much higher speed.
  9330. The filter accepts the following options:
  9331. @table @option
  9332. @item quality
  9333. Set quality. This option defines the number of levels for averaging. It accepts
  9334. an integer in the range 4-5. Default value is @code{4}.
  9335. @item qp
  9336. Force a constant quantization parameter. It accepts an integer in range 0-63.
  9337. If not set, the filter will use the QP from the video stream (if available).
  9338. @item strength
  9339. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  9340. more details but also more artifacts, while higher values make the image smoother
  9341. but also blurrier. Default value is @code{0} − PSNR optimal.
  9342. @item use_bframe_qp
  9343. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9344. option may cause flicker since the B-Frames have often larger QP. Default is
  9345. @code{0} (not enabled).
  9346. @end table
  9347. @section gblur
  9348. Apply Gaussian blur filter.
  9349. The filter accepts the following options:
  9350. @table @option
  9351. @item sigma
  9352. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  9353. @item steps
  9354. Set number of steps for Gaussian approximation. Default is @code{1}.
  9355. @item planes
  9356. Set which planes to filter. By default all planes are filtered.
  9357. @item sigmaV
  9358. Set vertical sigma, if negative it will be same as @code{sigma}.
  9359. Default is @code{-1}.
  9360. @end table
  9361. @subsection Commands
  9362. This filter supports same commands as options.
  9363. The command accepts the same syntax of the corresponding option.
  9364. If the specified expression is not valid, it is kept at its current
  9365. value.
  9366. @section geq
  9367. Apply generic equation to each pixel.
  9368. The filter accepts the following options:
  9369. @table @option
  9370. @item lum_expr, lum
  9371. Set the luminance expression.
  9372. @item cb_expr, cb
  9373. Set the chrominance blue expression.
  9374. @item cr_expr, cr
  9375. Set the chrominance red expression.
  9376. @item alpha_expr, a
  9377. Set the alpha expression.
  9378. @item red_expr, r
  9379. Set the red expression.
  9380. @item green_expr, g
  9381. Set the green expression.
  9382. @item blue_expr, b
  9383. Set the blue expression.
  9384. @end table
  9385. The colorspace is selected according to the specified options. If one
  9386. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9387. options is specified, the filter will automatically select a YCbCr
  9388. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9389. @option{blue_expr} options is specified, it will select an RGB
  9390. colorspace.
  9391. If one of the chrominance expression is not defined, it falls back on the other
  9392. one. If no alpha expression is specified it will evaluate to opaque value.
  9393. If none of chrominance expressions are specified, they will evaluate
  9394. to the luminance expression.
  9395. The expressions can use the following variables and functions:
  9396. @table @option
  9397. @item N
  9398. The sequential number of the filtered frame, starting from @code{0}.
  9399. @item X
  9400. @item Y
  9401. The coordinates of the current sample.
  9402. @item W
  9403. @item H
  9404. The width and height of the image.
  9405. @item SW
  9406. @item SH
  9407. Width and height scale depending on the currently filtered plane. It is the
  9408. ratio between the corresponding luma plane number of pixels and the current
  9409. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9410. @code{0.5,0.5} for chroma planes.
  9411. @item T
  9412. Time of the current frame, expressed in seconds.
  9413. @item p(x, y)
  9414. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9415. plane.
  9416. @item lum(x, y)
  9417. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9418. plane.
  9419. @item cb(x, y)
  9420. Return the value of the pixel at location (@var{x},@var{y}) of the
  9421. blue-difference chroma plane. Return 0 if there is no such plane.
  9422. @item cr(x, y)
  9423. Return the value of the pixel at location (@var{x},@var{y}) of the
  9424. red-difference chroma plane. Return 0 if there is no such plane.
  9425. @item r(x, y)
  9426. @item g(x, y)
  9427. @item b(x, y)
  9428. Return the value of the pixel at location (@var{x},@var{y}) of the
  9429. red/green/blue component. Return 0 if there is no such component.
  9430. @item alpha(x, y)
  9431. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9432. plane. Return 0 if there is no such plane.
  9433. @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)
  9434. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9435. sums of samples within a rectangle. See the functions without the sum postfix.
  9436. @item interpolation
  9437. Set one of interpolation methods:
  9438. @table @option
  9439. @item nearest, n
  9440. @item bilinear, b
  9441. @end table
  9442. Default is bilinear.
  9443. @end table
  9444. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9445. automatically clipped to the closer edge.
  9446. Please note that this filter can use multiple threads in which case each slice
  9447. will have its own expression state. If you want to use only a single expression
  9448. state because your expressions depend on previous state then you should limit
  9449. the number of filter threads to 1.
  9450. @subsection Examples
  9451. @itemize
  9452. @item
  9453. Flip the image horizontally:
  9454. @example
  9455. geq=p(W-X\,Y)
  9456. @end example
  9457. @item
  9458. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9459. wavelength of 100 pixels:
  9460. @example
  9461. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9462. @end example
  9463. @item
  9464. Generate a fancy enigmatic moving light:
  9465. @example
  9466. 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
  9467. @end example
  9468. @item
  9469. Generate a quick emboss effect:
  9470. @example
  9471. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9472. @end example
  9473. @item
  9474. Modify RGB components depending on pixel position:
  9475. @example
  9476. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9477. @end example
  9478. @item
  9479. Create a radial gradient that is the same size as the input (also see
  9480. the @ref{vignette} filter):
  9481. @example
  9482. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9483. @end example
  9484. @end itemize
  9485. @section gradfun
  9486. Fix the banding artifacts that are sometimes introduced into nearly flat
  9487. regions by truncation to 8-bit color depth.
  9488. Interpolate the gradients that should go where the bands are, and
  9489. dither them.
  9490. It is designed for playback only. Do not use it prior to
  9491. lossy compression, because compression tends to lose the dither and
  9492. bring back the bands.
  9493. It accepts the following parameters:
  9494. @table @option
  9495. @item strength
  9496. The maximum amount by which the filter will change any one pixel. This is also
  9497. the threshold for detecting nearly flat regions. Acceptable values range from
  9498. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9499. valid range.
  9500. @item radius
  9501. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9502. gradients, but also prevents the filter from modifying the pixels near detailed
  9503. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9504. values will be clipped to the valid range.
  9505. @end table
  9506. Alternatively, the options can be specified as a flat string:
  9507. @var{strength}[:@var{radius}]
  9508. @subsection Examples
  9509. @itemize
  9510. @item
  9511. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9512. @example
  9513. gradfun=3.5:8
  9514. @end example
  9515. @item
  9516. Specify radius, omitting the strength (which will fall-back to the default
  9517. value):
  9518. @example
  9519. gradfun=radius=8
  9520. @end example
  9521. @end itemize
  9522. @anchor{graphmonitor}
  9523. @section graphmonitor
  9524. Show various filtergraph stats.
  9525. With this filter one can debug complete filtergraph.
  9526. Especially issues with links filling with queued frames.
  9527. The filter accepts the following options:
  9528. @table @option
  9529. @item size, s
  9530. Set video output size. Default is @var{hd720}.
  9531. @item opacity, o
  9532. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9533. @item mode, m
  9534. Set output mode, can be @var{fulll} or @var{compact}.
  9535. In @var{compact} mode only filters with some queued frames have displayed stats.
  9536. @item flags, f
  9537. Set flags which enable which stats are shown in video.
  9538. Available values for flags are:
  9539. @table @samp
  9540. @item queue
  9541. Display number of queued frames in each link.
  9542. @item frame_count_in
  9543. Display number of frames taken from filter.
  9544. @item frame_count_out
  9545. Display number of frames given out from filter.
  9546. @item pts
  9547. Display current filtered frame pts.
  9548. @item time
  9549. Display current filtered frame time.
  9550. @item timebase
  9551. Display time base for filter link.
  9552. @item format
  9553. Display used format for filter link.
  9554. @item size
  9555. Display video size or number of audio channels in case of audio used by filter link.
  9556. @item rate
  9557. Display video frame rate or sample rate in case of audio used by filter link.
  9558. @item eof
  9559. Display link output status.
  9560. @end table
  9561. @item rate, r
  9562. Set upper limit for video rate of output stream, Default value is @var{25}.
  9563. This guarantee that output video frame rate will not be higher than this value.
  9564. @end table
  9565. @section greyedge
  9566. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9567. and corrects the scene colors accordingly.
  9568. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9569. The filter accepts the following options:
  9570. @table @option
  9571. @item difford
  9572. The order of differentiation to be applied on the scene. Must be chosen in the range
  9573. [0,2] and default value is 1.
  9574. @item minknorm
  9575. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9576. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9577. max value instead of calculating Minkowski distance.
  9578. @item sigma
  9579. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9580. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9581. can't be equal to 0 if @var{difford} is greater than 0.
  9582. @end table
  9583. @subsection Examples
  9584. @itemize
  9585. @item
  9586. Grey Edge:
  9587. @example
  9588. greyedge=difford=1:minknorm=5:sigma=2
  9589. @end example
  9590. @item
  9591. Max Edge:
  9592. @example
  9593. greyedge=difford=1:minknorm=0:sigma=2
  9594. @end example
  9595. @end itemize
  9596. @anchor{haldclut}
  9597. @section haldclut
  9598. Apply a Hald CLUT to a video stream.
  9599. First input is the video stream to process, and second one is the Hald CLUT.
  9600. The Hald CLUT input can be a simple picture or a complete video stream.
  9601. The filter accepts the following options:
  9602. @table @option
  9603. @item shortest
  9604. Force termination when the shortest input terminates. Default is @code{0}.
  9605. @item repeatlast
  9606. Continue applying the last CLUT after the end of the stream. A value of
  9607. @code{0} disable the filter after the last frame of the CLUT is reached.
  9608. Default is @code{1}.
  9609. @end table
  9610. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9611. filters share the same internals).
  9612. This filter also supports the @ref{framesync} options.
  9613. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9614. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9615. @subsection Workflow examples
  9616. @subsubsection Hald CLUT video stream
  9617. Generate an identity Hald CLUT stream altered with various effects:
  9618. @example
  9619. 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
  9620. @end example
  9621. Note: make sure you use a lossless codec.
  9622. Then use it with @code{haldclut} to apply it on some random stream:
  9623. @example
  9624. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9625. @end example
  9626. The Hald CLUT will be applied to the 10 first seconds (duration of
  9627. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9628. to the remaining frames of the @code{mandelbrot} stream.
  9629. @subsubsection Hald CLUT with preview
  9630. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9631. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9632. biggest possible square starting at the top left of the picture. The remaining
  9633. padding pixels (bottom or right) will be ignored. This area can be used to add
  9634. a preview of the Hald CLUT.
  9635. Typically, the following generated Hald CLUT will be supported by the
  9636. @code{haldclut} filter:
  9637. @example
  9638. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9639. pad=iw+320 [padded_clut];
  9640. smptebars=s=320x256, split [a][b];
  9641. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9642. [main][b] overlay=W-320" -frames:v 1 clut.png
  9643. @end example
  9644. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9645. bars are displayed on the right-top, and below the same color bars processed by
  9646. the color changes.
  9647. Then, the effect of this Hald CLUT can be visualized with:
  9648. @example
  9649. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9650. @end example
  9651. @section hflip
  9652. Flip the input video horizontally.
  9653. For example, to horizontally flip the input video with @command{ffmpeg}:
  9654. @example
  9655. ffmpeg -i in.avi -vf "hflip" out.avi
  9656. @end example
  9657. @section histeq
  9658. This filter applies a global color histogram equalization on a
  9659. per-frame basis.
  9660. It can be used to correct video that has a compressed range of pixel
  9661. intensities. The filter redistributes the pixel intensities to
  9662. equalize their distribution across the intensity range. It may be
  9663. viewed as an "automatically adjusting contrast filter". This filter is
  9664. useful only for correcting degraded or poorly captured source
  9665. video.
  9666. The filter accepts the following options:
  9667. @table @option
  9668. @item strength
  9669. Determine the amount of equalization to be applied. As the strength
  9670. is reduced, the distribution of pixel intensities more-and-more
  9671. approaches that of the input frame. The value must be a float number
  9672. in the range [0,1] and defaults to 0.200.
  9673. @item intensity
  9674. Set the maximum intensity that can generated and scale the output
  9675. values appropriately. The strength should be set as desired and then
  9676. the intensity can be limited if needed to avoid washing-out. The value
  9677. must be a float number in the range [0,1] and defaults to 0.210.
  9678. @item antibanding
  9679. Set the antibanding level. If enabled the filter will randomly vary
  9680. the luminance of output pixels by a small amount to avoid banding of
  9681. the histogram. Possible values are @code{none}, @code{weak} or
  9682. @code{strong}. It defaults to @code{none}.
  9683. @end table
  9684. @anchor{histogram}
  9685. @section histogram
  9686. Compute and draw a color distribution histogram for the input video.
  9687. The computed histogram is a representation of the color component
  9688. distribution in an image.
  9689. Standard histogram displays the color components distribution in an image.
  9690. Displays color graph for each color component. Shows distribution of
  9691. the Y, U, V, A or R, G, B components, depending on input format, in the
  9692. current frame. Below each graph a color component scale meter is shown.
  9693. The filter accepts the following options:
  9694. @table @option
  9695. @item level_height
  9696. Set height of level. Default value is @code{200}.
  9697. Allowed range is [50, 2048].
  9698. @item scale_height
  9699. Set height of color scale. Default value is @code{12}.
  9700. Allowed range is [0, 40].
  9701. @item display_mode
  9702. Set display mode.
  9703. It accepts the following values:
  9704. @table @samp
  9705. @item stack
  9706. Per color component graphs are placed below each other.
  9707. @item parade
  9708. Per color component graphs are placed side by side.
  9709. @item overlay
  9710. Presents information identical to that in the @code{parade}, except
  9711. that the graphs representing color components are superimposed directly
  9712. over one another.
  9713. @end table
  9714. Default is @code{stack}.
  9715. @item levels_mode
  9716. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9717. Default is @code{linear}.
  9718. @item components
  9719. Set what color components to display.
  9720. Default is @code{7}.
  9721. @item fgopacity
  9722. Set foreground opacity. Default is @code{0.7}.
  9723. @item bgopacity
  9724. Set background opacity. Default is @code{0.5}.
  9725. @end table
  9726. @subsection Examples
  9727. @itemize
  9728. @item
  9729. Calculate and draw histogram:
  9730. @example
  9731. ffplay -i input -vf histogram
  9732. @end example
  9733. @end itemize
  9734. @anchor{hqdn3d}
  9735. @section hqdn3d
  9736. This is a high precision/quality 3d denoise filter. It aims to reduce
  9737. image noise, producing smooth images and making still images really
  9738. still. It should enhance compressibility.
  9739. It accepts the following optional parameters:
  9740. @table @option
  9741. @item luma_spatial
  9742. A non-negative floating point number which specifies spatial luma strength.
  9743. It defaults to 4.0.
  9744. @item chroma_spatial
  9745. A non-negative floating point number which specifies spatial chroma strength.
  9746. It defaults to 3.0*@var{luma_spatial}/4.0.
  9747. @item luma_tmp
  9748. A floating point number which specifies luma temporal strength. It defaults to
  9749. 6.0*@var{luma_spatial}/4.0.
  9750. @item chroma_tmp
  9751. A floating point number which specifies chroma temporal strength. It defaults to
  9752. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9753. @end table
  9754. @subsection Commands
  9755. This filter supports same @ref{commands} as options.
  9756. The command accepts the same syntax of the corresponding option.
  9757. If the specified expression is not valid, it is kept at its current
  9758. value.
  9759. @anchor{hwdownload}
  9760. @section hwdownload
  9761. Download hardware frames to system memory.
  9762. The input must be in hardware frames, and the output a non-hardware format.
  9763. Not all formats will be supported on the output - it may be necessary to insert
  9764. an additional @option{format} filter immediately following in the graph to get
  9765. the output in a supported format.
  9766. @section hwmap
  9767. Map hardware frames to system memory or to another device.
  9768. This filter has several different modes of operation; which one is used depends
  9769. on the input and output formats:
  9770. @itemize
  9771. @item
  9772. Hardware frame input, normal frame output
  9773. Map the input frames to system memory and pass them to the output. If the
  9774. original hardware frame is later required (for example, after overlaying
  9775. something else on part of it), the @option{hwmap} filter can be used again
  9776. in the next mode to retrieve it.
  9777. @item
  9778. Normal frame input, hardware frame output
  9779. If the input is actually a software-mapped hardware frame, then unmap it -
  9780. that is, return the original hardware frame.
  9781. Otherwise, a device must be provided. Create new hardware surfaces on that
  9782. device for the output, then map them back to the software format at the input
  9783. and give those frames to the preceding filter. This will then act like the
  9784. @option{hwupload} filter, but may be able to avoid an additional copy when
  9785. the input is already in a compatible format.
  9786. @item
  9787. Hardware frame input and output
  9788. A device must be supplied for the output, either directly or with the
  9789. @option{derive_device} option. The input and output devices must be of
  9790. different types and compatible - the exact meaning of this is
  9791. system-dependent, but typically it means that they must refer to the same
  9792. underlying hardware context (for example, refer to the same graphics card).
  9793. If the input frames were originally created on the output device, then unmap
  9794. to retrieve the original frames.
  9795. Otherwise, map the frames to the output device - create new hardware frames
  9796. on the output corresponding to the frames on the input.
  9797. @end itemize
  9798. The following additional parameters are accepted:
  9799. @table @option
  9800. @item mode
  9801. Set the frame mapping mode. Some combination of:
  9802. @table @var
  9803. @item read
  9804. The mapped frame should be readable.
  9805. @item write
  9806. The mapped frame should be writeable.
  9807. @item overwrite
  9808. The mapping will always overwrite the entire frame.
  9809. This may improve performance in some cases, as the original contents of the
  9810. frame need not be loaded.
  9811. @item direct
  9812. The mapping must not involve any copying.
  9813. Indirect mappings to copies of frames are created in some cases where either
  9814. direct mapping is not possible or it would have unexpected properties.
  9815. Setting this flag ensures that the mapping is direct and will fail if that is
  9816. not possible.
  9817. @end table
  9818. Defaults to @var{read+write} if not specified.
  9819. @item derive_device @var{type}
  9820. Rather than using the device supplied at initialisation, instead derive a new
  9821. device of type @var{type} from the device the input frames exist on.
  9822. @item reverse
  9823. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9824. and map them back to the source. This may be necessary in some cases where
  9825. a mapping in one direction is required but only the opposite direction is
  9826. supported by the devices being used.
  9827. This option is dangerous - it may break the preceding filter in undefined
  9828. ways if there are any additional constraints on that filter's output.
  9829. Do not use it without fully understanding the implications of its use.
  9830. @end table
  9831. @anchor{hwupload}
  9832. @section hwupload
  9833. Upload system memory frames to hardware surfaces.
  9834. The device to upload to must be supplied when the filter is initialised. If
  9835. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9836. option or with the @option{derive_device} option. The input and output devices
  9837. must be of different types and compatible - the exact meaning of this is
  9838. system-dependent, but typically it means that they must refer to the same
  9839. underlying hardware context (for example, refer to the same graphics card).
  9840. The following additional parameters are accepted:
  9841. @table @option
  9842. @item derive_device @var{type}
  9843. Rather than using the device supplied at initialisation, instead derive a new
  9844. device of type @var{type} from the device the input frames exist on.
  9845. @end table
  9846. @anchor{hwupload_cuda}
  9847. @section hwupload_cuda
  9848. Upload system memory frames to a CUDA device.
  9849. It accepts the following optional parameters:
  9850. @table @option
  9851. @item device
  9852. The number of the CUDA device to use
  9853. @end table
  9854. @section hqx
  9855. Apply a high-quality magnification filter designed for pixel art. This filter
  9856. was originally created by Maxim Stepin.
  9857. It accepts the following option:
  9858. @table @option
  9859. @item n
  9860. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9861. @code{hq3x} and @code{4} for @code{hq4x}.
  9862. Default is @code{3}.
  9863. @end table
  9864. @section hstack
  9865. Stack input videos horizontally.
  9866. All streams must be of same pixel format and of same height.
  9867. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9868. to create same output.
  9869. The filter accepts the following option:
  9870. @table @option
  9871. @item inputs
  9872. Set number of input streams. Default is 2.
  9873. @item shortest
  9874. If set to 1, force the output to terminate when the shortest input
  9875. terminates. Default value is 0.
  9876. @end table
  9877. @section hue
  9878. Modify the hue and/or the saturation of the input.
  9879. It accepts the following parameters:
  9880. @table @option
  9881. @item h
  9882. Specify the hue angle as a number of degrees. It accepts an expression,
  9883. and defaults to "0".
  9884. @item s
  9885. Specify the saturation in the [-10,10] range. It accepts an expression and
  9886. defaults to "1".
  9887. @item H
  9888. Specify the hue angle as a number of radians. It accepts an
  9889. expression, and defaults to "0".
  9890. @item b
  9891. Specify the brightness in the [-10,10] range. It accepts an expression and
  9892. defaults to "0".
  9893. @end table
  9894. @option{h} and @option{H} are mutually exclusive, and can't be
  9895. specified at the same time.
  9896. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9897. expressions containing the following constants:
  9898. @table @option
  9899. @item n
  9900. frame count of the input frame starting from 0
  9901. @item pts
  9902. presentation timestamp of the input frame expressed in time base units
  9903. @item r
  9904. frame rate of the input video, NAN if the input frame rate is unknown
  9905. @item t
  9906. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9907. @item tb
  9908. time base of the input video
  9909. @end table
  9910. @subsection Examples
  9911. @itemize
  9912. @item
  9913. Set the hue to 90 degrees and the saturation to 1.0:
  9914. @example
  9915. hue=h=90:s=1
  9916. @end example
  9917. @item
  9918. Same command but expressing the hue in radians:
  9919. @example
  9920. hue=H=PI/2:s=1
  9921. @end example
  9922. @item
  9923. Rotate hue and make the saturation swing between 0
  9924. and 2 over a period of 1 second:
  9925. @example
  9926. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9927. @end example
  9928. @item
  9929. Apply a 3 seconds saturation fade-in effect starting at 0:
  9930. @example
  9931. hue="s=min(t/3\,1)"
  9932. @end example
  9933. The general fade-in expression can be written as:
  9934. @example
  9935. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9936. @end example
  9937. @item
  9938. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9939. @example
  9940. hue="s=max(0\, min(1\, (8-t)/3))"
  9941. @end example
  9942. The general fade-out expression can be written as:
  9943. @example
  9944. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9945. @end example
  9946. @end itemize
  9947. @subsection Commands
  9948. This filter supports the following commands:
  9949. @table @option
  9950. @item b
  9951. @item s
  9952. @item h
  9953. @item H
  9954. Modify the hue and/or the saturation and/or brightness of the input video.
  9955. The command accepts the same syntax of the corresponding option.
  9956. If the specified expression is not valid, it is kept at its current
  9957. value.
  9958. @end table
  9959. @section hysteresis
  9960. Grow first stream into second stream by connecting components.
  9961. This makes it possible to build more robust edge masks.
  9962. This filter accepts the following options:
  9963. @table @option
  9964. @item planes
  9965. Set which planes will be processed as bitmap, unprocessed planes will be
  9966. copied from first stream.
  9967. By default value 0xf, all planes will be processed.
  9968. @item threshold
  9969. Set threshold which is used in filtering. If pixel component value is higher than
  9970. this value filter algorithm for connecting components is activated.
  9971. By default value is 0.
  9972. @end table
  9973. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9974. @section idet
  9975. Detect video interlacing type.
  9976. This filter tries to detect if the input frames are interlaced, progressive,
  9977. top or bottom field first. It will also try to detect fields that are
  9978. repeated between adjacent frames (a sign of telecine).
  9979. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9980. Multiple frame detection incorporates the classification history of previous frames.
  9981. The filter will log these metadata values:
  9982. @table @option
  9983. @item single.current_frame
  9984. Detected type of current frame using single-frame detection. One of:
  9985. ``tff'' (top field first), ``bff'' (bottom field first),
  9986. ``progressive'', or ``undetermined''
  9987. @item single.tff
  9988. Cumulative number of frames detected as top field first using single-frame detection.
  9989. @item multiple.tff
  9990. Cumulative number of frames detected as top field first using multiple-frame detection.
  9991. @item single.bff
  9992. Cumulative number of frames detected as bottom field first using single-frame detection.
  9993. @item multiple.current_frame
  9994. Detected type of current frame using multiple-frame detection. One of:
  9995. ``tff'' (top field first), ``bff'' (bottom field first),
  9996. ``progressive'', or ``undetermined''
  9997. @item multiple.bff
  9998. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9999. @item single.progressive
  10000. Cumulative number of frames detected as progressive using single-frame detection.
  10001. @item multiple.progressive
  10002. Cumulative number of frames detected as progressive using multiple-frame detection.
  10003. @item single.undetermined
  10004. Cumulative number of frames that could not be classified using single-frame detection.
  10005. @item multiple.undetermined
  10006. Cumulative number of frames that could not be classified using multiple-frame detection.
  10007. @item repeated.current_frame
  10008. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  10009. @item repeated.neither
  10010. Cumulative number of frames with no repeated field.
  10011. @item repeated.top
  10012. Cumulative number of frames with the top field repeated from the previous frame's top field.
  10013. @item repeated.bottom
  10014. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  10015. @end table
  10016. The filter accepts the following options:
  10017. @table @option
  10018. @item intl_thres
  10019. Set interlacing threshold.
  10020. @item prog_thres
  10021. Set progressive threshold.
  10022. @item rep_thres
  10023. Threshold for repeated field detection.
  10024. @item half_life
  10025. Number of frames after which a given frame's contribution to the
  10026. statistics is halved (i.e., it contributes only 0.5 to its
  10027. classification). The default of 0 means that all frames seen are given
  10028. full weight of 1.0 forever.
  10029. @item analyze_interlaced_flag
  10030. When this is not 0 then idet will use the specified number of frames to determine
  10031. if the interlaced flag is accurate, it will not count undetermined frames.
  10032. If the flag is found to be accurate it will be used without any further
  10033. computations, if it is found to be inaccurate it will be cleared without any
  10034. further computations. This allows inserting the idet filter as a low computational
  10035. method to clean up the interlaced flag
  10036. @end table
  10037. @section il
  10038. Deinterleave or interleave fields.
  10039. This filter allows one to process interlaced images fields without
  10040. deinterlacing them. Deinterleaving splits the input frame into 2
  10041. fields (so called half pictures). Odd lines are moved to the top
  10042. half of the output image, even lines to the bottom half.
  10043. You can process (filter) them independently and then re-interleave them.
  10044. The filter accepts the following options:
  10045. @table @option
  10046. @item luma_mode, l
  10047. @item chroma_mode, c
  10048. @item alpha_mode, a
  10049. Available values for @var{luma_mode}, @var{chroma_mode} and
  10050. @var{alpha_mode} are:
  10051. @table @samp
  10052. @item none
  10053. Do nothing.
  10054. @item deinterleave, d
  10055. Deinterleave fields, placing one above the other.
  10056. @item interleave, i
  10057. Interleave fields. Reverse the effect of deinterleaving.
  10058. @end table
  10059. Default value is @code{none}.
  10060. @item luma_swap, ls
  10061. @item chroma_swap, cs
  10062. @item alpha_swap, as
  10063. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  10064. @end table
  10065. @subsection Commands
  10066. This filter supports the all above options as @ref{commands}.
  10067. @section inflate
  10068. Apply inflate effect to the video.
  10069. This filter replaces the pixel by the local(3x3) average by taking into account
  10070. only values higher than the pixel.
  10071. It accepts the following options:
  10072. @table @option
  10073. @item threshold0
  10074. @item threshold1
  10075. @item threshold2
  10076. @item threshold3
  10077. Limit the maximum change for each plane, default is 65535.
  10078. If 0, plane will remain unchanged.
  10079. @end table
  10080. @subsection Commands
  10081. This filter supports the all above options as @ref{commands}.
  10082. @section interlace
  10083. Simple interlacing filter from progressive contents. This interleaves upper (or
  10084. lower) lines from odd frames with lower (or upper) lines from even frames,
  10085. halving the frame rate and preserving image height.
  10086. @example
  10087. Original Original New Frame
  10088. Frame 'j' Frame 'j+1' (tff)
  10089. ========== =========== ==================
  10090. Line 0 --------------------> Frame 'j' Line 0
  10091. Line 1 Line 1 ----> Frame 'j+1' Line 1
  10092. Line 2 ---------------------> Frame 'j' Line 2
  10093. Line 3 Line 3 ----> Frame 'j+1' Line 3
  10094. ... ... ...
  10095. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  10096. @end example
  10097. It accepts the following optional parameters:
  10098. @table @option
  10099. @item scan
  10100. This determines whether the interlaced frame is taken from the even
  10101. (tff - default) or odd (bff) lines of the progressive frame.
  10102. @item lowpass
  10103. Vertical lowpass filter to avoid twitter interlacing and
  10104. reduce moire patterns.
  10105. @table @samp
  10106. @item 0, off
  10107. Disable vertical lowpass filter
  10108. @item 1, linear
  10109. Enable linear filter (default)
  10110. @item 2, complex
  10111. Enable complex filter. This will slightly less reduce twitter and moire
  10112. but better retain detail and subjective sharpness impression.
  10113. @end table
  10114. @end table
  10115. @section kerndeint
  10116. Deinterlace input video by applying Donald Graft's adaptive kernel
  10117. deinterling. Work on interlaced parts of a video to produce
  10118. progressive frames.
  10119. The description of the accepted parameters follows.
  10120. @table @option
  10121. @item thresh
  10122. Set the threshold which affects the filter's tolerance when
  10123. determining if a pixel line must be processed. It must be an integer
  10124. in the range [0,255] and defaults to 10. A value of 0 will result in
  10125. applying the process on every pixels.
  10126. @item map
  10127. Paint pixels exceeding the threshold value to white if set to 1.
  10128. Default is 0.
  10129. @item order
  10130. Set the fields order. Swap fields if set to 1, leave fields alone if
  10131. 0. Default is 0.
  10132. @item sharp
  10133. Enable additional sharpening if set to 1. Default is 0.
  10134. @item twoway
  10135. Enable twoway sharpening if set to 1. Default is 0.
  10136. @end table
  10137. @subsection Examples
  10138. @itemize
  10139. @item
  10140. Apply default values:
  10141. @example
  10142. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  10143. @end example
  10144. @item
  10145. Enable additional sharpening:
  10146. @example
  10147. kerndeint=sharp=1
  10148. @end example
  10149. @item
  10150. Paint processed pixels in white:
  10151. @example
  10152. kerndeint=map=1
  10153. @end example
  10154. @end itemize
  10155. @section lagfun
  10156. Slowly update darker pixels.
  10157. This filter makes short flashes of light appear longer.
  10158. This filter accepts the following options:
  10159. @table @option
  10160. @item decay
  10161. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  10162. @item planes
  10163. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  10164. @end table
  10165. @section lenscorrection
  10166. Correct radial lens distortion
  10167. This filter can be used to correct for radial distortion as can result from the use
  10168. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  10169. one can use tools available for example as part of opencv or simply trial-and-error.
  10170. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  10171. and extract the k1 and k2 coefficients from the resulting matrix.
  10172. Note that effectively the same filter is available in the open-source tools Krita and
  10173. Digikam from the KDE project.
  10174. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  10175. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  10176. brightness distribution, so you may want to use both filters together in certain
  10177. cases, though you will have to take care of ordering, i.e. whether vignetting should
  10178. be applied before or after lens correction.
  10179. @subsection Options
  10180. The filter accepts the following options:
  10181. @table @option
  10182. @item cx
  10183. Relative x-coordinate of the focal point of the image, and thereby the center of the
  10184. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10185. width. Default is 0.5.
  10186. @item cy
  10187. Relative y-coordinate of the focal point of the image, and thereby the center of the
  10188. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10189. height. Default is 0.5.
  10190. @item k1
  10191. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  10192. no correction. Default is 0.
  10193. @item k2
  10194. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  10195. 0 means no correction. Default is 0.
  10196. @end table
  10197. The formula that generates the correction is:
  10198. @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)
  10199. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  10200. distances from the focal point in the source and target images, respectively.
  10201. @section lensfun
  10202. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  10203. The @code{lensfun} filter requires the camera make, camera model, and lens model
  10204. to apply the lens correction. The filter will load the lensfun database and
  10205. query it to find the corresponding camera and lens entries in the database. As
  10206. long as these entries can be found with the given options, the filter can
  10207. perform corrections on frames. Note that incomplete strings will result in the
  10208. filter choosing the best match with the given options, and the filter will
  10209. output the chosen camera and lens models (logged with level "info"). You must
  10210. provide the make, camera model, and lens model as they are required.
  10211. The filter accepts the following options:
  10212. @table @option
  10213. @item make
  10214. The make of the camera (for example, "Canon"). This option is required.
  10215. @item model
  10216. The model of the camera (for example, "Canon EOS 100D"). This option is
  10217. required.
  10218. @item lens_model
  10219. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  10220. option is required.
  10221. @item mode
  10222. The type of correction to apply. The following values are valid options:
  10223. @table @samp
  10224. @item vignetting
  10225. Enables fixing lens vignetting.
  10226. @item geometry
  10227. Enables fixing lens geometry. This is the default.
  10228. @item subpixel
  10229. Enables fixing chromatic aberrations.
  10230. @item vig_geo
  10231. Enables fixing lens vignetting and lens geometry.
  10232. @item vig_subpixel
  10233. Enables fixing lens vignetting and chromatic aberrations.
  10234. @item distortion
  10235. Enables fixing both lens geometry and chromatic aberrations.
  10236. @item all
  10237. Enables all possible corrections.
  10238. @end table
  10239. @item focal_length
  10240. The focal length of the image/video (zoom; expected constant for video). For
  10241. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  10242. range should be chosen when using that lens. Default 18.
  10243. @item aperture
  10244. The aperture of the image/video (expected constant for video). Note that
  10245. aperture is only used for vignetting correction. Default 3.5.
  10246. @item focus_distance
  10247. The focus distance of the image/video (expected constant for video). Note that
  10248. focus distance is only used for vignetting and only slightly affects the
  10249. vignetting correction process. If unknown, leave it at the default value (which
  10250. is 1000).
  10251. @item scale
  10252. The scale factor which is applied after transformation. After correction the
  10253. video is no longer necessarily rectangular. This parameter controls how much of
  10254. the resulting image is visible. The value 0 means that a value will be chosen
  10255. automatically such that there is little or no unmapped area in the output
  10256. image. 1.0 means that no additional scaling is done. Lower values may result
  10257. in more of the corrected image being visible, while higher values may avoid
  10258. unmapped areas in the output.
  10259. @item target_geometry
  10260. The target geometry of the output image/video. The following values are valid
  10261. options:
  10262. @table @samp
  10263. @item rectilinear (default)
  10264. @item fisheye
  10265. @item panoramic
  10266. @item equirectangular
  10267. @item fisheye_orthographic
  10268. @item fisheye_stereographic
  10269. @item fisheye_equisolid
  10270. @item fisheye_thoby
  10271. @end table
  10272. @item reverse
  10273. Apply the reverse of image correction (instead of correcting distortion, apply
  10274. it).
  10275. @item interpolation
  10276. The type of interpolation used when correcting distortion. The following values
  10277. are valid options:
  10278. @table @samp
  10279. @item nearest
  10280. @item linear (default)
  10281. @item lanczos
  10282. @end table
  10283. @end table
  10284. @subsection Examples
  10285. @itemize
  10286. @item
  10287. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  10288. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  10289. aperture of "8.0".
  10290. @example
  10291. 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
  10292. @end example
  10293. @item
  10294. Apply the same as before, but only for the first 5 seconds of video.
  10295. @example
  10296. 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
  10297. @end example
  10298. @end itemize
  10299. @section libvmaf
  10300. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  10301. score between two input videos.
  10302. The obtained VMAF score is printed through the logging system.
  10303. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  10304. After installing the library it can be enabled using:
  10305. @code{./configure --enable-libvmaf}.
  10306. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  10307. The filter has following options:
  10308. @table @option
  10309. @item model_path
  10310. Set the model path which is to be used for SVM.
  10311. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  10312. @item log_path
  10313. Set the file path to be used to store logs.
  10314. @item log_fmt
  10315. Set the format of the log file (csv, json or xml).
  10316. @item enable_transform
  10317. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  10318. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  10319. Default value: @code{false}
  10320. @item phone_model
  10321. Invokes the phone model which will generate VMAF scores higher than in the
  10322. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  10323. Default value: @code{false}
  10324. @item psnr
  10325. Enables computing psnr along with vmaf.
  10326. Default value: @code{false}
  10327. @item ssim
  10328. Enables computing ssim along with vmaf.
  10329. Default value: @code{false}
  10330. @item ms_ssim
  10331. Enables computing ms_ssim along with vmaf.
  10332. Default value: @code{false}
  10333. @item pool
  10334. Set the pool method to be used for computing vmaf.
  10335. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  10336. @item n_threads
  10337. Set number of threads to be used when computing vmaf.
  10338. Default value: @code{0}, which makes use of all available logical processors.
  10339. @item n_subsample
  10340. Set interval for frame subsampling used when computing vmaf.
  10341. Default value: @code{1}
  10342. @item enable_conf_interval
  10343. Enables confidence interval.
  10344. Default value: @code{false}
  10345. @end table
  10346. This filter also supports the @ref{framesync} options.
  10347. @subsection Examples
  10348. @itemize
  10349. @item
  10350. On the below examples the input file @file{main.mpg} being processed is
  10351. compared with the reference file @file{ref.mpg}.
  10352. @example
  10353. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  10354. @end example
  10355. @item
  10356. Example with options:
  10357. @example
  10358. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  10359. @end example
  10360. @item
  10361. Example with options and different containers:
  10362. @example
  10363. 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 -
  10364. @end example
  10365. @end itemize
  10366. @section limiter
  10367. Limits the pixel components values to the specified range [min, max].
  10368. The filter accepts the following options:
  10369. @table @option
  10370. @item min
  10371. Lower bound. Defaults to the lowest allowed value for the input.
  10372. @item max
  10373. Upper bound. Defaults to the highest allowed value for the input.
  10374. @item planes
  10375. Specify which planes will be processed. Defaults to all available.
  10376. @end table
  10377. @subsection Commands
  10378. This filter supports the all above options as @ref{commands}.
  10379. @section loop
  10380. Loop video frames.
  10381. The filter accepts the following options:
  10382. @table @option
  10383. @item loop
  10384. Set the number of loops. Setting this value to -1 will result in infinite loops.
  10385. Default is 0.
  10386. @item size
  10387. Set maximal size in number of frames. Default is 0.
  10388. @item start
  10389. Set first frame of loop. Default is 0.
  10390. @end table
  10391. @subsection Examples
  10392. @itemize
  10393. @item
  10394. Loop single first frame infinitely:
  10395. @example
  10396. loop=loop=-1:size=1:start=0
  10397. @end example
  10398. @item
  10399. Loop single first frame 10 times:
  10400. @example
  10401. loop=loop=10:size=1:start=0
  10402. @end example
  10403. @item
  10404. Loop 10 first frames 5 times:
  10405. @example
  10406. loop=loop=5:size=10:start=0
  10407. @end example
  10408. @end itemize
  10409. @section lut1d
  10410. Apply a 1D LUT to an input video.
  10411. The filter accepts the following options:
  10412. @table @option
  10413. @item file
  10414. Set the 1D LUT file name.
  10415. Currently supported formats:
  10416. @table @samp
  10417. @item cube
  10418. Iridas
  10419. @item csp
  10420. cineSpace
  10421. @end table
  10422. @item interp
  10423. Select interpolation mode.
  10424. Available values are:
  10425. @table @samp
  10426. @item nearest
  10427. Use values from the nearest defined point.
  10428. @item linear
  10429. Interpolate values using the linear interpolation.
  10430. @item cosine
  10431. Interpolate values using the cosine interpolation.
  10432. @item cubic
  10433. Interpolate values using the cubic interpolation.
  10434. @item spline
  10435. Interpolate values using the spline interpolation.
  10436. @end table
  10437. @end table
  10438. @anchor{lut3d}
  10439. @section lut3d
  10440. Apply a 3D LUT to an input video.
  10441. The filter accepts the following options:
  10442. @table @option
  10443. @item file
  10444. Set the 3D LUT file name.
  10445. Currently supported formats:
  10446. @table @samp
  10447. @item 3dl
  10448. AfterEffects
  10449. @item cube
  10450. Iridas
  10451. @item dat
  10452. DaVinci
  10453. @item m3d
  10454. Pandora
  10455. @item csp
  10456. cineSpace
  10457. @end table
  10458. @item interp
  10459. Select interpolation mode.
  10460. Available values are:
  10461. @table @samp
  10462. @item nearest
  10463. Use values from the nearest defined point.
  10464. @item trilinear
  10465. Interpolate values using the 8 points defining a cube.
  10466. @item tetrahedral
  10467. Interpolate values using a tetrahedron.
  10468. @end table
  10469. @end table
  10470. @section lumakey
  10471. Turn certain luma values into transparency.
  10472. The filter accepts the following options:
  10473. @table @option
  10474. @item threshold
  10475. Set the luma which will be used as base for transparency.
  10476. Default value is @code{0}.
  10477. @item tolerance
  10478. Set the range of luma values to be keyed out.
  10479. Default value is @code{0.01}.
  10480. @item softness
  10481. Set the range of softness. Default value is @code{0}.
  10482. Use this to control gradual transition from zero to full transparency.
  10483. @end table
  10484. @subsection Commands
  10485. This filter supports same @ref{commands} as options.
  10486. The command accepts the same syntax of the corresponding option.
  10487. If the specified expression is not valid, it is kept at its current
  10488. value.
  10489. @section lut, lutrgb, lutyuv
  10490. Compute a look-up table for binding each pixel component input value
  10491. to an output value, and apply it to the input video.
  10492. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10493. to an RGB input video.
  10494. These filters accept the following parameters:
  10495. @table @option
  10496. @item c0
  10497. set first pixel component expression
  10498. @item c1
  10499. set second pixel component expression
  10500. @item c2
  10501. set third pixel component expression
  10502. @item c3
  10503. set fourth pixel component expression, corresponds to the alpha component
  10504. @item r
  10505. set red component expression
  10506. @item g
  10507. set green component expression
  10508. @item b
  10509. set blue component expression
  10510. @item a
  10511. alpha component expression
  10512. @item y
  10513. set Y/luminance component expression
  10514. @item u
  10515. set U/Cb component expression
  10516. @item v
  10517. set V/Cr component expression
  10518. @end table
  10519. Each of them specifies the expression to use for computing the lookup table for
  10520. the corresponding pixel component values.
  10521. The exact component associated to each of the @var{c*} options depends on the
  10522. format in input.
  10523. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10524. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10525. The expressions can contain the following constants and functions:
  10526. @table @option
  10527. @item w
  10528. @item h
  10529. The input width and height.
  10530. @item val
  10531. The input value for the pixel component.
  10532. @item clipval
  10533. The input value, clipped to the @var{minval}-@var{maxval} range.
  10534. @item maxval
  10535. The maximum value for the pixel component.
  10536. @item minval
  10537. The minimum value for the pixel component.
  10538. @item negval
  10539. The negated value for the pixel component value, clipped to the
  10540. @var{minval}-@var{maxval} range; it corresponds to the expression
  10541. "maxval-clipval+minval".
  10542. @item clip(val)
  10543. The computed value in @var{val}, clipped to the
  10544. @var{minval}-@var{maxval} range.
  10545. @item gammaval(gamma)
  10546. The computed gamma correction value of the pixel component value,
  10547. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10548. expression
  10549. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10550. @end table
  10551. All expressions default to "val".
  10552. @subsection Examples
  10553. @itemize
  10554. @item
  10555. Negate input video:
  10556. @example
  10557. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10558. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10559. @end example
  10560. The above is the same as:
  10561. @example
  10562. lutrgb="r=negval:g=negval:b=negval"
  10563. lutyuv="y=negval:u=negval:v=negval"
  10564. @end example
  10565. @item
  10566. Negate luminance:
  10567. @example
  10568. lutyuv=y=negval
  10569. @end example
  10570. @item
  10571. Remove chroma components, turning the video into a graytone image:
  10572. @example
  10573. lutyuv="u=128:v=128"
  10574. @end example
  10575. @item
  10576. Apply a luma burning effect:
  10577. @example
  10578. lutyuv="y=2*val"
  10579. @end example
  10580. @item
  10581. Remove green and blue components:
  10582. @example
  10583. lutrgb="g=0:b=0"
  10584. @end example
  10585. @item
  10586. Set a constant alpha channel value on input:
  10587. @example
  10588. format=rgba,lutrgb=a="maxval-minval/2"
  10589. @end example
  10590. @item
  10591. Correct luminance gamma by a factor of 0.5:
  10592. @example
  10593. lutyuv=y=gammaval(0.5)
  10594. @end example
  10595. @item
  10596. Discard least significant bits of luma:
  10597. @example
  10598. lutyuv=y='bitand(val, 128+64+32)'
  10599. @end example
  10600. @item
  10601. Technicolor like effect:
  10602. @example
  10603. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10604. @end example
  10605. @end itemize
  10606. @section lut2, tlut2
  10607. The @code{lut2} filter takes two input streams and outputs one
  10608. stream.
  10609. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10610. from one single stream.
  10611. This filter accepts the following parameters:
  10612. @table @option
  10613. @item c0
  10614. set first pixel component expression
  10615. @item c1
  10616. set second pixel component expression
  10617. @item c2
  10618. set third pixel component expression
  10619. @item c3
  10620. set fourth pixel component expression, corresponds to the alpha component
  10621. @item d
  10622. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10623. which means bit depth is automatically picked from first input format.
  10624. @end table
  10625. The @code{lut2} filter also supports the @ref{framesync} options.
  10626. Each of them specifies the expression to use for computing the lookup table for
  10627. the corresponding pixel component values.
  10628. The exact component associated to each of the @var{c*} options depends on the
  10629. format in inputs.
  10630. The expressions can contain the following constants:
  10631. @table @option
  10632. @item w
  10633. @item h
  10634. The input width and height.
  10635. @item x
  10636. The first input value for the pixel component.
  10637. @item y
  10638. The second input value for the pixel component.
  10639. @item bdx
  10640. The first input video bit depth.
  10641. @item bdy
  10642. The second input video bit depth.
  10643. @end table
  10644. All expressions default to "x".
  10645. @subsection Examples
  10646. @itemize
  10647. @item
  10648. Highlight differences between two RGB video streams:
  10649. @example
  10650. 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)'
  10651. @end example
  10652. @item
  10653. Highlight differences between two YUV video streams:
  10654. @example
  10655. 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)'
  10656. @end example
  10657. @item
  10658. Show max difference between two video streams:
  10659. @example
  10660. 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)))'
  10661. @end example
  10662. @end itemize
  10663. @section maskedclamp
  10664. Clamp the first input stream with the second input and third input stream.
  10665. Returns the value of first stream to be between second input
  10666. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10667. This filter accepts the following options:
  10668. @table @option
  10669. @item undershoot
  10670. Default value is @code{0}.
  10671. @item overshoot
  10672. Default value is @code{0}.
  10673. @item planes
  10674. Set which planes will be processed as bitmap, unprocessed planes will be
  10675. copied from first stream.
  10676. By default value 0xf, all planes will be processed.
  10677. @end table
  10678. @subsection Commands
  10679. This filter supports the all above options as @ref{commands}.
  10680. @section maskedmax
  10681. Merge the second and third input stream into output stream using absolute differences
  10682. between second input stream and first input stream and absolute difference between
  10683. third input stream and first input stream. The picked value will be from second input
  10684. stream if second absolute difference is greater than first one or from third input stream
  10685. otherwise.
  10686. This filter accepts the following options:
  10687. @table @option
  10688. @item planes
  10689. Set which planes will be processed as bitmap, unprocessed planes will be
  10690. copied from first stream.
  10691. By default value 0xf, all planes will be processed.
  10692. @end table
  10693. @subsection Commands
  10694. This filter supports the all above options as @ref{commands}.
  10695. @section maskedmerge
  10696. Merge the first input stream with the second input stream using per pixel
  10697. weights in the third input stream.
  10698. A value of 0 in the third stream pixel component means that pixel component
  10699. from first stream is returned unchanged, while maximum value (eg. 255 for
  10700. 8-bit videos) means that pixel component from second stream is returned
  10701. unchanged. Intermediate values define the amount of merging between both
  10702. input stream's pixel components.
  10703. This filter accepts the following options:
  10704. @table @option
  10705. @item planes
  10706. Set which planes will be processed as bitmap, unprocessed planes will be
  10707. copied from first stream.
  10708. By default value 0xf, all planes will be processed.
  10709. @end table
  10710. @section maskedmin
  10711. Merge the second and third input stream into output stream using absolute differences
  10712. between second input stream and first input stream and absolute difference between
  10713. third input stream and first input stream. The picked value will be from second input
  10714. stream if second absolute difference is less than first one or from third input stream
  10715. otherwise.
  10716. This filter accepts the following options:
  10717. @table @option
  10718. @item planes
  10719. Set which planes will be processed as bitmap, unprocessed planes will be
  10720. copied from first stream.
  10721. By default value 0xf, all planes will be processed.
  10722. @end table
  10723. @subsection Commands
  10724. This filter supports the all above options as @ref{commands}.
  10725. @section maskedthreshold
  10726. Pick pixels comparing absolute difference of two video streams with fixed
  10727. threshold.
  10728. If absolute difference between pixel component of first and second video
  10729. stream is equal or lower than user supplied threshold than pixel component
  10730. from first video stream is picked, otherwise pixel component from second
  10731. video stream is picked.
  10732. This filter accepts the following options:
  10733. @table @option
  10734. @item threshold
  10735. Set threshold used when picking pixels from absolute difference from two input
  10736. video streams.
  10737. @item planes
  10738. Set which planes will be processed as bitmap, unprocessed planes will be
  10739. copied from second stream.
  10740. By default value 0xf, all planes will be processed.
  10741. @end table
  10742. @subsection Commands
  10743. This filter supports the all above options as @ref{commands}.
  10744. @section maskfun
  10745. Create mask from input video.
  10746. For example it is useful to create motion masks after @code{tblend} filter.
  10747. This filter accepts the following options:
  10748. @table @option
  10749. @item low
  10750. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10751. @item high
  10752. Set high threshold. Any pixel component higher than this value will be set to max value
  10753. allowed for current pixel format.
  10754. @item planes
  10755. Set planes to filter, by default all available planes are filtered.
  10756. @item fill
  10757. Fill all frame pixels with this value.
  10758. @item sum
  10759. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10760. average, output frame will be completely filled with value set by @var{fill} option.
  10761. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10762. @end table
  10763. @section mcdeint
  10764. Apply motion-compensation deinterlacing.
  10765. It needs one field per frame as input and must thus be used together
  10766. with yadif=1/3 or equivalent.
  10767. This filter accepts the following options:
  10768. @table @option
  10769. @item mode
  10770. Set the deinterlacing mode.
  10771. It accepts one of the following values:
  10772. @table @samp
  10773. @item fast
  10774. @item medium
  10775. @item slow
  10776. use iterative motion estimation
  10777. @item extra_slow
  10778. like @samp{slow}, but use multiple reference frames.
  10779. @end table
  10780. Default value is @samp{fast}.
  10781. @item parity
  10782. Set the picture field parity assumed for the input video. It must be
  10783. one of the following values:
  10784. @table @samp
  10785. @item 0, tff
  10786. assume top field first
  10787. @item 1, bff
  10788. assume bottom field first
  10789. @end table
  10790. Default value is @samp{bff}.
  10791. @item qp
  10792. Set per-block quantization parameter (QP) used by the internal
  10793. encoder.
  10794. Higher values should result in a smoother motion vector field but less
  10795. optimal individual vectors. Default value is 1.
  10796. @end table
  10797. @section median
  10798. Pick median pixel from certain rectangle defined by radius.
  10799. This filter accepts the following options:
  10800. @table @option
  10801. @item radius
  10802. Set horizontal radius size. Default value is @code{1}.
  10803. Allowed range is integer from 1 to 127.
  10804. @item planes
  10805. Set which planes to process. Default is @code{15}, which is all available planes.
  10806. @item radiusV
  10807. Set vertical radius size. Default value is @code{0}.
  10808. Allowed range is integer from 0 to 127.
  10809. If it is 0, value will be picked from horizontal @code{radius} option.
  10810. @item percentile
  10811. Set median percentile. Default value is @code{0.5}.
  10812. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10813. minimum values, and @code{1} maximum values.
  10814. @end table
  10815. @subsection Commands
  10816. This filter supports same @ref{commands} as options.
  10817. The command accepts the same syntax of the corresponding option.
  10818. If the specified expression is not valid, it is kept at its current
  10819. value.
  10820. @section mergeplanes
  10821. Merge color channel components from several video streams.
  10822. The filter accepts up to 4 input streams, and merge selected input
  10823. planes to the output video.
  10824. This filter accepts the following options:
  10825. @table @option
  10826. @item mapping
  10827. Set input to output plane mapping. Default is @code{0}.
  10828. The mappings is specified as a bitmap. It should be specified as a
  10829. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10830. mapping for the first plane of the output stream. 'A' sets the number of
  10831. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10832. corresponding input to use (from 0 to 3). The rest of the mappings is
  10833. similar, 'Bb' describes the mapping for the output stream second
  10834. plane, 'Cc' describes the mapping for the output stream third plane and
  10835. 'Dd' describes the mapping for the output stream fourth plane.
  10836. @item format
  10837. Set output pixel format. Default is @code{yuva444p}.
  10838. @end table
  10839. @subsection Examples
  10840. @itemize
  10841. @item
  10842. Merge three gray video streams of same width and height into single video stream:
  10843. @example
  10844. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10845. @end example
  10846. @item
  10847. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10848. @example
  10849. [a0][a1]mergeplanes=0x00010210:yuva444p
  10850. @end example
  10851. @item
  10852. Swap Y and A plane in yuva444p stream:
  10853. @example
  10854. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10855. @end example
  10856. @item
  10857. Swap U and V plane in yuv420p stream:
  10858. @example
  10859. format=yuv420p,mergeplanes=0x000201:yuv420p
  10860. @end example
  10861. @item
  10862. Cast a rgb24 clip to yuv444p:
  10863. @example
  10864. format=rgb24,mergeplanes=0x000102:yuv444p
  10865. @end example
  10866. @end itemize
  10867. @section mestimate
  10868. Estimate and export motion vectors using block matching algorithms.
  10869. Motion vectors are stored in frame side data to be used by other filters.
  10870. This filter accepts the following options:
  10871. @table @option
  10872. @item method
  10873. Specify the motion estimation method. Accepts one of the following values:
  10874. @table @samp
  10875. @item esa
  10876. Exhaustive search algorithm.
  10877. @item tss
  10878. Three step search algorithm.
  10879. @item tdls
  10880. Two dimensional logarithmic search algorithm.
  10881. @item ntss
  10882. New three step search algorithm.
  10883. @item fss
  10884. Four step search algorithm.
  10885. @item ds
  10886. Diamond search algorithm.
  10887. @item hexbs
  10888. Hexagon-based search algorithm.
  10889. @item epzs
  10890. Enhanced predictive zonal search algorithm.
  10891. @item umh
  10892. Uneven multi-hexagon search algorithm.
  10893. @end table
  10894. Default value is @samp{esa}.
  10895. @item mb_size
  10896. Macroblock size. Default @code{16}.
  10897. @item search_param
  10898. Search parameter. Default @code{7}.
  10899. @end table
  10900. @section midequalizer
  10901. Apply Midway Image Equalization effect using two video streams.
  10902. Midway Image Equalization adjusts a pair of images to have the same
  10903. histogram, while maintaining their dynamics as much as possible. It's
  10904. useful for e.g. matching exposures from a pair of stereo cameras.
  10905. This filter has two inputs and one output, which must be of same pixel format, but
  10906. may be of different sizes. The output of filter is first input adjusted with
  10907. midway histogram of both inputs.
  10908. This filter accepts the following option:
  10909. @table @option
  10910. @item planes
  10911. Set which planes to process. Default is @code{15}, which is all available planes.
  10912. @end table
  10913. @section minterpolate
  10914. Convert the video to specified frame rate using motion interpolation.
  10915. This filter accepts the following options:
  10916. @table @option
  10917. @item fps
  10918. 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}.
  10919. @item mi_mode
  10920. Motion interpolation mode. Following values are accepted:
  10921. @table @samp
  10922. @item dup
  10923. Duplicate previous or next frame for interpolating new ones.
  10924. @item blend
  10925. Blend source frames. Interpolated frame is mean of previous and next frames.
  10926. @item mci
  10927. Motion compensated interpolation. Following options are effective when this mode is selected:
  10928. @table @samp
  10929. @item mc_mode
  10930. Motion compensation mode. Following values are accepted:
  10931. @table @samp
  10932. @item obmc
  10933. Overlapped block motion compensation.
  10934. @item aobmc
  10935. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10936. @end table
  10937. Default mode is @samp{obmc}.
  10938. @item me_mode
  10939. Motion estimation mode. Following values are accepted:
  10940. @table @samp
  10941. @item bidir
  10942. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10943. @item bilat
  10944. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10945. @end table
  10946. Default mode is @samp{bilat}.
  10947. @item me
  10948. The algorithm to be used for motion estimation. Following values are accepted:
  10949. @table @samp
  10950. @item esa
  10951. Exhaustive search algorithm.
  10952. @item tss
  10953. Three step search algorithm.
  10954. @item tdls
  10955. Two dimensional logarithmic search algorithm.
  10956. @item ntss
  10957. New three step search algorithm.
  10958. @item fss
  10959. Four step search algorithm.
  10960. @item ds
  10961. Diamond search algorithm.
  10962. @item hexbs
  10963. Hexagon-based search algorithm.
  10964. @item epzs
  10965. Enhanced predictive zonal search algorithm.
  10966. @item umh
  10967. Uneven multi-hexagon search algorithm.
  10968. @end table
  10969. Default algorithm is @samp{epzs}.
  10970. @item mb_size
  10971. Macroblock size. Default @code{16}.
  10972. @item search_param
  10973. Motion estimation search parameter. Default @code{32}.
  10974. @item vsbmc
  10975. 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).
  10976. @end table
  10977. @end table
  10978. @item scd
  10979. 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:
  10980. @table @samp
  10981. @item none
  10982. Disable scene change detection.
  10983. @item fdiff
  10984. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10985. @end table
  10986. Default method is @samp{fdiff}.
  10987. @item scd_threshold
  10988. Scene change detection threshold. Default is @code{10.}.
  10989. @end table
  10990. @section mix
  10991. Mix several video input streams into one video stream.
  10992. A description of the accepted options follows.
  10993. @table @option
  10994. @item nb_inputs
  10995. The number of inputs. If unspecified, it defaults to 2.
  10996. @item weights
  10997. Specify weight of each input video stream as sequence.
  10998. Each weight is separated by space. If number of weights
  10999. is smaller than number of @var{frames} last specified
  11000. weight will be used for all remaining unset weights.
  11001. @item scale
  11002. Specify scale, if it is set it will be multiplied with sum
  11003. of each weight multiplied with pixel values to give final destination
  11004. pixel value. By default @var{scale} is auto scaled to sum of weights.
  11005. @item duration
  11006. Specify how end of stream is determined.
  11007. @table @samp
  11008. @item longest
  11009. The duration of the longest input. (default)
  11010. @item shortest
  11011. The duration of the shortest input.
  11012. @item first
  11013. The duration of the first input.
  11014. @end table
  11015. @end table
  11016. @section mpdecimate
  11017. Drop frames that do not differ greatly from the previous frame in
  11018. order to reduce frame rate.
  11019. The main use of this filter is for very-low-bitrate encoding
  11020. (e.g. streaming over dialup modem), but it could in theory be used for
  11021. fixing movies that were inverse-telecined incorrectly.
  11022. A description of the accepted options follows.
  11023. @table @option
  11024. @item max
  11025. Set the maximum number of consecutive frames which can be dropped (if
  11026. positive), or the minimum interval between dropped frames (if
  11027. negative). If the value is 0, the frame is dropped disregarding the
  11028. number of previous sequentially dropped frames.
  11029. Default value is 0.
  11030. @item hi
  11031. @item lo
  11032. @item frac
  11033. Set the dropping threshold values.
  11034. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  11035. represent actual pixel value differences, so a threshold of 64
  11036. corresponds to 1 unit of difference for each pixel, or the same spread
  11037. out differently over the block.
  11038. A frame is a candidate for dropping if no 8x8 blocks differ by more
  11039. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  11040. meaning the whole image) differ by more than a threshold of @option{lo}.
  11041. Default value for @option{hi} is 64*12, default value for @option{lo} is
  11042. 64*5, and default value for @option{frac} is 0.33.
  11043. @end table
  11044. @section negate
  11045. Negate (invert) the input video.
  11046. It accepts the following option:
  11047. @table @option
  11048. @item negate_alpha
  11049. With value 1, it negates the alpha component, if present. Default value is 0.
  11050. @end table
  11051. @anchor{nlmeans}
  11052. @section nlmeans
  11053. Denoise frames using Non-Local Means algorithm.
  11054. Each pixel is adjusted by looking for other pixels with similar contexts. This
  11055. context similarity is defined by comparing their surrounding patches of size
  11056. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  11057. around the pixel.
  11058. Note that the research area defines centers for patches, which means some
  11059. patches will be made of pixels outside that research area.
  11060. The filter accepts the following options.
  11061. @table @option
  11062. @item s
  11063. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  11064. @item p
  11065. Set patch size. Default is 7. Must be odd number in range [0, 99].
  11066. @item pc
  11067. Same as @option{p} but for chroma planes.
  11068. The default value is @var{0} and means automatic.
  11069. @item r
  11070. Set research size. Default is 15. Must be odd number in range [0, 99].
  11071. @item rc
  11072. Same as @option{r} but for chroma planes.
  11073. The default value is @var{0} and means automatic.
  11074. @end table
  11075. @section nnedi
  11076. Deinterlace video using neural network edge directed interpolation.
  11077. This filter accepts the following options:
  11078. @table @option
  11079. @item weights
  11080. Mandatory option, without binary file filter can not work.
  11081. Currently file can be found here:
  11082. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  11083. @item deint
  11084. Set which frames to deinterlace, by default it is @code{all}.
  11085. Can be @code{all} or @code{interlaced}.
  11086. @item field
  11087. Set mode of operation.
  11088. Can be one of the following:
  11089. @table @samp
  11090. @item af
  11091. Use frame flags, both fields.
  11092. @item a
  11093. Use frame flags, single field.
  11094. @item t
  11095. Use top field only.
  11096. @item b
  11097. Use bottom field only.
  11098. @item tf
  11099. Use both fields, top first.
  11100. @item bf
  11101. Use both fields, bottom first.
  11102. @end table
  11103. @item planes
  11104. Set which planes to process, by default filter process all frames.
  11105. @item nsize
  11106. Set size of local neighborhood around each pixel, used by the predictor neural
  11107. network.
  11108. Can be one of the following:
  11109. @table @samp
  11110. @item s8x6
  11111. @item s16x6
  11112. @item s32x6
  11113. @item s48x6
  11114. @item s8x4
  11115. @item s16x4
  11116. @item s32x4
  11117. @end table
  11118. @item nns
  11119. Set the number of neurons in predictor neural network.
  11120. Can be one of the following:
  11121. @table @samp
  11122. @item n16
  11123. @item n32
  11124. @item n64
  11125. @item n128
  11126. @item n256
  11127. @end table
  11128. @item qual
  11129. Controls the number of different neural network predictions that are blended
  11130. together to compute the final output value. Can be @code{fast}, default or
  11131. @code{slow}.
  11132. @item etype
  11133. Set which set of weights to use in the predictor.
  11134. Can be one of the following:
  11135. @table @samp
  11136. @item a
  11137. weights trained to minimize absolute error
  11138. @item s
  11139. weights trained to minimize squared error
  11140. @end table
  11141. @item pscrn
  11142. Controls whether or not the prescreener neural network is used to decide
  11143. which pixels should be processed by the predictor neural network and which
  11144. can be handled by simple cubic interpolation.
  11145. The prescreener is trained to know whether cubic interpolation will be
  11146. sufficient for a pixel or whether it should be predicted by the predictor nn.
  11147. The computational complexity of the prescreener nn is much less than that of
  11148. the predictor nn. Since most pixels can be handled by cubic interpolation,
  11149. using the prescreener generally results in much faster processing.
  11150. The prescreener is pretty accurate, so the difference between using it and not
  11151. using it is almost always unnoticeable.
  11152. Can be one of the following:
  11153. @table @samp
  11154. @item none
  11155. @item original
  11156. @item new
  11157. @end table
  11158. Default is @code{new}.
  11159. @item fapprox
  11160. Set various debugging flags.
  11161. @end table
  11162. @section noformat
  11163. Force libavfilter not to use any of the specified pixel formats for the
  11164. input to the next filter.
  11165. It accepts the following parameters:
  11166. @table @option
  11167. @item pix_fmts
  11168. A '|'-separated list of pixel format names, such as
  11169. pix_fmts=yuv420p|monow|rgb24".
  11170. @end table
  11171. @subsection Examples
  11172. @itemize
  11173. @item
  11174. Force libavfilter to use a format different from @var{yuv420p} for the
  11175. input to the vflip filter:
  11176. @example
  11177. noformat=pix_fmts=yuv420p,vflip
  11178. @end example
  11179. @item
  11180. Convert the input video to any of the formats not contained in the list:
  11181. @example
  11182. noformat=yuv420p|yuv444p|yuv410p
  11183. @end example
  11184. @end itemize
  11185. @section noise
  11186. Add noise on video input frame.
  11187. The filter accepts the following options:
  11188. @table @option
  11189. @item all_seed
  11190. @item c0_seed
  11191. @item c1_seed
  11192. @item c2_seed
  11193. @item c3_seed
  11194. Set noise seed for specific pixel component or all pixel components in case
  11195. of @var{all_seed}. Default value is @code{123457}.
  11196. @item all_strength, alls
  11197. @item c0_strength, c0s
  11198. @item c1_strength, c1s
  11199. @item c2_strength, c2s
  11200. @item c3_strength, c3s
  11201. Set noise strength for specific pixel component or all pixel components in case
  11202. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  11203. @item all_flags, allf
  11204. @item c0_flags, c0f
  11205. @item c1_flags, c1f
  11206. @item c2_flags, c2f
  11207. @item c3_flags, c3f
  11208. Set pixel component flags or set flags for all components if @var{all_flags}.
  11209. Available values for component flags are:
  11210. @table @samp
  11211. @item a
  11212. averaged temporal noise (smoother)
  11213. @item p
  11214. mix random noise with a (semi)regular pattern
  11215. @item t
  11216. temporal noise (noise pattern changes between frames)
  11217. @item u
  11218. uniform noise (gaussian otherwise)
  11219. @end table
  11220. @end table
  11221. @subsection Examples
  11222. Add temporal and uniform noise to input video:
  11223. @example
  11224. noise=alls=20:allf=t+u
  11225. @end example
  11226. @section normalize
  11227. Normalize RGB video (aka histogram stretching, contrast stretching).
  11228. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  11229. For each channel of each frame, the filter computes the input range and maps
  11230. it linearly to the user-specified output range. The output range defaults
  11231. to the full dynamic range from pure black to pure white.
  11232. Temporal smoothing can be used on the input range to reduce flickering (rapid
  11233. changes in brightness) caused when small dark or bright objects enter or leave
  11234. the scene. This is similar to the auto-exposure (automatic gain control) on a
  11235. video camera, and, like a video camera, it may cause a period of over- or
  11236. under-exposure of the video.
  11237. The R,G,B channels can be normalized independently, which may cause some
  11238. color shifting, or linked together as a single channel, which prevents
  11239. color shifting. Linked normalization preserves hue. Independent normalization
  11240. does not, so it can be used to remove some color casts. Independent and linked
  11241. normalization can be combined in any ratio.
  11242. The normalize filter accepts the following options:
  11243. @table @option
  11244. @item blackpt
  11245. @item whitept
  11246. Colors which define the output range. The minimum input value is mapped to
  11247. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  11248. The defaults are black and white respectively. Specifying white for
  11249. @var{blackpt} and black for @var{whitept} will give color-inverted,
  11250. normalized video. Shades of grey can be used to reduce the dynamic range
  11251. (contrast). Specifying saturated colors here can create some interesting
  11252. effects.
  11253. @item smoothing
  11254. The number of previous frames to use for temporal smoothing. The input range
  11255. of each channel is smoothed using a rolling average over the current frame
  11256. and the @var{smoothing} previous frames. The default is 0 (no temporal
  11257. smoothing).
  11258. @item independence
  11259. Controls the ratio of independent (color shifting) channel normalization to
  11260. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  11261. independent. Defaults to 1.0 (fully independent).
  11262. @item strength
  11263. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  11264. expensive no-op. Defaults to 1.0 (full strength).
  11265. @end table
  11266. @subsection Commands
  11267. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  11268. The command accepts the same syntax of the corresponding option.
  11269. If the specified expression is not valid, it is kept at its current
  11270. value.
  11271. @subsection Examples
  11272. Stretch video contrast to use the full dynamic range, with no temporal
  11273. smoothing; may flicker depending on the source content:
  11274. @example
  11275. normalize=blackpt=black:whitept=white:smoothing=0
  11276. @end example
  11277. As above, but with 50 frames of temporal smoothing; flicker should be
  11278. reduced, depending on the source content:
  11279. @example
  11280. normalize=blackpt=black:whitept=white:smoothing=50
  11281. @end example
  11282. As above, but with hue-preserving linked channel normalization:
  11283. @example
  11284. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  11285. @end example
  11286. As above, but with half strength:
  11287. @example
  11288. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  11289. @end example
  11290. Map the darkest input color to red, the brightest input color to cyan:
  11291. @example
  11292. normalize=blackpt=red:whitept=cyan
  11293. @end example
  11294. @section null
  11295. Pass the video source unchanged to the output.
  11296. @section ocr
  11297. Optical Character Recognition
  11298. This filter uses Tesseract for optical character recognition. To enable
  11299. compilation of this filter, you need to configure FFmpeg with
  11300. @code{--enable-libtesseract}.
  11301. It accepts the following options:
  11302. @table @option
  11303. @item datapath
  11304. Set datapath to tesseract data. Default is to use whatever was
  11305. set at installation.
  11306. @item language
  11307. Set language, default is "eng".
  11308. @item whitelist
  11309. Set character whitelist.
  11310. @item blacklist
  11311. Set character blacklist.
  11312. @end table
  11313. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  11314. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  11315. @section ocv
  11316. Apply a video transform using libopencv.
  11317. To enable this filter, install the libopencv library and headers and
  11318. configure FFmpeg with @code{--enable-libopencv}.
  11319. It accepts the following parameters:
  11320. @table @option
  11321. @item filter_name
  11322. The name of the libopencv filter to apply.
  11323. @item filter_params
  11324. The parameters to pass to the libopencv filter. If not specified, the default
  11325. values are assumed.
  11326. @end table
  11327. Refer to the official libopencv documentation for more precise
  11328. information:
  11329. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  11330. Several libopencv filters are supported; see the following subsections.
  11331. @anchor{dilate}
  11332. @subsection dilate
  11333. Dilate an image by using a specific structuring element.
  11334. It corresponds to the libopencv function @code{cvDilate}.
  11335. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  11336. @var{struct_el} represents a structuring element, and has the syntax:
  11337. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  11338. @var{cols} and @var{rows} represent the number of columns and rows of
  11339. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  11340. point, and @var{shape} the shape for the structuring element. @var{shape}
  11341. must be "rect", "cross", "ellipse", or "custom".
  11342. If the value for @var{shape} is "custom", it must be followed by a
  11343. string of the form "=@var{filename}". The file with name
  11344. @var{filename} is assumed to represent a binary image, with each
  11345. printable character corresponding to a bright pixel. When a custom
  11346. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  11347. or columns and rows of the read file are assumed instead.
  11348. The default value for @var{struct_el} is "3x3+0x0/rect".
  11349. @var{nb_iterations} specifies the number of times the transform is
  11350. applied to the image, and defaults to 1.
  11351. Some examples:
  11352. @example
  11353. # Use the default values
  11354. ocv=dilate
  11355. # Dilate using a structuring element with a 5x5 cross, iterating two times
  11356. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  11357. # Read the shape from the file diamond.shape, iterating two times.
  11358. # The file diamond.shape may contain a pattern of characters like this
  11359. # *
  11360. # ***
  11361. # *****
  11362. # ***
  11363. # *
  11364. # The specified columns and rows are ignored
  11365. # but the anchor point coordinates are not
  11366. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  11367. @end example
  11368. @subsection erode
  11369. Erode an image by using a specific structuring element.
  11370. It corresponds to the libopencv function @code{cvErode}.
  11371. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  11372. with the same syntax and semantics as the @ref{dilate} filter.
  11373. @subsection smooth
  11374. Smooth the input video.
  11375. The filter takes the following parameters:
  11376. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  11377. @var{type} is the type of smooth filter to apply, and must be one of
  11378. the following values: "blur", "blur_no_scale", "median", "gaussian",
  11379. or "bilateral". The default value is "gaussian".
  11380. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  11381. depends on the smooth type. @var{param1} and
  11382. @var{param2} accept integer positive values or 0. @var{param3} and
  11383. @var{param4} accept floating point values.
  11384. The default value for @var{param1} is 3. The default value for the
  11385. other parameters is 0.
  11386. These parameters correspond to the parameters assigned to the
  11387. libopencv function @code{cvSmooth}.
  11388. @section oscilloscope
  11389. 2D Video Oscilloscope.
  11390. Useful to measure spatial impulse, step responses, chroma delays, etc.
  11391. It accepts the following parameters:
  11392. @table @option
  11393. @item x
  11394. Set scope center x position.
  11395. @item y
  11396. Set scope center y position.
  11397. @item s
  11398. Set scope size, relative to frame diagonal.
  11399. @item t
  11400. Set scope tilt/rotation.
  11401. @item o
  11402. Set trace opacity.
  11403. @item tx
  11404. Set trace center x position.
  11405. @item ty
  11406. Set trace center y position.
  11407. @item tw
  11408. Set trace width, relative to width of frame.
  11409. @item th
  11410. Set trace height, relative to height of frame.
  11411. @item c
  11412. Set which components to trace. By default it traces first three components.
  11413. @item g
  11414. Draw trace grid. By default is enabled.
  11415. @item st
  11416. Draw some statistics. By default is enabled.
  11417. @item sc
  11418. Draw scope. By default is enabled.
  11419. @end table
  11420. @subsection Commands
  11421. This filter supports same @ref{commands} as options.
  11422. The command accepts the same syntax of the corresponding option.
  11423. If the specified expression is not valid, it is kept at its current
  11424. value.
  11425. @subsection Examples
  11426. @itemize
  11427. @item
  11428. Inspect full first row of video frame.
  11429. @example
  11430. oscilloscope=x=0.5:y=0:s=1
  11431. @end example
  11432. @item
  11433. Inspect full last row of video frame.
  11434. @example
  11435. oscilloscope=x=0.5:y=1:s=1
  11436. @end example
  11437. @item
  11438. Inspect full 5th line of video frame of height 1080.
  11439. @example
  11440. oscilloscope=x=0.5:y=5/1080:s=1
  11441. @end example
  11442. @item
  11443. Inspect full last column of video frame.
  11444. @example
  11445. oscilloscope=x=1:y=0.5:s=1:t=1
  11446. @end example
  11447. @end itemize
  11448. @anchor{overlay}
  11449. @section overlay
  11450. Overlay one video on top of another.
  11451. It takes two inputs and has one output. The first input is the "main"
  11452. video on which the second input is overlaid.
  11453. It accepts the following parameters:
  11454. A description of the accepted options follows.
  11455. @table @option
  11456. @item x
  11457. @item y
  11458. Set the expression for the x and y coordinates of the overlaid video
  11459. on the main video. Default value is "0" for both expressions. In case
  11460. the expression is invalid, it is set to a huge value (meaning that the
  11461. overlay will not be displayed within the output visible area).
  11462. @item eof_action
  11463. See @ref{framesync}.
  11464. @item eval
  11465. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11466. It accepts the following values:
  11467. @table @samp
  11468. @item init
  11469. only evaluate expressions once during the filter initialization or
  11470. when a command is processed
  11471. @item frame
  11472. evaluate expressions for each incoming frame
  11473. @end table
  11474. Default value is @samp{frame}.
  11475. @item shortest
  11476. See @ref{framesync}.
  11477. @item format
  11478. Set the format for the output video.
  11479. It accepts the following values:
  11480. @table @samp
  11481. @item yuv420
  11482. force YUV420 output
  11483. @item yuv420p10
  11484. force YUV420p10 output
  11485. @item yuv422
  11486. force YUV422 output
  11487. @item yuv422p10
  11488. force YUV422p10 output
  11489. @item yuv444
  11490. force YUV444 output
  11491. @item rgb
  11492. force packed RGB output
  11493. @item gbrp
  11494. force planar RGB output
  11495. @item auto
  11496. automatically pick format
  11497. @end table
  11498. Default value is @samp{yuv420}.
  11499. @item repeatlast
  11500. See @ref{framesync}.
  11501. @item alpha
  11502. Set format of alpha of the overlaid video, it can be @var{straight} or
  11503. @var{premultiplied}. Default is @var{straight}.
  11504. @end table
  11505. The @option{x}, and @option{y} expressions can contain the following
  11506. parameters.
  11507. @table @option
  11508. @item main_w, W
  11509. @item main_h, H
  11510. The main input width and height.
  11511. @item overlay_w, w
  11512. @item overlay_h, h
  11513. The overlay input width and height.
  11514. @item x
  11515. @item y
  11516. The computed values for @var{x} and @var{y}. They are evaluated for
  11517. each new frame.
  11518. @item hsub
  11519. @item vsub
  11520. horizontal and vertical chroma subsample values of the output
  11521. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11522. @var{vsub} is 1.
  11523. @item n
  11524. the number of input frame, starting from 0
  11525. @item pos
  11526. the position in the file of the input frame, NAN if unknown
  11527. @item t
  11528. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11529. @end table
  11530. This filter also supports the @ref{framesync} options.
  11531. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11532. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11533. when @option{eval} is set to @samp{init}.
  11534. Be aware that frames are taken from each input video in timestamp
  11535. order, hence, if their initial timestamps differ, it is a good idea
  11536. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11537. have them begin in the same zero timestamp, as the example for
  11538. the @var{movie} filter does.
  11539. You can chain together more overlays but you should test the
  11540. efficiency of such approach.
  11541. @subsection Commands
  11542. This filter supports the following commands:
  11543. @table @option
  11544. @item x
  11545. @item y
  11546. Modify the x and y of the overlay input.
  11547. The command accepts the same syntax of the corresponding option.
  11548. If the specified expression is not valid, it is kept at its current
  11549. value.
  11550. @end table
  11551. @subsection Examples
  11552. @itemize
  11553. @item
  11554. Draw the overlay at 10 pixels from the bottom right corner of the main
  11555. video:
  11556. @example
  11557. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11558. @end example
  11559. Using named options the example above becomes:
  11560. @example
  11561. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11562. @end example
  11563. @item
  11564. Insert a transparent PNG logo in the bottom left corner of the input,
  11565. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11566. @example
  11567. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11568. @end example
  11569. @item
  11570. Insert 2 different transparent PNG logos (second logo on bottom
  11571. right corner) using the @command{ffmpeg} tool:
  11572. @example
  11573. 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
  11574. @end example
  11575. @item
  11576. Add a transparent color layer on top of the main video; @code{WxH}
  11577. must specify the size of the main input to the overlay filter:
  11578. @example
  11579. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11580. @end example
  11581. @item
  11582. Play an original video and a filtered version (here with the deshake
  11583. filter) side by side using the @command{ffplay} tool:
  11584. @example
  11585. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11586. @end example
  11587. The above command is the same as:
  11588. @example
  11589. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11590. @end example
  11591. @item
  11592. Make a sliding overlay appearing from the left to the right top part of the
  11593. screen starting since time 2:
  11594. @example
  11595. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11596. @end example
  11597. @item
  11598. Compose output by putting two input videos side to side:
  11599. @example
  11600. ffmpeg -i left.avi -i right.avi -filter_complex "
  11601. nullsrc=size=200x100 [background];
  11602. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11603. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11604. [background][left] overlay=shortest=1 [background+left];
  11605. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11606. "
  11607. @end example
  11608. @item
  11609. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11610. @example
  11611. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11612. -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]'
  11613. masked.avi
  11614. @end example
  11615. @item
  11616. Chain several overlays in cascade:
  11617. @example
  11618. nullsrc=s=200x200 [bg];
  11619. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11620. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11621. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11622. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11623. [in3] null, [mid2] overlay=100:100 [out0]
  11624. @end example
  11625. @end itemize
  11626. @anchor{overlay_cuda}
  11627. @section overlay_cuda
  11628. Overlay one video on top of another.
  11629. This is the CUDA variant of the @ref{overlay} filter.
  11630. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11631. It takes two inputs and has one output. The first input is the "main"
  11632. video on which the second input is overlaid.
  11633. It accepts the following parameters:
  11634. @table @option
  11635. @item x
  11636. @item y
  11637. Set the x and y coordinates of the overlaid video on the main video.
  11638. Default value is "0" for both expressions.
  11639. @item eof_action
  11640. See @ref{framesync}.
  11641. @item shortest
  11642. See @ref{framesync}.
  11643. @item repeatlast
  11644. See @ref{framesync}.
  11645. @end table
  11646. This filter also supports the @ref{framesync} options.
  11647. @section owdenoise
  11648. Apply Overcomplete Wavelet denoiser.
  11649. The filter accepts the following options:
  11650. @table @option
  11651. @item depth
  11652. Set depth.
  11653. Larger depth values will denoise lower frequency components more, but
  11654. slow down filtering.
  11655. Must be an int in the range 8-16, default is @code{8}.
  11656. @item luma_strength, ls
  11657. Set luma strength.
  11658. Must be a double value in the range 0-1000, default is @code{1.0}.
  11659. @item chroma_strength, cs
  11660. Set chroma strength.
  11661. Must be a double value in the range 0-1000, default is @code{1.0}.
  11662. @end table
  11663. @anchor{pad}
  11664. @section pad
  11665. Add paddings to the input image, and place the original input at the
  11666. provided @var{x}, @var{y} coordinates.
  11667. It accepts the following parameters:
  11668. @table @option
  11669. @item width, w
  11670. @item height, h
  11671. Specify an expression for the size of the output image with the
  11672. paddings added. If the value for @var{width} or @var{height} is 0, the
  11673. corresponding input size is used for the output.
  11674. The @var{width} expression can reference the value set by the
  11675. @var{height} expression, and vice versa.
  11676. The default value of @var{width} and @var{height} is 0.
  11677. @item x
  11678. @item y
  11679. Specify the offsets to place the input image at within the padded area,
  11680. with respect to the top/left border of the output image.
  11681. The @var{x} expression can reference the value set by the @var{y}
  11682. expression, and vice versa.
  11683. The default value of @var{x} and @var{y} is 0.
  11684. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11685. so the input image is centered on the padded area.
  11686. @item color
  11687. Specify the color of the padded area. For the syntax of this option,
  11688. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11689. manual,ffmpeg-utils}.
  11690. The default value of @var{color} is "black".
  11691. @item eval
  11692. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11693. It accepts the following values:
  11694. @table @samp
  11695. @item init
  11696. Only evaluate expressions once during the filter initialization or when
  11697. a command is processed.
  11698. @item frame
  11699. Evaluate expressions for each incoming frame.
  11700. @end table
  11701. Default value is @samp{init}.
  11702. @item aspect
  11703. Pad to aspect instead to a resolution.
  11704. @end table
  11705. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11706. options are expressions containing the following constants:
  11707. @table @option
  11708. @item in_w
  11709. @item in_h
  11710. The input video width and height.
  11711. @item iw
  11712. @item ih
  11713. These are the same as @var{in_w} and @var{in_h}.
  11714. @item out_w
  11715. @item out_h
  11716. The output width and height (the size of the padded area), as
  11717. specified by the @var{width} and @var{height} expressions.
  11718. @item ow
  11719. @item oh
  11720. These are the same as @var{out_w} and @var{out_h}.
  11721. @item x
  11722. @item y
  11723. The x and y offsets as specified by the @var{x} and @var{y}
  11724. expressions, or NAN if not yet specified.
  11725. @item a
  11726. same as @var{iw} / @var{ih}
  11727. @item sar
  11728. input sample aspect ratio
  11729. @item dar
  11730. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11731. @item hsub
  11732. @item vsub
  11733. The horizontal and vertical chroma subsample values. For example for the
  11734. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11735. @end table
  11736. @subsection Examples
  11737. @itemize
  11738. @item
  11739. Add paddings with the color "violet" to the input video. The output video
  11740. size is 640x480, and the top-left corner of the input video is placed at
  11741. column 0, row 40
  11742. @example
  11743. pad=640:480:0:40:violet
  11744. @end example
  11745. The example above is equivalent to the following command:
  11746. @example
  11747. pad=width=640:height=480:x=0:y=40:color=violet
  11748. @end example
  11749. @item
  11750. Pad the input to get an output with dimensions increased by 3/2,
  11751. and put the input video at the center of the padded area:
  11752. @example
  11753. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11754. @end example
  11755. @item
  11756. Pad the input to get a squared output with size equal to the maximum
  11757. value between the input width and height, and put the input video at
  11758. the center of the padded area:
  11759. @example
  11760. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11761. @end example
  11762. @item
  11763. Pad the input to get a final w/h ratio of 16:9:
  11764. @example
  11765. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11766. @end example
  11767. @item
  11768. In case of anamorphic video, in order to set the output display aspect
  11769. correctly, it is necessary to use @var{sar} in the expression,
  11770. according to the relation:
  11771. @example
  11772. (ih * X / ih) * sar = output_dar
  11773. X = output_dar / sar
  11774. @end example
  11775. Thus the previous example needs to be modified to:
  11776. @example
  11777. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11778. @end example
  11779. @item
  11780. Double the output size and put the input video in the bottom-right
  11781. corner of the output padded area:
  11782. @example
  11783. pad="2*iw:2*ih:ow-iw:oh-ih"
  11784. @end example
  11785. @end itemize
  11786. @anchor{palettegen}
  11787. @section palettegen
  11788. Generate one palette for a whole video stream.
  11789. It accepts the following options:
  11790. @table @option
  11791. @item max_colors
  11792. Set the maximum number of colors to quantize in the palette.
  11793. Note: the palette will still contain 256 colors; the unused palette entries
  11794. will be black.
  11795. @item reserve_transparent
  11796. Create a palette of 255 colors maximum and reserve the last one for
  11797. transparency. Reserving the transparency color is useful for GIF optimization.
  11798. If not set, the maximum of colors in the palette will be 256. You probably want
  11799. to disable this option for a standalone image.
  11800. Set by default.
  11801. @item transparency_color
  11802. Set the color that will be used as background for transparency.
  11803. @item stats_mode
  11804. Set statistics mode.
  11805. It accepts the following values:
  11806. @table @samp
  11807. @item full
  11808. Compute full frame histograms.
  11809. @item diff
  11810. Compute histograms only for the part that differs from previous frame. This
  11811. might be relevant to give more importance to the moving part of your input if
  11812. the background is static.
  11813. @item single
  11814. Compute new histogram for each frame.
  11815. @end table
  11816. Default value is @var{full}.
  11817. @end table
  11818. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11819. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11820. color quantization of the palette. This information is also visible at
  11821. @var{info} logging level.
  11822. @subsection Examples
  11823. @itemize
  11824. @item
  11825. Generate a representative palette of a given video using @command{ffmpeg}:
  11826. @example
  11827. ffmpeg -i input.mkv -vf palettegen palette.png
  11828. @end example
  11829. @end itemize
  11830. @section paletteuse
  11831. Use a palette to downsample an input video stream.
  11832. The filter takes two inputs: one video stream and a palette. The palette must
  11833. be a 256 pixels image.
  11834. It accepts the following options:
  11835. @table @option
  11836. @item dither
  11837. Select dithering mode. Available algorithms are:
  11838. @table @samp
  11839. @item bayer
  11840. Ordered 8x8 bayer dithering (deterministic)
  11841. @item heckbert
  11842. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11843. Note: this dithering is sometimes considered "wrong" and is included as a
  11844. reference.
  11845. @item floyd_steinberg
  11846. Floyd and Steingberg dithering (error diffusion)
  11847. @item sierra2
  11848. Frankie Sierra dithering v2 (error diffusion)
  11849. @item sierra2_4a
  11850. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11851. @end table
  11852. Default is @var{sierra2_4a}.
  11853. @item bayer_scale
  11854. When @var{bayer} dithering is selected, this option defines the scale of the
  11855. pattern (how much the crosshatch pattern is visible). A low value means more
  11856. visible pattern for less banding, and higher value means less visible pattern
  11857. at the cost of more banding.
  11858. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11859. @item diff_mode
  11860. If set, define the zone to process
  11861. @table @samp
  11862. @item rectangle
  11863. Only the changing rectangle will be reprocessed. This is similar to GIF
  11864. cropping/offsetting compression mechanism. This option can be useful for speed
  11865. if only a part of the image is changing, and has use cases such as limiting the
  11866. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11867. moving scene (it leads to more deterministic output if the scene doesn't change
  11868. much, and as a result less moving noise and better GIF compression).
  11869. @end table
  11870. Default is @var{none}.
  11871. @item new
  11872. Take new palette for each output frame.
  11873. @item alpha_threshold
  11874. Sets the alpha threshold for transparency. Alpha values above this threshold
  11875. will be treated as completely opaque, and values below this threshold will be
  11876. treated as completely transparent.
  11877. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11878. @end table
  11879. @subsection Examples
  11880. @itemize
  11881. @item
  11882. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11883. using @command{ffmpeg}:
  11884. @example
  11885. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11886. @end example
  11887. @end itemize
  11888. @section perspective
  11889. Correct perspective of video not recorded perpendicular to the screen.
  11890. A description of the accepted parameters follows.
  11891. @table @option
  11892. @item x0
  11893. @item y0
  11894. @item x1
  11895. @item y1
  11896. @item x2
  11897. @item y2
  11898. @item x3
  11899. @item y3
  11900. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11901. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11902. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11903. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11904. then the corners of the source will be sent to the specified coordinates.
  11905. The expressions can use the following variables:
  11906. @table @option
  11907. @item W
  11908. @item H
  11909. the width and height of video frame.
  11910. @item in
  11911. Input frame count.
  11912. @item on
  11913. Output frame count.
  11914. @end table
  11915. @item interpolation
  11916. Set interpolation for perspective correction.
  11917. It accepts the following values:
  11918. @table @samp
  11919. @item linear
  11920. @item cubic
  11921. @end table
  11922. Default value is @samp{linear}.
  11923. @item sense
  11924. Set interpretation of coordinate options.
  11925. It accepts the following values:
  11926. @table @samp
  11927. @item 0, source
  11928. Send point in the source specified by the given coordinates to
  11929. the corners of the destination.
  11930. @item 1, destination
  11931. Send the corners of the source to the point in the destination specified
  11932. by the given coordinates.
  11933. Default value is @samp{source}.
  11934. @end table
  11935. @item eval
  11936. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11937. It accepts the following values:
  11938. @table @samp
  11939. @item init
  11940. only evaluate expressions once during the filter initialization or
  11941. when a command is processed
  11942. @item frame
  11943. evaluate expressions for each incoming frame
  11944. @end table
  11945. Default value is @samp{init}.
  11946. @end table
  11947. @section phase
  11948. Delay interlaced video by one field time so that the field order changes.
  11949. The intended use is to fix PAL movies that have been captured with the
  11950. opposite field order to the film-to-video transfer.
  11951. A description of the accepted parameters follows.
  11952. @table @option
  11953. @item mode
  11954. Set phase mode.
  11955. It accepts the following values:
  11956. @table @samp
  11957. @item t
  11958. Capture field order top-first, transfer bottom-first.
  11959. Filter will delay the bottom field.
  11960. @item b
  11961. Capture field order bottom-first, transfer top-first.
  11962. Filter will delay the top field.
  11963. @item p
  11964. Capture and transfer with the same field order. This mode only exists
  11965. for the documentation of the other options to refer to, but if you
  11966. actually select it, the filter will faithfully do nothing.
  11967. @item a
  11968. Capture field order determined automatically by field flags, transfer
  11969. opposite.
  11970. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11971. basis using field flags. If no field information is available,
  11972. then this works just like @samp{u}.
  11973. @item u
  11974. Capture unknown or varying, transfer opposite.
  11975. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11976. analyzing the images and selecting the alternative that produces best
  11977. match between the fields.
  11978. @item T
  11979. Capture top-first, transfer unknown or varying.
  11980. Filter selects among @samp{t} and @samp{p} using image analysis.
  11981. @item B
  11982. Capture bottom-first, transfer unknown or varying.
  11983. Filter selects among @samp{b} and @samp{p} using image analysis.
  11984. @item A
  11985. Capture determined by field flags, transfer unknown or varying.
  11986. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11987. image analysis. If no field information is available, then this works just
  11988. like @samp{U}. This is the default mode.
  11989. @item U
  11990. Both capture and transfer unknown or varying.
  11991. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11992. @end table
  11993. @end table
  11994. @section photosensitivity
  11995. Reduce various flashes in video, so to help users with epilepsy.
  11996. It accepts the following options:
  11997. @table @option
  11998. @item frames, f
  11999. Set how many frames to use when filtering. Default is 30.
  12000. @item threshold, t
  12001. Set detection threshold factor. Default is 1.
  12002. Lower is stricter.
  12003. @item skip
  12004. Set how many pixels to skip when sampling frames. Default is 1.
  12005. Allowed range is from 1 to 1024.
  12006. @item bypass
  12007. Leave frames unchanged. Default is disabled.
  12008. @end table
  12009. @section pixdesctest
  12010. Pixel format descriptor test filter, mainly useful for internal
  12011. testing. The output video should be equal to the input video.
  12012. For example:
  12013. @example
  12014. format=monow, pixdesctest
  12015. @end example
  12016. can be used to test the monowhite pixel format descriptor definition.
  12017. @section pixscope
  12018. Display sample values of color channels. Mainly useful for checking color
  12019. and levels. Minimum supported resolution is 640x480.
  12020. The filters accept the following options:
  12021. @table @option
  12022. @item x
  12023. Set scope X position, relative offset on X axis.
  12024. @item y
  12025. Set scope Y position, relative offset on Y axis.
  12026. @item w
  12027. Set scope width.
  12028. @item h
  12029. Set scope height.
  12030. @item o
  12031. Set window opacity. This window also holds statistics about pixel area.
  12032. @item wx
  12033. Set window X position, relative offset on X axis.
  12034. @item wy
  12035. Set window Y position, relative offset on Y axis.
  12036. @end table
  12037. @section pp
  12038. Enable the specified chain of postprocessing subfilters using libpostproc. This
  12039. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  12040. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  12041. Each subfilter and some options have a short and a long name that can be used
  12042. interchangeably, i.e. dr/dering are the same.
  12043. The filters accept the following options:
  12044. @table @option
  12045. @item subfilters
  12046. Set postprocessing subfilters string.
  12047. @end table
  12048. All subfilters share common options to determine their scope:
  12049. @table @option
  12050. @item a/autoq
  12051. Honor the quality commands for this subfilter.
  12052. @item c/chrom
  12053. Do chrominance filtering, too (default).
  12054. @item y/nochrom
  12055. Do luminance filtering only (no chrominance).
  12056. @item n/noluma
  12057. Do chrominance filtering only (no luminance).
  12058. @end table
  12059. These options can be appended after the subfilter name, separated by a '|'.
  12060. Available subfilters are:
  12061. @table @option
  12062. @item hb/hdeblock[|difference[|flatness]]
  12063. Horizontal deblocking filter
  12064. @table @option
  12065. @item difference
  12066. Difference factor where higher values mean more deblocking (default: @code{32}).
  12067. @item flatness
  12068. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12069. @end table
  12070. @item vb/vdeblock[|difference[|flatness]]
  12071. Vertical deblocking filter
  12072. @table @option
  12073. @item difference
  12074. Difference factor where higher values mean more deblocking (default: @code{32}).
  12075. @item flatness
  12076. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12077. @end table
  12078. @item ha/hadeblock[|difference[|flatness]]
  12079. Accurate horizontal deblocking filter
  12080. @table @option
  12081. @item difference
  12082. Difference factor where higher values mean more deblocking (default: @code{32}).
  12083. @item flatness
  12084. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12085. @end table
  12086. @item va/vadeblock[|difference[|flatness]]
  12087. Accurate vertical deblocking filter
  12088. @table @option
  12089. @item difference
  12090. Difference factor where higher values mean more deblocking (default: @code{32}).
  12091. @item flatness
  12092. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12093. @end table
  12094. @end table
  12095. The horizontal and vertical deblocking filters share the difference and
  12096. flatness values so you cannot set different horizontal and vertical
  12097. thresholds.
  12098. @table @option
  12099. @item h1/x1hdeblock
  12100. Experimental horizontal deblocking filter
  12101. @item v1/x1vdeblock
  12102. Experimental vertical deblocking filter
  12103. @item dr/dering
  12104. Deringing filter
  12105. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  12106. @table @option
  12107. @item threshold1
  12108. larger -> stronger filtering
  12109. @item threshold2
  12110. larger -> stronger filtering
  12111. @item threshold3
  12112. larger -> stronger filtering
  12113. @end table
  12114. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  12115. @table @option
  12116. @item f/fullyrange
  12117. Stretch luminance to @code{0-255}.
  12118. @end table
  12119. @item lb/linblenddeint
  12120. Linear blend deinterlacing filter that deinterlaces the given block by
  12121. filtering all lines with a @code{(1 2 1)} filter.
  12122. @item li/linipoldeint
  12123. Linear interpolating deinterlacing filter that deinterlaces the given block by
  12124. linearly interpolating every second line.
  12125. @item ci/cubicipoldeint
  12126. Cubic interpolating deinterlacing filter deinterlaces the given block by
  12127. cubically interpolating every second line.
  12128. @item md/mediandeint
  12129. Median deinterlacing filter that deinterlaces the given block by applying a
  12130. median filter to every second line.
  12131. @item fd/ffmpegdeint
  12132. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  12133. second line with a @code{(-1 4 2 4 -1)} filter.
  12134. @item l5/lowpass5
  12135. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  12136. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  12137. @item fq/forceQuant[|quantizer]
  12138. Overrides the quantizer table from the input with the constant quantizer you
  12139. specify.
  12140. @table @option
  12141. @item quantizer
  12142. Quantizer to use
  12143. @end table
  12144. @item de/default
  12145. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  12146. @item fa/fast
  12147. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  12148. @item ac
  12149. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  12150. @end table
  12151. @subsection Examples
  12152. @itemize
  12153. @item
  12154. Apply horizontal and vertical deblocking, deringing and automatic
  12155. brightness/contrast:
  12156. @example
  12157. pp=hb/vb/dr/al
  12158. @end example
  12159. @item
  12160. Apply default filters without brightness/contrast correction:
  12161. @example
  12162. pp=de/-al
  12163. @end example
  12164. @item
  12165. Apply default filters and temporal denoiser:
  12166. @example
  12167. pp=default/tmpnoise|1|2|3
  12168. @end example
  12169. @item
  12170. Apply deblocking on luminance only, and switch vertical deblocking on or off
  12171. automatically depending on available CPU time:
  12172. @example
  12173. pp=hb|y/vb|a
  12174. @end example
  12175. @end itemize
  12176. @section pp7
  12177. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  12178. similar to spp = 6 with 7 point DCT, where only the center sample is
  12179. used after IDCT.
  12180. The filter accepts the following options:
  12181. @table @option
  12182. @item qp
  12183. Force a constant quantization parameter. It accepts an integer in range
  12184. 0 to 63. If not set, the filter will use the QP from the video stream
  12185. (if available).
  12186. @item mode
  12187. Set thresholding mode. Available modes are:
  12188. @table @samp
  12189. @item hard
  12190. Set hard thresholding.
  12191. @item soft
  12192. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12193. @item medium
  12194. Set medium thresholding (good results, default).
  12195. @end table
  12196. @end table
  12197. @section premultiply
  12198. Apply alpha premultiply effect to input video stream using first plane
  12199. of second stream as alpha.
  12200. Both streams must have same dimensions and same pixel format.
  12201. The filter accepts the following option:
  12202. @table @option
  12203. @item planes
  12204. Set which planes will be processed, unprocessed planes will be copied.
  12205. By default value 0xf, all planes will be processed.
  12206. @item inplace
  12207. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12208. @end table
  12209. @section prewitt
  12210. Apply prewitt operator to input video stream.
  12211. The filter accepts the following option:
  12212. @table @option
  12213. @item planes
  12214. Set which planes will be processed, unprocessed planes will be copied.
  12215. By default value 0xf, all planes will be processed.
  12216. @item scale
  12217. Set value which will be multiplied with filtered result.
  12218. @item delta
  12219. Set value which will be added to filtered result.
  12220. @end table
  12221. @subsection Commands
  12222. This filter supports the all above options as @ref{commands}.
  12223. @section pseudocolor
  12224. Alter frame colors in video with pseudocolors.
  12225. This filter accepts the following options:
  12226. @table @option
  12227. @item c0
  12228. set pixel first component expression
  12229. @item c1
  12230. set pixel second component expression
  12231. @item c2
  12232. set pixel third component expression
  12233. @item c3
  12234. set pixel fourth component expression, corresponds to the alpha component
  12235. @item i
  12236. set component to use as base for altering colors
  12237. @end table
  12238. Each of them specifies the expression to use for computing the lookup table for
  12239. the corresponding pixel component values.
  12240. The expressions can contain the following constants and functions:
  12241. @table @option
  12242. @item w
  12243. @item h
  12244. The input width and height.
  12245. @item val
  12246. The input value for the pixel component.
  12247. @item ymin, umin, vmin, amin
  12248. The minimum allowed component value.
  12249. @item ymax, umax, vmax, amax
  12250. The maximum allowed component value.
  12251. @end table
  12252. All expressions default to "val".
  12253. @subsection Examples
  12254. @itemize
  12255. @item
  12256. Change too high luma values to gradient:
  12257. @example
  12258. 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'"
  12259. @end example
  12260. @end itemize
  12261. @section psnr
  12262. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  12263. Ratio) between two input videos.
  12264. This filter takes in input two input videos, the first input is
  12265. considered the "main" source and is passed unchanged to the
  12266. output. The second input is used as a "reference" video for computing
  12267. the PSNR.
  12268. Both video inputs must have the same resolution and pixel format for
  12269. this filter to work correctly. Also it assumes that both inputs
  12270. have the same number of frames, which are compared one by one.
  12271. The obtained average PSNR is printed through the logging system.
  12272. The filter stores the accumulated MSE (mean squared error) of each
  12273. frame, and at the end of the processing it is averaged across all frames
  12274. equally, and the following formula is applied to obtain the PSNR:
  12275. @example
  12276. PSNR = 10*log10(MAX^2/MSE)
  12277. @end example
  12278. Where MAX is the average of the maximum values of each component of the
  12279. image.
  12280. The description of the accepted parameters follows.
  12281. @table @option
  12282. @item stats_file, f
  12283. If specified the filter will use the named file to save the PSNR of
  12284. each individual frame. When filename equals "-" the data is sent to
  12285. standard output.
  12286. @item stats_version
  12287. Specifies which version of the stats file format to use. Details of
  12288. each format are written below.
  12289. Default value is 1.
  12290. @item stats_add_max
  12291. Determines whether the max value is output to the stats log.
  12292. Default value is 0.
  12293. Requires stats_version >= 2. If this is set and stats_version < 2,
  12294. the filter will return an error.
  12295. @end table
  12296. This filter also supports the @ref{framesync} options.
  12297. The file printed if @var{stats_file} is selected, contains a sequence of
  12298. key/value pairs of the form @var{key}:@var{value} for each compared
  12299. couple of frames.
  12300. If a @var{stats_version} greater than 1 is specified, a header line precedes
  12301. the list of per-frame-pair stats, with key value pairs following the frame
  12302. format with the following parameters:
  12303. @table @option
  12304. @item psnr_log_version
  12305. The version of the log file format. Will match @var{stats_version}.
  12306. @item fields
  12307. A comma separated list of the per-frame-pair parameters included in
  12308. the log.
  12309. @end table
  12310. A description of each shown per-frame-pair parameter follows:
  12311. @table @option
  12312. @item n
  12313. sequential number of the input frame, starting from 1
  12314. @item mse_avg
  12315. Mean Square Error pixel-by-pixel average difference of the compared
  12316. frames, averaged over all the image components.
  12317. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  12318. Mean Square Error pixel-by-pixel average difference of the compared
  12319. frames for the component specified by the suffix.
  12320. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  12321. Peak Signal to Noise ratio of the compared frames for the component
  12322. specified by the suffix.
  12323. @item max_avg, max_y, max_u, max_v
  12324. Maximum allowed value for each channel, and average over all
  12325. channels.
  12326. @end table
  12327. @subsection Examples
  12328. @itemize
  12329. @item
  12330. For example:
  12331. @example
  12332. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12333. [main][ref] psnr="stats_file=stats.log" [out]
  12334. @end example
  12335. On this example the input file being processed is compared with the
  12336. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  12337. is stored in @file{stats.log}.
  12338. @item
  12339. Another example with different containers:
  12340. @example
  12341. 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 -
  12342. @end example
  12343. @end itemize
  12344. @anchor{pullup}
  12345. @section pullup
  12346. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  12347. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  12348. content.
  12349. The pullup filter is designed to take advantage of future context in making
  12350. its decisions. This filter is stateless in the sense that it does not lock
  12351. onto a pattern to follow, but it instead looks forward to the following
  12352. fields in order to identify matches and rebuild progressive frames.
  12353. To produce content with an even framerate, insert the fps filter after
  12354. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  12355. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  12356. The filter accepts the following options:
  12357. @table @option
  12358. @item jl
  12359. @item jr
  12360. @item jt
  12361. @item jb
  12362. These options set the amount of "junk" to ignore at the left, right, top, and
  12363. bottom of the image, respectively. Left and right are in units of 8 pixels,
  12364. while top and bottom are in units of 2 lines.
  12365. The default is 8 pixels on each side.
  12366. @item sb
  12367. Set the strict breaks. Setting this option to 1 will reduce the chances of
  12368. filter generating an occasional mismatched frame, but it may also cause an
  12369. excessive number of frames to be dropped during high motion sequences.
  12370. Conversely, setting it to -1 will make filter match fields more easily.
  12371. This may help processing of video where there is slight blurring between
  12372. the fields, but may also cause there to be interlaced frames in the output.
  12373. Default value is @code{0}.
  12374. @item mp
  12375. Set the metric plane to use. It accepts the following values:
  12376. @table @samp
  12377. @item l
  12378. Use luma plane.
  12379. @item u
  12380. Use chroma blue plane.
  12381. @item v
  12382. Use chroma red plane.
  12383. @end table
  12384. This option may be set to use chroma plane instead of the default luma plane
  12385. for doing filter's computations. This may improve accuracy on very clean
  12386. source material, but more likely will decrease accuracy, especially if there
  12387. is chroma noise (rainbow effect) or any grayscale video.
  12388. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  12389. load and make pullup usable in realtime on slow machines.
  12390. @end table
  12391. For best results (without duplicated frames in the output file) it is
  12392. necessary to change the output frame rate. For example, to inverse
  12393. telecine NTSC input:
  12394. @example
  12395. ffmpeg -i input -vf pullup -r 24000/1001 ...
  12396. @end example
  12397. @section qp
  12398. Change video quantization parameters (QP).
  12399. The filter accepts the following option:
  12400. @table @option
  12401. @item qp
  12402. Set expression for quantization parameter.
  12403. @end table
  12404. The expression is evaluated through the eval API and can contain, among others,
  12405. the following constants:
  12406. @table @var
  12407. @item known
  12408. 1 if index is not 129, 0 otherwise.
  12409. @item qp
  12410. Sequential index starting from -129 to 128.
  12411. @end table
  12412. @subsection Examples
  12413. @itemize
  12414. @item
  12415. Some equation like:
  12416. @example
  12417. qp=2+2*sin(PI*qp)
  12418. @end example
  12419. @end itemize
  12420. @section random
  12421. Flush video frames from internal cache of frames into a random order.
  12422. No frame is discarded.
  12423. Inspired by @ref{frei0r} nervous filter.
  12424. @table @option
  12425. @item frames
  12426. Set size in number of frames of internal cache, in range from @code{2} to
  12427. @code{512}. Default is @code{30}.
  12428. @item seed
  12429. Set seed for random number generator, must be an integer included between
  12430. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12431. less than @code{0}, the filter will try to use a good random seed on a
  12432. best effort basis.
  12433. @end table
  12434. @section readeia608
  12435. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12436. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12437. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12438. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12439. @table @option
  12440. @item lavfi.readeia608.X.cc
  12441. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12442. @item lavfi.readeia608.X.line
  12443. The number of the line on which the EIA-608 data was identified and read.
  12444. @end table
  12445. This filter accepts the following options:
  12446. @table @option
  12447. @item scan_min
  12448. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12449. @item scan_max
  12450. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12451. @item spw
  12452. Set the ratio of width reserved for sync code detection.
  12453. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12454. @item chp
  12455. Enable checking the parity bit. In the event of a parity error, the filter will output
  12456. @code{0x00} for that character. Default is false.
  12457. @item lp
  12458. Lowpass lines prior to further processing. Default is enabled.
  12459. @end table
  12460. @subsection Commands
  12461. This filter supports the all above options as @ref{commands}.
  12462. @subsection Examples
  12463. @itemize
  12464. @item
  12465. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12466. @example
  12467. 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
  12468. @end example
  12469. @end itemize
  12470. @section readvitc
  12471. Read vertical interval timecode (VITC) information from the top lines of a
  12472. video frame.
  12473. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12474. timecode value, if a valid timecode has been detected. Further metadata key
  12475. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12476. timecode data has been found or not.
  12477. This filter accepts the following options:
  12478. @table @option
  12479. @item scan_max
  12480. Set the maximum number of lines to scan for VITC data. If the value is set to
  12481. @code{-1} the full video frame is scanned. Default is @code{45}.
  12482. @item thr_b
  12483. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12484. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12485. @item thr_w
  12486. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12487. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12488. @end table
  12489. @subsection Examples
  12490. @itemize
  12491. @item
  12492. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12493. draw @code{--:--:--:--} as a placeholder:
  12494. @example
  12495. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12496. @end example
  12497. @end itemize
  12498. @section remap
  12499. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12500. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12501. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12502. value for pixel will be used for destination pixel.
  12503. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12504. will have Xmap/Ymap video stream dimensions.
  12505. Xmap and Ymap input video streams are 16bit depth, single channel.
  12506. @table @option
  12507. @item format
  12508. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12509. Default is @code{color}.
  12510. @item fill
  12511. Specify the color of the unmapped pixels. For the syntax of this option,
  12512. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12513. manual,ffmpeg-utils}. Default color is @code{black}.
  12514. @end table
  12515. @section removegrain
  12516. The removegrain filter is a spatial denoiser for progressive video.
  12517. @table @option
  12518. @item m0
  12519. Set mode for the first plane.
  12520. @item m1
  12521. Set mode for the second plane.
  12522. @item m2
  12523. Set mode for the third plane.
  12524. @item m3
  12525. Set mode for the fourth plane.
  12526. @end table
  12527. Range of mode is from 0 to 24. Description of each mode follows:
  12528. @table @var
  12529. @item 0
  12530. Leave input plane unchanged. Default.
  12531. @item 1
  12532. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12533. @item 2
  12534. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12535. @item 3
  12536. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12537. @item 4
  12538. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12539. This is equivalent to a median filter.
  12540. @item 5
  12541. Line-sensitive clipping giving the minimal change.
  12542. @item 6
  12543. Line-sensitive clipping, intermediate.
  12544. @item 7
  12545. Line-sensitive clipping, intermediate.
  12546. @item 8
  12547. Line-sensitive clipping, intermediate.
  12548. @item 9
  12549. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12550. @item 10
  12551. Replaces the target pixel with the closest neighbour.
  12552. @item 11
  12553. [1 2 1] horizontal and vertical kernel blur.
  12554. @item 12
  12555. Same as mode 11.
  12556. @item 13
  12557. Bob mode, interpolates top field from the line where the neighbours
  12558. pixels are the closest.
  12559. @item 14
  12560. Bob mode, interpolates bottom field from the line where the neighbours
  12561. pixels are the closest.
  12562. @item 15
  12563. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12564. interpolation formula.
  12565. @item 16
  12566. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12567. interpolation formula.
  12568. @item 17
  12569. Clips the pixel with the minimum and maximum of respectively the maximum and
  12570. minimum of each pair of opposite neighbour pixels.
  12571. @item 18
  12572. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12573. the current pixel is minimal.
  12574. @item 19
  12575. Replaces the pixel with the average of its 8 neighbours.
  12576. @item 20
  12577. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12578. @item 21
  12579. Clips pixels using the averages of opposite neighbour.
  12580. @item 22
  12581. Same as mode 21 but simpler and faster.
  12582. @item 23
  12583. Small edge and halo removal, but reputed useless.
  12584. @item 24
  12585. Similar as 23.
  12586. @end table
  12587. @section removelogo
  12588. Suppress a TV station logo, using an image file to determine which
  12589. pixels comprise the logo. It works by filling in the pixels that
  12590. comprise the logo with neighboring pixels.
  12591. The filter accepts the following options:
  12592. @table @option
  12593. @item filename, f
  12594. Set the filter bitmap file, which can be any image format supported by
  12595. libavformat. The width and height of the image file must match those of the
  12596. video stream being processed.
  12597. @end table
  12598. Pixels in the provided bitmap image with a value of zero are not
  12599. considered part of the logo, non-zero pixels are considered part of
  12600. the logo. If you use white (255) for the logo and black (0) for the
  12601. rest, you will be safe. For making the filter bitmap, it is
  12602. recommended to take a screen capture of a black frame with the logo
  12603. visible, and then using a threshold filter followed by the erode
  12604. filter once or twice.
  12605. If needed, little splotches can be fixed manually. Remember that if
  12606. logo pixels are not covered, the filter quality will be much
  12607. reduced. Marking too many pixels as part of the logo does not hurt as
  12608. much, but it will increase the amount of blurring needed to cover over
  12609. the image and will destroy more information than necessary, and extra
  12610. pixels will slow things down on a large logo.
  12611. @section repeatfields
  12612. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12613. fields based on its value.
  12614. @section reverse
  12615. Reverse a video clip.
  12616. Warning: This filter requires memory to buffer the entire clip, so trimming
  12617. is suggested.
  12618. @subsection Examples
  12619. @itemize
  12620. @item
  12621. Take the first 5 seconds of a clip, and reverse it.
  12622. @example
  12623. trim=end=5,reverse
  12624. @end example
  12625. @end itemize
  12626. @section rgbashift
  12627. Shift R/G/B/A pixels horizontally and/or vertically.
  12628. The filter accepts the following options:
  12629. @table @option
  12630. @item rh
  12631. Set amount to shift red horizontally.
  12632. @item rv
  12633. Set amount to shift red vertically.
  12634. @item gh
  12635. Set amount to shift green horizontally.
  12636. @item gv
  12637. Set amount to shift green vertically.
  12638. @item bh
  12639. Set amount to shift blue horizontally.
  12640. @item bv
  12641. Set amount to shift blue vertically.
  12642. @item ah
  12643. Set amount to shift alpha horizontally.
  12644. @item av
  12645. Set amount to shift alpha vertically.
  12646. @item edge
  12647. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12648. @end table
  12649. @subsection Commands
  12650. This filter supports the all above options as @ref{commands}.
  12651. @section roberts
  12652. Apply roberts cross operator to input video stream.
  12653. The filter accepts the following option:
  12654. @table @option
  12655. @item planes
  12656. Set which planes will be processed, unprocessed planes will be copied.
  12657. By default value 0xf, all planes will be processed.
  12658. @item scale
  12659. Set value which will be multiplied with filtered result.
  12660. @item delta
  12661. Set value which will be added to filtered result.
  12662. @end table
  12663. @subsection Commands
  12664. This filter supports the all above options as @ref{commands}.
  12665. @section rotate
  12666. Rotate video by an arbitrary angle expressed in radians.
  12667. The filter accepts the following options:
  12668. A description of the optional parameters follows.
  12669. @table @option
  12670. @item angle, a
  12671. Set an expression for the angle by which to rotate the input video
  12672. clockwise, expressed as a number of radians. A negative value will
  12673. result in a counter-clockwise rotation. By default it is set to "0".
  12674. This expression is evaluated for each frame.
  12675. @item out_w, ow
  12676. Set the output width expression, default value is "iw".
  12677. This expression is evaluated just once during configuration.
  12678. @item out_h, oh
  12679. Set the output height expression, default value is "ih".
  12680. This expression is evaluated just once during configuration.
  12681. @item bilinear
  12682. Enable bilinear interpolation if set to 1, a value of 0 disables
  12683. it. Default value is 1.
  12684. @item fillcolor, c
  12685. Set the color used to fill the output area not covered by the rotated
  12686. image. For the general syntax of this option, check the
  12687. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12688. If the special value "none" is selected then no
  12689. background is printed (useful for example if the background is never shown).
  12690. Default value is "black".
  12691. @end table
  12692. The expressions for the angle and the output size can contain the
  12693. following constants and functions:
  12694. @table @option
  12695. @item n
  12696. sequential number of the input frame, starting from 0. It is always NAN
  12697. before the first frame is filtered.
  12698. @item t
  12699. time in seconds of the input frame, it is set to 0 when the filter is
  12700. configured. It is always NAN before the first frame is filtered.
  12701. @item hsub
  12702. @item vsub
  12703. horizontal and vertical chroma subsample values. For example for the
  12704. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12705. @item in_w, iw
  12706. @item in_h, ih
  12707. the input video width and height
  12708. @item out_w, ow
  12709. @item out_h, oh
  12710. the output width and height, that is the size of the padded area as
  12711. specified by the @var{width} and @var{height} expressions
  12712. @item rotw(a)
  12713. @item roth(a)
  12714. the minimal width/height required for completely containing the input
  12715. video rotated by @var{a} radians.
  12716. These are only available when computing the @option{out_w} and
  12717. @option{out_h} expressions.
  12718. @end table
  12719. @subsection Examples
  12720. @itemize
  12721. @item
  12722. Rotate the input by PI/6 radians clockwise:
  12723. @example
  12724. rotate=PI/6
  12725. @end example
  12726. @item
  12727. Rotate the input by PI/6 radians counter-clockwise:
  12728. @example
  12729. rotate=-PI/6
  12730. @end example
  12731. @item
  12732. Rotate the input by 45 degrees clockwise:
  12733. @example
  12734. rotate=45*PI/180
  12735. @end example
  12736. @item
  12737. Apply a constant rotation with period T, starting from an angle of PI/3:
  12738. @example
  12739. rotate=PI/3+2*PI*t/T
  12740. @end example
  12741. @item
  12742. Make the input video rotation oscillating with a period of T
  12743. seconds and an amplitude of A radians:
  12744. @example
  12745. rotate=A*sin(2*PI/T*t)
  12746. @end example
  12747. @item
  12748. Rotate the video, output size is chosen so that the whole rotating
  12749. input video is always completely contained in the output:
  12750. @example
  12751. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12752. @end example
  12753. @item
  12754. Rotate the video, reduce the output size so that no background is ever
  12755. shown:
  12756. @example
  12757. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12758. @end example
  12759. @end itemize
  12760. @subsection Commands
  12761. The filter supports the following commands:
  12762. @table @option
  12763. @item a, angle
  12764. Set the angle expression.
  12765. The command accepts the same syntax of the corresponding option.
  12766. If the specified expression is not valid, it is kept at its current
  12767. value.
  12768. @end table
  12769. @section sab
  12770. Apply Shape Adaptive Blur.
  12771. The filter accepts the following options:
  12772. @table @option
  12773. @item luma_radius, lr
  12774. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12775. value is 1.0. A greater value will result in a more blurred image, and
  12776. in slower processing.
  12777. @item luma_pre_filter_radius, lpfr
  12778. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12779. value is 1.0.
  12780. @item luma_strength, ls
  12781. Set luma maximum difference between pixels to still be considered, must
  12782. be a value in the 0.1-100.0 range, default value is 1.0.
  12783. @item chroma_radius, cr
  12784. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12785. greater value will result in a more blurred image, and in slower
  12786. processing.
  12787. @item chroma_pre_filter_radius, cpfr
  12788. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12789. @item chroma_strength, cs
  12790. Set chroma maximum difference between pixels to still be considered,
  12791. must be a value in the -0.9-100.0 range.
  12792. @end table
  12793. Each chroma option value, if not explicitly specified, is set to the
  12794. corresponding luma option value.
  12795. @anchor{scale}
  12796. @section scale
  12797. Scale (resize) the input video, using the libswscale library.
  12798. The scale filter forces the output display aspect ratio to be the same
  12799. of the input, by changing the output sample aspect ratio.
  12800. If the input image format is different from the format requested by
  12801. the next filter, the scale filter will convert the input to the
  12802. requested format.
  12803. @subsection Options
  12804. The filter accepts the following options, or any of the options
  12805. supported by the libswscale scaler.
  12806. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12807. the complete list of scaler options.
  12808. @table @option
  12809. @item width, w
  12810. @item height, h
  12811. Set the output video dimension expression. Default value is the input
  12812. dimension.
  12813. If the @var{width} or @var{w} value is 0, the input width is used for
  12814. the output. If the @var{height} or @var{h} value is 0, the input height
  12815. is used for the output.
  12816. If one and only one of the values is -n with n >= 1, the scale filter
  12817. will use a value that maintains the aspect ratio of the input image,
  12818. calculated from the other specified dimension. After that it will,
  12819. however, make sure that the calculated dimension is divisible by n and
  12820. adjust the value if necessary.
  12821. If both values are -n with n >= 1, the behavior will be identical to
  12822. both values being set to 0 as previously detailed.
  12823. See below for the list of accepted constants for use in the dimension
  12824. expression.
  12825. @item eval
  12826. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12827. @table @samp
  12828. @item init
  12829. Only evaluate expressions once during the filter initialization or when a command is processed.
  12830. @item frame
  12831. Evaluate expressions for each incoming frame.
  12832. @end table
  12833. Default value is @samp{init}.
  12834. @item interl
  12835. Set the interlacing mode. It accepts the following values:
  12836. @table @samp
  12837. @item 1
  12838. Force interlaced aware scaling.
  12839. @item 0
  12840. Do not apply interlaced scaling.
  12841. @item -1
  12842. Select interlaced aware scaling depending on whether the source frames
  12843. are flagged as interlaced or not.
  12844. @end table
  12845. Default value is @samp{0}.
  12846. @item flags
  12847. Set libswscale scaling flags. See
  12848. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12849. complete list of values. If not explicitly specified the filter applies
  12850. the default flags.
  12851. @item param0, param1
  12852. Set libswscale input parameters for scaling algorithms that need them. See
  12853. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12854. complete documentation. If not explicitly specified the filter applies
  12855. empty parameters.
  12856. @item size, s
  12857. Set the video size. For the syntax of this option, check the
  12858. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12859. @item in_color_matrix
  12860. @item out_color_matrix
  12861. Set in/output YCbCr color space type.
  12862. This allows the autodetected value to be overridden as well as allows forcing
  12863. a specific value used for the output and encoder.
  12864. If not specified, the color space type depends on the pixel format.
  12865. Possible values:
  12866. @table @samp
  12867. @item auto
  12868. Choose automatically.
  12869. @item bt709
  12870. Format conforming to International Telecommunication Union (ITU)
  12871. Recommendation BT.709.
  12872. @item fcc
  12873. Set color space conforming to the United States Federal Communications
  12874. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12875. @item bt601
  12876. @item bt470
  12877. @item smpte170m
  12878. Set color space conforming to:
  12879. @itemize
  12880. @item
  12881. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12882. @item
  12883. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12884. @item
  12885. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12886. @end itemize
  12887. @item smpte240m
  12888. Set color space conforming to SMPTE ST 240:1999.
  12889. @item bt2020
  12890. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12891. @end table
  12892. @item in_range
  12893. @item out_range
  12894. Set in/output YCbCr sample range.
  12895. This allows the autodetected value to be overridden as well as allows forcing
  12896. a specific value used for the output and encoder. If not specified, the
  12897. range depends on the pixel format. Possible values:
  12898. @table @samp
  12899. @item auto/unknown
  12900. Choose automatically.
  12901. @item jpeg/full/pc
  12902. Set full range (0-255 in case of 8-bit luma).
  12903. @item mpeg/limited/tv
  12904. Set "MPEG" range (16-235 in case of 8-bit luma).
  12905. @end table
  12906. @item force_original_aspect_ratio
  12907. Enable decreasing or increasing output video width or height if necessary to
  12908. keep the original aspect ratio. Possible values:
  12909. @table @samp
  12910. @item disable
  12911. Scale the video as specified and disable this feature.
  12912. @item decrease
  12913. The output video dimensions will automatically be decreased if needed.
  12914. @item increase
  12915. The output video dimensions will automatically be increased if needed.
  12916. @end table
  12917. One useful instance of this option is that when you know a specific device's
  12918. maximum allowed resolution, you can use this to limit the output video to
  12919. that, while retaining the aspect ratio. For example, device A allows
  12920. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12921. decrease) and specifying 1280x720 to the command line makes the output
  12922. 1280x533.
  12923. Please note that this is a different thing than specifying -1 for @option{w}
  12924. or @option{h}, you still need to specify the output resolution for this option
  12925. to work.
  12926. @item force_divisible_by
  12927. Ensures that both the output dimensions, width and height, are divisible by the
  12928. given integer when used together with @option{force_original_aspect_ratio}. This
  12929. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12930. This option respects the value set for @option{force_original_aspect_ratio},
  12931. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12932. may be slightly modified.
  12933. This option can be handy if you need to have a video fit within or exceed
  12934. a defined resolution using @option{force_original_aspect_ratio} but also have
  12935. encoder restrictions on width or height divisibility.
  12936. @end table
  12937. The values of the @option{w} and @option{h} options are expressions
  12938. containing the following constants:
  12939. @table @var
  12940. @item in_w
  12941. @item in_h
  12942. The input width and height
  12943. @item iw
  12944. @item ih
  12945. These are the same as @var{in_w} and @var{in_h}.
  12946. @item out_w
  12947. @item out_h
  12948. The output (scaled) width and height
  12949. @item ow
  12950. @item oh
  12951. These are the same as @var{out_w} and @var{out_h}
  12952. @item a
  12953. The same as @var{iw} / @var{ih}
  12954. @item sar
  12955. input sample aspect ratio
  12956. @item dar
  12957. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12958. @item hsub
  12959. @item vsub
  12960. horizontal and vertical input chroma subsample values. For example for the
  12961. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12962. @item ohsub
  12963. @item ovsub
  12964. horizontal and vertical output chroma subsample values. For example for the
  12965. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12966. @item n
  12967. The (sequential) number of the input frame, starting from 0.
  12968. Only available with @code{eval=frame}.
  12969. @item t
  12970. The presentation timestamp of the input frame, expressed as a number of
  12971. seconds. Only available with @code{eval=frame}.
  12972. @item pos
  12973. The position (byte offset) of the frame in the input stream, or NaN if
  12974. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12975. Only available with @code{eval=frame}.
  12976. @end table
  12977. @subsection Examples
  12978. @itemize
  12979. @item
  12980. Scale the input video to a size of 200x100
  12981. @example
  12982. scale=w=200:h=100
  12983. @end example
  12984. This is equivalent to:
  12985. @example
  12986. scale=200:100
  12987. @end example
  12988. or:
  12989. @example
  12990. scale=200x100
  12991. @end example
  12992. @item
  12993. Specify a size abbreviation for the output size:
  12994. @example
  12995. scale=qcif
  12996. @end example
  12997. which can also be written as:
  12998. @example
  12999. scale=size=qcif
  13000. @end example
  13001. @item
  13002. Scale the input to 2x:
  13003. @example
  13004. scale=w=2*iw:h=2*ih
  13005. @end example
  13006. @item
  13007. The above is the same as:
  13008. @example
  13009. scale=2*in_w:2*in_h
  13010. @end example
  13011. @item
  13012. Scale the input to 2x with forced interlaced scaling:
  13013. @example
  13014. scale=2*iw:2*ih:interl=1
  13015. @end example
  13016. @item
  13017. Scale the input to half size:
  13018. @example
  13019. scale=w=iw/2:h=ih/2
  13020. @end example
  13021. @item
  13022. Increase the width, and set the height to the same size:
  13023. @example
  13024. scale=3/2*iw:ow
  13025. @end example
  13026. @item
  13027. Seek Greek harmony:
  13028. @example
  13029. scale=iw:1/PHI*iw
  13030. scale=ih*PHI:ih
  13031. @end example
  13032. @item
  13033. Increase the height, and set the width to 3/2 of the height:
  13034. @example
  13035. scale=w=3/2*oh:h=3/5*ih
  13036. @end example
  13037. @item
  13038. Increase the size, making the size a multiple of the chroma
  13039. subsample values:
  13040. @example
  13041. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  13042. @end example
  13043. @item
  13044. Increase the width to a maximum of 500 pixels,
  13045. keeping the same aspect ratio as the input:
  13046. @example
  13047. scale=w='min(500\, iw*3/2):h=-1'
  13048. @end example
  13049. @item
  13050. Make pixels square by combining scale and setsar:
  13051. @example
  13052. scale='trunc(ih*dar):ih',setsar=1/1
  13053. @end example
  13054. @item
  13055. Make pixels square by combining scale and setsar,
  13056. making sure the resulting resolution is even (required by some codecs):
  13057. @example
  13058. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  13059. @end example
  13060. @end itemize
  13061. @subsection Commands
  13062. This filter supports the following commands:
  13063. @table @option
  13064. @item width, w
  13065. @item height, h
  13066. Set the output video dimension expression.
  13067. The command accepts the same syntax of the corresponding option.
  13068. If the specified expression is not valid, it is kept at its current
  13069. value.
  13070. @end table
  13071. @section scale_npp
  13072. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  13073. format conversion on CUDA video frames. Setting the output width and height
  13074. works in the same way as for the @var{scale} filter.
  13075. The following additional options are accepted:
  13076. @table @option
  13077. @item format
  13078. The pixel format of the output CUDA frames. If set to the string "same" (the
  13079. default), the input format will be kept. Note that automatic format negotiation
  13080. and conversion is not yet supported for hardware frames
  13081. @item interp_algo
  13082. The interpolation algorithm used for resizing. One of the following:
  13083. @table @option
  13084. @item nn
  13085. Nearest neighbour.
  13086. @item linear
  13087. @item cubic
  13088. @item cubic2p_bspline
  13089. 2-parameter cubic (B=1, C=0)
  13090. @item cubic2p_catmullrom
  13091. 2-parameter cubic (B=0, C=1/2)
  13092. @item cubic2p_b05c03
  13093. 2-parameter cubic (B=1/2, C=3/10)
  13094. @item super
  13095. Supersampling
  13096. @item lanczos
  13097. @end table
  13098. @item force_original_aspect_ratio
  13099. Enable decreasing or increasing output video width or height if necessary to
  13100. keep the original aspect ratio. Possible values:
  13101. @table @samp
  13102. @item disable
  13103. Scale the video as specified and disable this feature.
  13104. @item decrease
  13105. The output video dimensions will automatically be decreased if needed.
  13106. @item increase
  13107. The output video dimensions will automatically be increased if needed.
  13108. @end table
  13109. One useful instance of this option is that when you know a specific device's
  13110. maximum allowed resolution, you can use this to limit the output video to
  13111. that, while retaining the aspect ratio. For example, device A allows
  13112. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  13113. decrease) and specifying 1280x720 to the command line makes the output
  13114. 1280x533.
  13115. Please note that this is a different thing than specifying -1 for @option{w}
  13116. or @option{h}, you still need to specify the output resolution for this option
  13117. to work.
  13118. @item force_divisible_by
  13119. Ensures that both the output dimensions, width and height, are divisible by the
  13120. given integer when used together with @option{force_original_aspect_ratio}. This
  13121. works similar to using @code{-n} in the @option{w} and @option{h} options.
  13122. This option respects the value set for @option{force_original_aspect_ratio},
  13123. increasing or decreasing the resolution accordingly. The video's aspect ratio
  13124. may be slightly modified.
  13125. This option can be handy if you need to have a video fit within or exceed
  13126. a defined resolution using @option{force_original_aspect_ratio} but also have
  13127. encoder restrictions on width or height divisibility.
  13128. @end table
  13129. @section scale2ref
  13130. Scale (resize) the input video, based on a reference video.
  13131. See the scale filter for available options, scale2ref supports the same but
  13132. uses the reference video instead of the main input as basis. scale2ref also
  13133. supports the following additional constants for the @option{w} and
  13134. @option{h} options:
  13135. @table @var
  13136. @item main_w
  13137. @item main_h
  13138. The main input video's width and height
  13139. @item main_a
  13140. The same as @var{main_w} / @var{main_h}
  13141. @item main_sar
  13142. The main input video's sample aspect ratio
  13143. @item main_dar, mdar
  13144. The main input video's display aspect ratio. Calculated from
  13145. @code{(main_w / main_h) * main_sar}.
  13146. @item main_hsub
  13147. @item main_vsub
  13148. The main input video's horizontal and vertical chroma subsample values.
  13149. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  13150. is 1.
  13151. @item main_n
  13152. The (sequential) number of the main input frame, starting from 0.
  13153. Only available with @code{eval=frame}.
  13154. @item main_t
  13155. The presentation timestamp of the main input frame, expressed as a number of
  13156. seconds. Only available with @code{eval=frame}.
  13157. @item main_pos
  13158. The position (byte offset) of the frame in the main input stream, or NaN if
  13159. this information is unavailable and/or meaningless (for example in case of synthetic video).
  13160. Only available with @code{eval=frame}.
  13161. @end table
  13162. @subsection Examples
  13163. @itemize
  13164. @item
  13165. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  13166. @example
  13167. 'scale2ref[b][a];[a][b]overlay'
  13168. @end example
  13169. @item
  13170. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  13171. @example
  13172. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  13173. @end example
  13174. @end itemize
  13175. @subsection Commands
  13176. This filter supports the following commands:
  13177. @table @option
  13178. @item width, w
  13179. @item height, h
  13180. Set the output video dimension expression.
  13181. The command accepts the same syntax of the corresponding option.
  13182. If the specified expression is not valid, it is kept at its current
  13183. value.
  13184. @end table
  13185. @section scroll
  13186. Scroll input video horizontally and/or vertically by constant speed.
  13187. The filter accepts the following options:
  13188. @table @option
  13189. @item horizontal, h
  13190. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13191. Negative values changes scrolling direction.
  13192. @item vertical, v
  13193. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13194. Negative values changes scrolling direction.
  13195. @item hpos
  13196. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  13197. @item vpos
  13198. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  13199. @end table
  13200. @subsection Commands
  13201. This filter supports the following @ref{commands}:
  13202. @table @option
  13203. @item horizontal, h
  13204. Set the horizontal scrolling speed.
  13205. @item vertical, v
  13206. Set the vertical scrolling speed.
  13207. @end table
  13208. @anchor{scdet}
  13209. @section scdet
  13210. Detect video scene change.
  13211. This filter sets frame metadata with mafd between frame, the scene score, and
  13212. forward the frame to the next filter, so they can use these metadata to detect
  13213. scene change or others.
  13214. In addition, this filter logs a message and sets frame metadata when it detects
  13215. a scene change by @option{threshold}.
  13216. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  13217. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  13218. to detect scene change.
  13219. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  13220. detect scene change with @option{threshold}.
  13221. The filter accepts the following options:
  13222. @table @option
  13223. @item threshold, t
  13224. Set the scene change detection threshold as a percentage of maximum change. Good
  13225. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  13226. @code{[0., 100.]}.
  13227. Default value is @code{10.}.
  13228. @item sc_pass, s
  13229. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  13230. You can enable it if you want to get snapshot of scene change frames only.
  13231. @end table
  13232. @anchor{selectivecolor}
  13233. @section selectivecolor
  13234. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  13235. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  13236. by the "purity" of the color (that is, how saturated it already is).
  13237. This filter is similar to the Adobe Photoshop Selective Color tool.
  13238. The filter accepts the following options:
  13239. @table @option
  13240. @item correction_method
  13241. Select color correction method.
  13242. Available values are:
  13243. @table @samp
  13244. @item absolute
  13245. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  13246. component value).
  13247. @item relative
  13248. Specified adjustments are relative to the original component value.
  13249. @end table
  13250. Default is @code{absolute}.
  13251. @item reds
  13252. Adjustments for red pixels (pixels where the red component is the maximum)
  13253. @item yellows
  13254. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  13255. @item greens
  13256. Adjustments for green pixels (pixels where the green component is the maximum)
  13257. @item cyans
  13258. Adjustments for cyan pixels (pixels where the red component is the minimum)
  13259. @item blues
  13260. Adjustments for blue pixels (pixels where the blue component is the maximum)
  13261. @item magentas
  13262. Adjustments for magenta pixels (pixels where the green component is the minimum)
  13263. @item whites
  13264. Adjustments for white pixels (pixels where all components are greater than 128)
  13265. @item neutrals
  13266. Adjustments for all pixels except pure black and pure white
  13267. @item blacks
  13268. Adjustments for black pixels (pixels where all components are lesser than 128)
  13269. @item psfile
  13270. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  13271. @end table
  13272. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  13273. 4 space separated floating point adjustment values in the [-1,1] range,
  13274. respectively to adjust the amount of cyan, magenta, yellow and black for the
  13275. pixels of its range.
  13276. @subsection Examples
  13277. @itemize
  13278. @item
  13279. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  13280. increase magenta by 27% in blue areas:
  13281. @example
  13282. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  13283. @end example
  13284. @item
  13285. Use a Photoshop selective color preset:
  13286. @example
  13287. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  13288. @end example
  13289. @end itemize
  13290. @anchor{separatefields}
  13291. @section separatefields
  13292. The @code{separatefields} takes a frame-based video input and splits
  13293. each frame into its components fields, producing a new half height clip
  13294. with twice the frame rate and twice the frame count.
  13295. This filter use field-dominance information in frame to decide which
  13296. of each pair of fields to place first in the output.
  13297. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  13298. @section setdar, setsar
  13299. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  13300. output video.
  13301. This is done by changing the specified Sample (aka Pixel) Aspect
  13302. Ratio, according to the following equation:
  13303. @example
  13304. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  13305. @end example
  13306. Keep in mind that the @code{setdar} filter does not modify the pixel
  13307. dimensions of the video frame. Also, the display aspect ratio set by
  13308. this filter may be changed by later filters in the filterchain,
  13309. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  13310. applied.
  13311. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  13312. the filter output video.
  13313. Note that as a consequence of the application of this filter, the
  13314. output display aspect ratio will change according to the equation
  13315. above.
  13316. Keep in mind that the sample aspect ratio set by the @code{setsar}
  13317. filter may be changed by later filters in the filterchain, e.g. if
  13318. another "setsar" or a "setdar" filter is applied.
  13319. It accepts the following parameters:
  13320. @table @option
  13321. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  13322. Set the aspect ratio used by the filter.
  13323. The parameter can be a floating point number string, an expression, or
  13324. a string of the form @var{num}:@var{den}, where @var{num} and
  13325. @var{den} are the numerator and denominator of the aspect ratio. If
  13326. the parameter is not specified, it is assumed the value "0".
  13327. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  13328. should be escaped.
  13329. @item max
  13330. Set the maximum integer value to use for expressing numerator and
  13331. denominator when reducing the expressed aspect ratio to a rational.
  13332. Default value is @code{100}.
  13333. @end table
  13334. The parameter @var{sar} is an expression containing
  13335. the following constants:
  13336. @table @option
  13337. @item E, PI, PHI
  13338. These are approximated values for the mathematical constants e
  13339. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  13340. @item w, h
  13341. The input width and height.
  13342. @item a
  13343. These are the same as @var{w} / @var{h}.
  13344. @item sar
  13345. The input sample aspect ratio.
  13346. @item dar
  13347. The input display aspect ratio. It is the same as
  13348. (@var{w} / @var{h}) * @var{sar}.
  13349. @item hsub, vsub
  13350. Horizontal and vertical chroma subsample values. For example, for the
  13351. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13352. @end table
  13353. @subsection Examples
  13354. @itemize
  13355. @item
  13356. To change the display aspect ratio to 16:9, specify one of the following:
  13357. @example
  13358. setdar=dar=1.77777
  13359. setdar=dar=16/9
  13360. @end example
  13361. @item
  13362. To change the sample aspect ratio to 10:11, specify:
  13363. @example
  13364. setsar=sar=10/11
  13365. @end example
  13366. @item
  13367. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  13368. 1000 in the aspect ratio reduction, use the command:
  13369. @example
  13370. setdar=ratio=16/9:max=1000
  13371. @end example
  13372. @end itemize
  13373. @anchor{setfield}
  13374. @section setfield
  13375. Force field for the output video frame.
  13376. The @code{setfield} filter marks the interlace type field for the
  13377. output frames. It does not change the input frame, but only sets the
  13378. corresponding property, which affects how the frame is treated by
  13379. following filters (e.g. @code{fieldorder} or @code{yadif}).
  13380. The filter accepts the following options:
  13381. @table @option
  13382. @item mode
  13383. Available values are:
  13384. @table @samp
  13385. @item auto
  13386. Keep the same field property.
  13387. @item bff
  13388. Mark the frame as bottom-field-first.
  13389. @item tff
  13390. Mark the frame as top-field-first.
  13391. @item prog
  13392. Mark the frame as progressive.
  13393. @end table
  13394. @end table
  13395. @anchor{setparams}
  13396. @section setparams
  13397. Force frame parameter for the output video frame.
  13398. The @code{setparams} filter marks interlace and color range for the
  13399. output frames. It does not change the input frame, but only sets the
  13400. corresponding property, which affects how the frame is treated by
  13401. filters/encoders.
  13402. @table @option
  13403. @item field_mode
  13404. Available values are:
  13405. @table @samp
  13406. @item auto
  13407. Keep the same field property (default).
  13408. @item bff
  13409. Mark the frame as bottom-field-first.
  13410. @item tff
  13411. Mark the frame as top-field-first.
  13412. @item prog
  13413. Mark the frame as progressive.
  13414. @end table
  13415. @item range
  13416. Available values are:
  13417. @table @samp
  13418. @item auto
  13419. Keep the same color range property (default).
  13420. @item unspecified, unknown
  13421. Mark the frame as unspecified color range.
  13422. @item limited, tv, mpeg
  13423. Mark the frame as limited range.
  13424. @item full, pc, jpeg
  13425. Mark the frame as full range.
  13426. @end table
  13427. @item color_primaries
  13428. Set the color primaries.
  13429. Available values are:
  13430. @table @samp
  13431. @item auto
  13432. Keep the same color primaries property (default).
  13433. @item bt709
  13434. @item unknown
  13435. @item bt470m
  13436. @item bt470bg
  13437. @item smpte170m
  13438. @item smpte240m
  13439. @item film
  13440. @item bt2020
  13441. @item smpte428
  13442. @item smpte431
  13443. @item smpte432
  13444. @item jedec-p22
  13445. @end table
  13446. @item color_trc
  13447. Set the color transfer.
  13448. Available values are:
  13449. @table @samp
  13450. @item auto
  13451. Keep the same color trc property (default).
  13452. @item bt709
  13453. @item unknown
  13454. @item bt470m
  13455. @item bt470bg
  13456. @item smpte170m
  13457. @item smpte240m
  13458. @item linear
  13459. @item log100
  13460. @item log316
  13461. @item iec61966-2-4
  13462. @item bt1361e
  13463. @item iec61966-2-1
  13464. @item bt2020-10
  13465. @item bt2020-12
  13466. @item smpte2084
  13467. @item smpte428
  13468. @item arib-std-b67
  13469. @end table
  13470. @item colorspace
  13471. Set the colorspace.
  13472. Available values are:
  13473. @table @samp
  13474. @item auto
  13475. Keep the same colorspace property (default).
  13476. @item gbr
  13477. @item bt709
  13478. @item unknown
  13479. @item fcc
  13480. @item bt470bg
  13481. @item smpte170m
  13482. @item smpte240m
  13483. @item ycgco
  13484. @item bt2020nc
  13485. @item bt2020c
  13486. @item smpte2085
  13487. @item chroma-derived-nc
  13488. @item chroma-derived-c
  13489. @item ictcp
  13490. @end table
  13491. @end table
  13492. @section showinfo
  13493. Show a line containing various information for each input video frame.
  13494. The input video is not modified.
  13495. This filter supports the following options:
  13496. @table @option
  13497. @item checksum
  13498. Calculate checksums of each plane. By default enabled.
  13499. @end table
  13500. The shown line contains a sequence of key/value pairs of the form
  13501. @var{key}:@var{value}.
  13502. The following values are shown in the output:
  13503. @table @option
  13504. @item n
  13505. The (sequential) number of the input frame, starting from 0.
  13506. @item pts
  13507. The Presentation TimeStamp of the input frame, expressed as a number of
  13508. time base units. The time base unit depends on the filter input pad.
  13509. @item pts_time
  13510. The Presentation TimeStamp of the input frame, expressed as a number of
  13511. seconds.
  13512. @item pos
  13513. The position of the frame in the input stream, or -1 if this information is
  13514. unavailable and/or meaningless (for example in case of synthetic video).
  13515. @item fmt
  13516. The pixel format name.
  13517. @item sar
  13518. The sample aspect ratio of the input frame, expressed in the form
  13519. @var{num}/@var{den}.
  13520. @item s
  13521. The size of the input frame. For the syntax of this option, check the
  13522. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13523. @item i
  13524. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13525. for bottom field first).
  13526. @item iskey
  13527. This is 1 if the frame is a key frame, 0 otherwise.
  13528. @item type
  13529. The picture type of the input frame ("I" for an I-frame, "P" for a
  13530. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13531. Also refer to the documentation of the @code{AVPictureType} enum and of
  13532. the @code{av_get_picture_type_char} function defined in
  13533. @file{libavutil/avutil.h}.
  13534. @item checksum
  13535. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13536. @item plane_checksum
  13537. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13538. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13539. @item mean
  13540. The mean value of pixels in each plane of the input frame, expressed in the form
  13541. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13542. @item stdev
  13543. The standard deviation of pixel values in each plane of the input frame, expressed
  13544. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13545. @end table
  13546. @section showpalette
  13547. Displays the 256 colors palette of each frame. This filter is only relevant for
  13548. @var{pal8} pixel format frames.
  13549. It accepts the following option:
  13550. @table @option
  13551. @item s
  13552. Set the size of the box used to represent one palette color entry. Default is
  13553. @code{30} (for a @code{30x30} pixel box).
  13554. @end table
  13555. @section shuffleframes
  13556. Reorder and/or duplicate and/or drop video frames.
  13557. It accepts the following parameters:
  13558. @table @option
  13559. @item mapping
  13560. Set the destination indexes of input frames.
  13561. This is space or '|' separated list of indexes that maps input frames to output
  13562. frames. Number of indexes also sets maximal value that each index may have.
  13563. '-1' index have special meaning and that is to drop frame.
  13564. @end table
  13565. The first frame has the index 0. The default is to keep the input unchanged.
  13566. @subsection Examples
  13567. @itemize
  13568. @item
  13569. Swap second and third frame of every three frames of the input:
  13570. @example
  13571. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13572. @end example
  13573. @item
  13574. Swap 10th and 1st frame of every ten frames of the input:
  13575. @example
  13576. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13577. @end example
  13578. @end itemize
  13579. @section shufflepixels
  13580. Reorder pixels in video frames.
  13581. This filter accepts the following options:
  13582. @table @option
  13583. @item direction, d
  13584. Set shuffle direction. Can be forward or inverse direction.
  13585. Default direction is forward.
  13586. @item mode, m
  13587. Set shuffle mode. Can be horizontal, vertical or block mode.
  13588. @item width, w
  13589. @item height, h
  13590. Set shuffle block_size. In case of horizontal shuffle mode only width
  13591. part of size is used, and in case of vertical shuffle mode only height
  13592. part of size is used.
  13593. @item seed, s
  13594. Set random seed used with shuffling pixels. Mainly useful to set to be able
  13595. to reverse filtering process to get original input.
  13596. For example, to reverse forward shuffle you need to use same parameters
  13597. and exact same seed and to set direction to inverse.
  13598. @end table
  13599. @section shuffleplanes
  13600. Reorder and/or duplicate video planes.
  13601. It accepts the following parameters:
  13602. @table @option
  13603. @item map0
  13604. The index of the input plane to be used as the first output plane.
  13605. @item map1
  13606. The index of the input plane to be used as the second output plane.
  13607. @item map2
  13608. The index of the input plane to be used as the third output plane.
  13609. @item map3
  13610. The index of the input plane to be used as the fourth output plane.
  13611. @end table
  13612. The first plane has the index 0. The default is to keep the input unchanged.
  13613. @subsection Examples
  13614. @itemize
  13615. @item
  13616. Swap the second and third planes of the input:
  13617. @example
  13618. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13619. @end example
  13620. @end itemize
  13621. @anchor{signalstats}
  13622. @section signalstats
  13623. Evaluate various visual metrics that assist in determining issues associated
  13624. with the digitization of analog video media.
  13625. By default the filter will log these metadata values:
  13626. @table @option
  13627. @item YMIN
  13628. Display the minimal Y value contained within the input frame. Expressed in
  13629. range of [0-255].
  13630. @item YLOW
  13631. Display the Y value at the 10% percentile within the input frame. Expressed in
  13632. range of [0-255].
  13633. @item YAVG
  13634. Display the average Y value within the input frame. Expressed in range of
  13635. [0-255].
  13636. @item YHIGH
  13637. Display the Y value at the 90% percentile within the input frame. Expressed in
  13638. range of [0-255].
  13639. @item YMAX
  13640. Display the maximum Y value contained within the input frame. Expressed in
  13641. range of [0-255].
  13642. @item UMIN
  13643. Display the minimal U value contained within the input frame. Expressed in
  13644. range of [0-255].
  13645. @item ULOW
  13646. Display the U value at the 10% percentile within the input frame. Expressed in
  13647. range of [0-255].
  13648. @item UAVG
  13649. Display the average U value within the input frame. Expressed in range of
  13650. [0-255].
  13651. @item UHIGH
  13652. Display the U value at the 90% percentile within the input frame. Expressed in
  13653. range of [0-255].
  13654. @item UMAX
  13655. Display the maximum U value contained within the input frame. Expressed in
  13656. range of [0-255].
  13657. @item VMIN
  13658. Display the minimal V value contained within the input frame. Expressed in
  13659. range of [0-255].
  13660. @item VLOW
  13661. Display the V value at the 10% percentile within the input frame. Expressed in
  13662. range of [0-255].
  13663. @item VAVG
  13664. Display the average V value within the input frame. Expressed in range of
  13665. [0-255].
  13666. @item VHIGH
  13667. Display the V value at the 90% percentile within the input frame. Expressed in
  13668. range of [0-255].
  13669. @item VMAX
  13670. Display the maximum V value contained within the input frame. Expressed in
  13671. range of [0-255].
  13672. @item SATMIN
  13673. Display the minimal saturation value contained within the input frame.
  13674. Expressed in range of [0-~181.02].
  13675. @item SATLOW
  13676. Display the saturation value at the 10% percentile within the input frame.
  13677. Expressed in range of [0-~181.02].
  13678. @item SATAVG
  13679. Display the average saturation value within the input frame. Expressed in range
  13680. of [0-~181.02].
  13681. @item SATHIGH
  13682. Display the saturation value at the 90% percentile within the input frame.
  13683. Expressed in range of [0-~181.02].
  13684. @item SATMAX
  13685. Display the maximum saturation value contained within the input frame.
  13686. Expressed in range of [0-~181.02].
  13687. @item HUEMED
  13688. Display the median value for hue within the input frame. Expressed in range of
  13689. [0-360].
  13690. @item HUEAVG
  13691. Display the average value for hue within the input frame. Expressed in range of
  13692. [0-360].
  13693. @item YDIF
  13694. Display the average of sample value difference between all values of the Y
  13695. plane in the current frame and corresponding values of the previous input frame.
  13696. Expressed in range of [0-255].
  13697. @item UDIF
  13698. Display the average of sample value difference between all values of the U
  13699. plane in the current frame and corresponding values of the previous input frame.
  13700. Expressed in range of [0-255].
  13701. @item VDIF
  13702. Display the average of sample value difference between all values of the V
  13703. plane in the current frame and corresponding values of the previous input frame.
  13704. Expressed in range of [0-255].
  13705. @item YBITDEPTH
  13706. Display bit depth of Y plane in current frame.
  13707. Expressed in range of [0-16].
  13708. @item UBITDEPTH
  13709. Display bit depth of U plane in current frame.
  13710. Expressed in range of [0-16].
  13711. @item VBITDEPTH
  13712. Display bit depth of V plane in current frame.
  13713. Expressed in range of [0-16].
  13714. @end table
  13715. The filter accepts the following options:
  13716. @table @option
  13717. @item stat
  13718. @item out
  13719. @option{stat} specify an additional form of image analysis.
  13720. @option{out} output video with the specified type of pixel highlighted.
  13721. Both options accept the following values:
  13722. @table @samp
  13723. @item tout
  13724. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13725. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13726. include the results of video dropouts, head clogs, or tape tracking issues.
  13727. @item vrep
  13728. Identify @var{vertical line repetition}. Vertical line repetition includes
  13729. similar rows of pixels within a frame. In born-digital video vertical line
  13730. repetition is common, but this pattern is uncommon in video digitized from an
  13731. analog source. When it occurs in video that results from the digitization of an
  13732. analog source it can indicate concealment from a dropout compensator.
  13733. @item brng
  13734. Identify pixels that fall outside of legal broadcast range.
  13735. @end table
  13736. @item color, c
  13737. Set the highlight color for the @option{out} option. The default color is
  13738. yellow.
  13739. @end table
  13740. @subsection Examples
  13741. @itemize
  13742. @item
  13743. Output data of various video metrics:
  13744. @example
  13745. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13746. @end example
  13747. @item
  13748. Output specific data about the minimum and maximum values of the Y plane per frame:
  13749. @example
  13750. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13751. @end example
  13752. @item
  13753. Playback video while highlighting pixels that are outside of broadcast range in red.
  13754. @example
  13755. ffplay example.mov -vf signalstats="out=brng:color=red"
  13756. @end example
  13757. @item
  13758. Playback video with signalstats metadata drawn over the frame.
  13759. @example
  13760. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13761. @end example
  13762. The contents of signalstat_drawtext.txt used in the command are:
  13763. @example
  13764. time %@{pts:hms@}
  13765. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13766. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13767. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13768. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13769. @end example
  13770. @end itemize
  13771. @anchor{signature}
  13772. @section signature
  13773. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13774. input. In this case the matching between the inputs can be calculated additionally.
  13775. The filter always passes through the first input. The signature of each stream can
  13776. be written into a file.
  13777. It accepts the following options:
  13778. @table @option
  13779. @item detectmode
  13780. Enable or disable the matching process.
  13781. Available values are:
  13782. @table @samp
  13783. @item off
  13784. Disable the calculation of a matching (default).
  13785. @item full
  13786. Calculate the matching for the whole video and output whether the whole video
  13787. matches or only parts.
  13788. @item fast
  13789. Calculate only until a matching is found or the video ends. Should be faster in
  13790. some cases.
  13791. @end table
  13792. @item nb_inputs
  13793. Set the number of inputs. The option value must be a non negative integer.
  13794. Default value is 1.
  13795. @item filename
  13796. Set the path to which the output is written. If there is more than one input,
  13797. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13798. integer), that will be replaced with the input number. If no filename is
  13799. specified, no output will be written. This is the default.
  13800. @item format
  13801. Choose the output format.
  13802. Available values are:
  13803. @table @samp
  13804. @item binary
  13805. Use the specified binary representation (default).
  13806. @item xml
  13807. Use the specified xml representation.
  13808. @end table
  13809. @item th_d
  13810. Set threshold to detect one word as similar. The option value must be an integer
  13811. greater than zero. The default value is 9000.
  13812. @item th_dc
  13813. Set threshold to detect all words as similar. The option value must be an integer
  13814. greater than zero. The default value is 60000.
  13815. @item th_xh
  13816. Set threshold to detect frames as similar. The option value must be an integer
  13817. greater than zero. The default value is 116.
  13818. @item th_di
  13819. Set the minimum length of a sequence in frames to recognize it as matching
  13820. sequence. The option value must be a non negative integer value.
  13821. The default value is 0.
  13822. @item th_it
  13823. Set the minimum relation, that matching frames to all frames must have.
  13824. The option value must be a double value between 0 and 1. The default value is 0.5.
  13825. @end table
  13826. @subsection Examples
  13827. @itemize
  13828. @item
  13829. To calculate the signature of an input video and store it in signature.bin:
  13830. @example
  13831. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13832. @end example
  13833. @item
  13834. To detect whether two videos match and store the signatures in XML format in
  13835. signature0.xml and signature1.xml:
  13836. @example
  13837. 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 -
  13838. @end example
  13839. @end itemize
  13840. @anchor{smartblur}
  13841. @section smartblur
  13842. Blur the input video without impacting the outlines.
  13843. It accepts the following options:
  13844. @table @option
  13845. @item luma_radius, lr
  13846. Set the luma radius. The option value must be a float number in
  13847. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13848. used to blur the image (slower if larger). Default value is 1.0.
  13849. @item luma_strength, ls
  13850. Set the luma strength. The option value must be a float number
  13851. in the range [-1.0,1.0] that configures the blurring. A value included
  13852. in [0.0,1.0] will blur the image whereas a value included in
  13853. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13854. @item luma_threshold, lt
  13855. Set the luma threshold used as a coefficient to determine
  13856. whether a pixel should be blurred or not. The option value must be an
  13857. integer in the range [-30,30]. A value of 0 will filter all the image,
  13858. a value included in [0,30] will filter flat areas and a value included
  13859. in [-30,0] will filter edges. Default value is 0.
  13860. @item chroma_radius, cr
  13861. Set the chroma radius. The option value must be a float number in
  13862. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13863. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13864. @item chroma_strength, cs
  13865. Set the chroma strength. The option value must be a float number
  13866. in the range [-1.0,1.0] that configures the blurring. A value included
  13867. in [0.0,1.0] will blur the image whereas a value included in
  13868. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13869. @item chroma_threshold, ct
  13870. Set the chroma threshold used as a coefficient to determine
  13871. whether a pixel should be blurred or not. The option value must be an
  13872. integer in the range [-30,30]. A value of 0 will filter all the image,
  13873. a value included in [0,30] will filter flat areas and a value included
  13874. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13875. @end table
  13876. If a chroma option is not explicitly set, the corresponding luma value
  13877. is set.
  13878. @section sobel
  13879. Apply sobel operator to input video stream.
  13880. The filter accepts the following option:
  13881. @table @option
  13882. @item planes
  13883. Set which planes will be processed, unprocessed planes will be copied.
  13884. By default value 0xf, all planes will be processed.
  13885. @item scale
  13886. Set value which will be multiplied with filtered result.
  13887. @item delta
  13888. Set value which will be added to filtered result.
  13889. @end table
  13890. @subsection Commands
  13891. This filter supports the all above options as @ref{commands}.
  13892. @anchor{spp}
  13893. @section spp
  13894. Apply a simple postprocessing filter that compresses and decompresses the image
  13895. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13896. and average the results.
  13897. The filter accepts the following options:
  13898. @table @option
  13899. @item quality
  13900. Set quality. This option defines the number of levels for averaging. It accepts
  13901. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13902. effect. A value of @code{6} means the higher quality. For each increment of
  13903. that value the speed drops by a factor of approximately 2. Default value is
  13904. @code{3}.
  13905. @item qp
  13906. Force a constant quantization parameter. If not set, the filter will use the QP
  13907. from the video stream (if available).
  13908. @item mode
  13909. Set thresholding mode. Available modes are:
  13910. @table @samp
  13911. @item hard
  13912. Set hard thresholding (default).
  13913. @item soft
  13914. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13915. @end table
  13916. @item use_bframe_qp
  13917. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13918. option may cause flicker since the B-Frames have often larger QP. Default is
  13919. @code{0} (not enabled).
  13920. @end table
  13921. @subsection Commands
  13922. This filter supports the following commands:
  13923. @table @option
  13924. @item quality, level
  13925. Set quality level. The value @code{max} can be used to set the maximum level,
  13926. currently @code{6}.
  13927. @end table
  13928. @anchor{sr}
  13929. @section sr
  13930. Scale the input by applying one of the super-resolution methods based on
  13931. convolutional neural networks. Supported models:
  13932. @itemize
  13933. @item
  13934. Super-Resolution Convolutional Neural Network model (SRCNN).
  13935. See @url{https://arxiv.org/abs/1501.00092}.
  13936. @item
  13937. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13938. See @url{https://arxiv.org/abs/1609.05158}.
  13939. @end itemize
  13940. Training scripts as well as scripts for model file (.pb) saving can be found at
  13941. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13942. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13943. Native model files (.model) can be generated from TensorFlow model
  13944. files (.pb) by using tools/python/convert.py
  13945. The filter accepts the following options:
  13946. @table @option
  13947. @item dnn_backend
  13948. Specify which DNN backend to use for model loading and execution. This option accepts
  13949. the following values:
  13950. @table @samp
  13951. @item native
  13952. Native implementation of DNN loading and execution.
  13953. @item tensorflow
  13954. TensorFlow backend. To enable this backend you
  13955. need to install the TensorFlow for C library (see
  13956. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13957. @code{--enable-libtensorflow}
  13958. @end table
  13959. Default value is @samp{native}.
  13960. @item model
  13961. Set path to model file specifying network architecture and its parameters.
  13962. Note that different backends use different file formats. TensorFlow backend
  13963. can load files for both formats, while native backend can load files for only
  13964. its format.
  13965. @item scale_factor
  13966. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13967. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13968. input upscaled using bicubic upscaling with proper scale factor.
  13969. @end table
  13970. This feature can also be finished with @ref{dnn_processing} filter.
  13971. @section ssim
  13972. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13973. This filter takes in input two input videos, the first input is
  13974. considered the "main" source and is passed unchanged to the
  13975. output. The second input is used as a "reference" video for computing
  13976. the SSIM.
  13977. Both video inputs must have the same resolution and pixel format for
  13978. this filter to work correctly. Also it assumes that both inputs
  13979. have the same number of frames, which are compared one by one.
  13980. The filter stores the calculated SSIM of each frame.
  13981. The description of the accepted parameters follows.
  13982. @table @option
  13983. @item stats_file, f
  13984. If specified the filter will use the named file to save the SSIM of
  13985. each individual frame. When filename equals "-" the data is sent to
  13986. standard output.
  13987. @end table
  13988. The file printed if @var{stats_file} is selected, contains a sequence of
  13989. key/value pairs of the form @var{key}:@var{value} for each compared
  13990. couple of frames.
  13991. A description of each shown parameter follows:
  13992. @table @option
  13993. @item n
  13994. sequential number of the input frame, starting from 1
  13995. @item Y, U, V, R, G, B
  13996. SSIM of the compared frames for the component specified by the suffix.
  13997. @item All
  13998. SSIM of the compared frames for the whole frame.
  13999. @item dB
  14000. Same as above but in dB representation.
  14001. @end table
  14002. This filter also supports the @ref{framesync} options.
  14003. @subsection Examples
  14004. @itemize
  14005. @item
  14006. For example:
  14007. @example
  14008. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  14009. [main][ref] ssim="stats_file=stats.log" [out]
  14010. @end example
  14011. On this example the input file being processed is compared with the
  14012. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  14013. is stored in @file{stats.log}.
  14014. @item
  14015. Another example with both psnr and ssim at same time:
  14016. @example
  14017. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  14018. @end example
  14019. @item
  14020. Another example with different containers:
  14021. @example
  14022. 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 -
  14023. @end example
  14024. @end itemize
  14025. @section stereo3d
  14026. Convert between different stereoscopic image formats.
  14027. The filters accept the following options:
  14028. @table @option
  14029. @item in
  14030. Set stereoscopic image format of input.
  14031. Available values for input image formats are:
  14032. @table @samp
  14033. @item sbsl
  14034. side by side parallel (left eye left, right eye right)
  14035. @item sbsr
  14036. side by side crosseye (right eye left, left eye right)
  14037. @item sbs2l
  14038. side by side parallel with half width resolution
  14039. (left eye left, right eye right)
  14040. @item sbs2r
  14041. side by side crosseye with half width resolution
  14042. (right eye left, left eye right)
  14043. @item abl
  14044. @item tbl
  14045. above-below (left eye above, right eye below)
  14046. @item abr
  14047. @item tbr
  14048. above-below (right eye above, left eye below)
  14049. @item ab2l
  14050. @item tb2l
  14051. above-below with half height resolution
  14052. (left eye above, right eye below)
  14053. @item ab2r
  14054. @item tb2r
  14055. above-below with half height resolution
  14056. (right eye above, left eye below)
  14057. @item al
  14058. alternating frames (left eye first, right eye second)
  14059. @item ar
  14060. alternating frames (right eye first, left eye second)
  14061. @item irl
  14062. interleaved rows (left eye has top row, right eye starts on next row)
  14063. @item irr
  14064. interleaved rows (right eye has top row, left eye starts on next row)
  14065. @item icl
  14066. interleaved columns, left eye first
  14067. @item icr
  14068. interleaved columns, right eye first
  14069. Default value is @samp{sbsl}.
  14070. @end table
  14071. @item out
  14072. Set stereoscopic image format of output.
  14073. @table @samp
  14074. @item sbsl
  14075. side by side parallel (left eye left, right eye right)
  14076. @item sbsr
  14077. side by side crosseye (right eye left, left eye right)
  14078. @item sbs2l
  14079. side by side parallel with half width resolution
  14080. (left eye left, right eye right)
  14081. @item sbs2r
  14082. side by side crosseye with half width resolution
  14083. (right eye left, left eye right)
  14084. @item abl
  14085. @item tbl
  14086. above-below (left eye above, right eye below)
  14087. @item abr
  14088. @item tbr
  14089. above-below (right eye above, left eye below)
  14090. @item ab2l
  14091. @item tb2l
  14092. above-below with half height resolution
  14093. (left eye above, right eye below)
  14094. @item ab2r
  14095. @item tb2r
  14096. above-below with half height resolution
  14097. (right eye above, left eye below)
  14098. @item al
  14099. alternating frames (left eye first, right eye second)
  14100. @item ar
  14101. alternating frames (right eye first, left eye second)
  14102. @item irl
  14103. interleaved rows (left eye has top row, right eye starts on next row)
  14104. @item irr
  14105. interleaved rows (right eye has top row, left eye starts on next row)
  14106. @item arbg
  14107. anaglyph red/blue gray
  14108. (red filter on left eye, blue filter on right eye)
  14109. @item argg
  14110. anaglyph red/green gray
  14111. (red filter on left eye, green filter on right eye)
  14112. @item arcg
  14113. anaglyph red/cyan gray
  14114. (red filter on left eye, cyan filter on right eye)
  14115. @item arch
  14116. anaglyph red/cyan half colored
  14117. (red filter on left eye, cyan filter on right eye)
  14118. @item arcc
  14119. anaglyph red/cyan color
  14120. (red filter on left eye, cyan filter on right eye)
  14121. @item arcd
  14122. anaglyph red/cyan color optimized with the least squares projection of dubois
  14123. (red filter on left eye, cyan filter on right eye)
  14124. @item agmg
  14125. anaglyph green/magenta gray
  14126. (green filter on left eye, magenta filter on right eye)
  14127. @item agmh
  14128. anaglyph green/magenta half colored
  14129. (green filter on left eye, magenta filter on right eye)
  14130. @item agmc
  14131. anaglyph green/magenta colored
  14132. (green filter on left eye, magenta filter on right eye)
  14133. @item agmd
  14134. anaglyph green/magenta color optimized with the least squares projection of dubois
  14135. (green filter on left eye, magenta filter on right eye)
  14136. @item aybg
  14137. anaglyph yellow/blue gray
  14138. (yellow filter on left eye, blue filter on right eye)
  14139. @item aybh
  14140. anaglyph yellow/blue half colored
  14141. (yellow filter on left eye, blue filter on right eye)
  14142. @item aybc
  14143. anaglyph yellow/blue colored
  14144. (yellow filter on left eye, blue filter on right eye)
  14145. @item aybd
  14146. anaglyph yellow/blue color optimized with the least squares projection of dubois
  14147. (yellow filter on left eye, blue filter on right eye)
  14148. @item ml
  14149. mono output (left eye only)
  14150. @item mr
  14151. mono output (right eye only)
  14152. @item chl
  14153. checkerboard, left eye first
  14154. @item chr
  14155. checkerboard, right eye first
  14156. @item icl
  14157. interleaved columns, left eye first
  14158. @item icr
  14159. interleaved columns, right eye first
  14160. @item hdmi
  14161. HDMI frame pack
  14162. @end table
  14163. Default value is @samp{arcd}.
  14164. @end table
  14165. @subsection Examples
  14166. @itemize
  14167. @item
  14168. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  14169. @example
  14170. stereo3d=sbsl:aybd
  14171. @end example
  14172. @item
  14173. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  14174. @example
  14175. stereo3d=abl:sbsr
  14176. @end example
  14177. @end itemize
  14178. @section streamselect, astreamselect
  14179. Select video or audio streams.
  14180. The filter accepts the following options:
  14181. @table @option
  14182. @item inputs
  14183. Set number of inputs. Default is 2.
  14184. @item map
  14185. Set input indexes to remap to outputs.
  14186. @end table
  14187. @subsection Commands
  14188. The @code{streamselect} and @code{astreamselect} filter supports the following
  14189. commands:
  14190. @table @option
  14191. @item map
  14192. Set input indexes to remap to outputs.
  14193. @end table
  14194. @subsection Examples
  14195. @itemize
  14196. @item
  14197. Select first 5 seconds 1st stream and rest of time 2nd stream:
  14198. @example
  14199. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  14200. @end example
  14201. @item
  14202. Same as above, but for audio:
  14203. @example
  14204. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  14205. @end example
  14206. @end itemize
  14207. @anchor{subtitles}
  14208. @section subtitles
  14209. Draw subtitles on top of input video using the libass library.
  14210. To enable compilation of this filter you need to configure FFmpeg with
  14211. @code{--enable-libass}. This filter also requires a build with libavcodec and
  14212. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  14213. Alpha) subtitles format.
  14214. The filter accepts the following options:
  14215. @table @option
  14216. @item filename, f
  14217. Set the filename of the subtitle file to read. It must be specified.
  14218. @item original_size
  14219. Specify the size of the original video, the video for which the ASS file
  14220. was composed. For the syntax of this option, check the
  14221. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14222. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  14223. correctly scale the fonts if the aspect ratio has been changed.
  14224. @item fontsdir
  14225. Set a directory path containing fonts that can be used by the filter.
  14226. These fonts will be used in addition to whatever the font provider uses.
  14227. @item alpha
  14228. Process alpha channel, by default alpha channel is untouched.
  14229. @item charenc
  14230. Set subtitles input character encoding. @code{subtitles} filter only. Only
  14231. useful if not UTF-8.
  14232. @item stream_index, si
  14233. Set subtitles stream index. @code{subtitles} filter only.
  14234. @item force_style
  14235. Override default style or script info parameters of the subtitles. It accepts a
  14236. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  14237. @end table
  14238. If the first key is not specified, it is assumed that the first value
  14239. specifies the @option{filename}.
  14240. For example, to render the file @file{sub.srt} on top of the input
  14241. video, use the command:
  14242. @example
  14243. subtitles=sub.srt
  14244. @end example
  14245. which is equivalent to:
  14246. @example
  14247. subtitles=filename=sub.srt
  14248. @end example
  14249. To render the default subtitles stream from file @file{video.mkv}, use:
  14250. @example
  14251. subtitles=video.mkv
  14252. @end example
  14253. To render the second subtitles stream from that file, use:
  14254. @example
  14255. subtitles=video.mkv:si=1
  14256. @end example
  14257. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  14258. @code{DejaVu Serif}, use:
  14259. @example
  14260. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  14261. @end example
  14262. @section super2xsai
  14263. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  14264. Interpolate) pixel art scaling algorithm.
  14265. Useful for enlarging pixel art images without reducing sharpness.
  14266. @section swaprect
  14267. Swap two rectangular objects in video.
  14268. This filter accepts the following options:
  14269. @table @option
  14270. @item w
  14271. Set object width.
  14272. @item h
  14273. Set object height.
  14274. @item x1
  14275. Set 1st rect x coordinate.
  14276. @item y1
  14277. Set 1st rect y coordinate.
  14278. @item x2
  14279. Set 2nd rect x coordinate.
  14280. @item y2
  14281. Set 2nd rect y coordinate.
  14282. All expressions are evaluated once for each frame.
  14283. @end table
  14284. The all options are expressions containing the following constants:
  14285. @table @option
  14286. @item w
  14287. @item h
  14288. The input width and height.
  14289. @item a
  14290. same as @var{w} / @var{h}
  14291. @item sar
  14292. input sample aspect ratio
  14293. @item dar
  14294. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  14295. @item n
  14296. The number of the input frame, starting from 0.
  14297. @item t
  14298. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  14299. @item pos
  14300. the position in the file of the input frame, NAN if unknown
  14301. @end table
  14302. @section swapuv
  14303. Swap U & V plane.
  14304. @section tblend
  14305. Blend successive video frames.
  14306. See @ref{blend}
  14307. @section telecine
  14308. Apply telecine process to the video.
  14309. This filter accepts the following options:
  14310. @table @option
  14311. @item first_field
  14312. @table @samp
  14313. @item top, t
  14314. top field first
  14315. @item bottom, b
  14316. bottom field first
  14317. The default value is @code{top}.
  14318. @end table
  14319. @item pattern
  14320. A string of numbers representing the pulldown pattern you wish to apply.
  14321. The default value is @code{23}.
  14322. @end table
  14323. @example
  14324. Some typical patterns:
  14325. NTSC output (30i):
  14326. 27.5p: 32222
  14327. 24p: 23 (classic)
  14328. 24p: 2332 (preferred)
  14329. 20p: 33
  14330. 18p: 334
  14331. 16p: 3444
  14332. PAL output (25i):
  14333. 27.5p: 12222
  14334. 24p: 222222222223 ("Euro pulldown")
  14335. 16.67p: 33
  14336. 16p: 33333334
  14337. @end example
  14338. @section thistogram
  14339. Compute and draw a color distribution histogram for the input video across time.
  14340. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  14341. at certain time, this filter shows also past histograms of number of frames defined
  14342. by @code{width} option.
  14343. The computed histogram is a representation of the color component
  14344. distribution in an image.
  14345. The filter accepts the following options:
  14346. @table @option
  14347. @item width, w
  14348. Set width of single color component output. Default value is @code{0}.
  14349. Value of @code{0} means width will be picked from input video.
  14350. This also set number of passed histograms to keep.
  14351. Allowed range is [0, 8192].
  14352. @item display_mode, d
  14353. Set display mode.
  14354. It accepts the following values:
  14355. @table @samp
  14356. @item stack
  14357. Per color component graphs are placed below each other.
  14358. @item parade
  14359. Per color component graphs are placed side by side.
  14360. @item overlay
  14361. Presents information identical to that in the @code{parade}, except
  14362. that the graphs representing color components are superimposed directly
  14363. over one another.
  14364. @end table
  14365. Default is @code{stack}.
  14366. @item levels_mode, m
  14367. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  14368. Default is @code{linear}.
  14369. @item components, c
  14370. Set what color components to display.
  14371. Default is @code{7}.
  14372. @item bgopacity, b
  14373. Set background opacity. Default is @code{0.9}.
  14374. @item envelope, e
  14375. Show envelope. Default is disabled.
  14376. @item ecolor, ec
  14377. Set envelope color. Default is @code{gold}.
  14378. @item slide
  14379. Set slide mode.
  14380. Available values for slide is:
  14381. @table @samp
  14382. @item frame
  14383. Draw new frame when right border is reached.
  14384. @item replace
  14385. Replace old columns with new ones.
  14386. @item scroll
  14387. Scroll from right to left.
  14388. @item rscroll
  14389. Scroll from left to right.
  14390. @item picture
  14391. Draw single picture.
  14392. @end table
  14393. Default is @code{replace}.
  14394. @end table
  14395. @section threshold
  14396. Apply threshold effect to video stream.
  14397. This filter needs four video streams to perform thresholding.
  14398. First stream is stream we are filtering.
  14399. Second stream is holding threshold values, third stream is holding min values,
  14400. and last, fourth stream is holding max values.
  14401. The filter accepts the following option:
  14402. @table @option
  14403. @item planes
  14404. Set which planes will be processed, unprocessed planes will be copied.
  14405. By default value 0xf, all planes will be processed.
  14406. @end table
  14407. For example if first stream pixel's component value is less then threshold value
  14408. of pixel component from 2nd threshold stream, third stream value will picked,
  14409. otherwise fourth stream pixel component value will be picked.
  14410. Using color source filter one can perform various types of thresholding:
  14411. @subsection Examples
  14412. @itemize
  14413. @item
  14414. Binary threshold, using gray color as threshold:
  14415. @example
  14416. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  14417. @end example
  14418. @item
  14419. Inverted binary threshold, using gray color as threshold:
  14420. @example
  14421. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  14422. @end example
  14423. @item
  14424. Truncate binary threshold, using gray color as threshold:
  14425. @example
  14426. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14427. @end example
  14428. @item
  14429. Threshold to zero, using gray color as threshold:
  14430. @example
  14431. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14432. @end example
  14433. @item
  14434. Inverted threshold to zero, using gray color as threshold:
  14435. @example
  14436. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14437. @end example
  14438. @end itemize
  14439. @section thumbnail
  14440. Select the most representative frame in a given sequence of consecutive frames.
  14441. The filter accepts the following options:
  14442. @table @option
  14443. @item n
  14444. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14445. will pick one of them, and then handle the next batch of @var{n} frames until
  14446. the end. Default is @code{100}.
  14447. @end table
  14448. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14449. value will result in a higher memory usage, so a high value is not recommended.
  14450. @subsection Examples
  14451. @itemize
  14452. @item
  14453. Extract one picture each 50 frames:
  14454. @example
  14455. thumbnail=50
  14456. @end example
  14457. @item
  14458. Complete example of a thumbnail creation with @command{ffmpeg}:
  14459. @example
  14460. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14461. @end example
  14462. @end itemize
  14463. @anchor{tile}
  14464. @section tile
  14465. Tile several successive frames together.
  14466. The @ref{untile} filter can do the reverse.
  14467. The filter accepts the following options:
  14468. @table @option
  14469. @item layout
  14470. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14471. this option, check the
  14472. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14473. @item nb_frames
  14474. Set the maximum number of frames to render in the given area. It must be less
  14475. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14476. the area will be used.
  14477. @item margin
  14478. Set the outer border margin in pixels.
  14479. @item padding
  14480. Set the inner border thickness (i.e. the number of pixels between frames). For
  14481. more advanced padding options (such as having different values for the edges),
  14482. refer to the pad video filter.
  14483. @item color
  14484. Specify the color of the unused area. For the syntax of this option, check the
  14485. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14486. The default value of @var{color} is "black".
  14487. @item overlap
  14488. Set the number of frames to overlap when tiling several successive frames together.
  14489. The value must be between @code{0} and @var{nb_frames - 1}.
  14490. @item init_padding
  14491. Set the number of frames to initially be empty before displaying first output frame.
  14492. This controls how soon will one get first output frame.
  14493. The value must be between @code{0} and @var{nb_frames - 1}.
  14494. @end table
  14495. @subsection Examples
  14496. @itemize
  14497. @item
  14498. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14499. @example
  14500. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14501. @end example
  14502. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14503. duplicating each output frame to accommodate the originally detected frame
  14504. rate.
  14505. @item
  14506. Display @code{5} pictures in an area of @code{3x2} frames,
  14507. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14508. mixed flat and named options:
  14509. @example
  14510. tile=3x2:nb_frames=5:padding=7:margin=2
  14511. @end example
  14512. @end itemize
  14513. @section tinterlace
  14514. Perform various types of temporal field interlacing.
  14515. Frames are counted starting from 1, so the first input frame is
  14516. considered odd.
  14517. The filter accepts the following options:
  14518. @table @option
  14519. @item mode
  14520. Specify the mode of the interlacing. This option can also be specified
  14521. as a value alone. See below for a list of values for this option.
  14522. Available values are:
  14523. @table @samp
  14524. @item merge, 0
  14525. Move odd frames into the upper field, even into the lower field,
  14526. generating a double height frame at half frame rate.
  14527. @example
  14528. ------> time
  14529. Input:
  14530. Frame 1 Frame 2 Frame 3 Frame 4
  14531. 11111 22222 33333 44444
  14532. 11111 22222 33333 44444
  14533. 11111 22222 33333 44444
  14534. 11111 22222 33333 44444
  14535. Output:
  14536. 11111 33333
  14537. 22222 44444
  14538. 11111 33333
  14539. 22222 44444
  14540. 11111 33333
  14541. 22222 44444
  14542. 11111 33333
  14543. 22222 44444
  14544. @end example
  14545. @item drop_even, 1
  14546. Only output odd frames, even frames are dropped, generating a frame with
  14547. unchanged height at half frame rate.
  14548. @example
  14549. ------> time
  14550. Input:
  14551. Frame 1 Frame 2 Frame 3 Frame 4
  14552. 11111 22222 33333 44444
  14553. 11111 22222 33333 44444
  14554. 11111 22222 33333 44444
  14555. 11111 22222 33333 44444
  14556. Output:
  14557. 11111 33333
  14558. 11111 33333
  14559. 11111 33333
  14560. 11111 33333
  14561. @end example
  14562. @item drop_odd, 2
  14563. Only output even frames, odd frames are dropped, generating a frame with
  14564. unchanged height at half frame rate.
  14565. @example
  14566. ------> time
  14567. Input:
  14568. Frame 1 Frame 2 Frame 3 Frame 4
  14569. 11111 22222 33333 44444
  14570. 11111 22222 33333 44444
  14571. 11111 22222 33333 44444
  14572. 11111 22222 33333 44444
  14573. Output:
  14574. 22222 44444
  14575. 22222 44444
  14576. 22222 44444
  14577. 22222 44444
  14578. @end example
  14579. @item pad, 3
  14580. Expand each frame to full height, but pad alternate lines with black,
  14581. generating a frame with double height at the same input frame rate.
  14582. @example
  14583. ------> time
  14584. Input:
  14585. Frame 1 Frame 2 Frame 3 Frame 4
  14586. 11111 22222 33333 44444
  14587. 11111 22222 33333 44444
  14588. 11111 22222 33333 44444
  14589. 11111 22222 33333 44444
  14590. Output:
  14591. 11111 ..... 33333 .....
  14592. ..... 22222 ..... 44444
  14593. 11111 ..... 33333 .....
  14594. ..... 22222 ..... 44444
  14595. 11111 ..... 33333 .....
  14596. ..... 22222 ..... 44444
  14597. 11111 ..... 33333 .....
  14598. ..... 22222 ..... 44444
  14599. @end example
  14600. @item interleave_top, 4
  14601. Interleave the upper field from odd frames with the lower field from
  14602. even frames, generating a frame with unchanged height at half frame rate.
  14603. @example
  14604. ------> time
  14605. Input:
  14606. Frame 1 Frame 2 Frame 3 Frame 4
  14607. 11111<- 22222 33333<- 44444
  14608. 11111 22222<- 33333 44444<-
  14609. 11111<- 22222 33333<- 44444
  14610. 11111 22222<- 33333 44444<-
  14611. Output:
  14612. 11111 33333
  14613. 22222 44444
  14614. 11111 33333
  14615. 22222 44444
  14616. @end example
  14617. @item interleave_bottom, 5
  14618. Interleave the lower field from odd frames with the upper field from
  14619. even frames, generating a frame with unchanged height at half frame rate.
  14620. @example
  14621. ------> time
  14622. Input:
  14623. Frame 1 Frame 2 Frame 3 Frame 4
  14624. 11111 22222<- 33333 44444<-
  14625. 11111<- 22222 33333<- 44444
  14626. 11111 22222<- 33333 44444<-
  14627. 11111<- 22222 33333<- 44444
  14628. Output:
  14629. 22222 44444
  14630. 11111 33333
  14631. 22222 44444
  14632. 11111 33333
  14633. @end example
  14634. @item interlacex2, 6
  14635. Double frame rate with unchanged height. Frames are inserted each
  14636. containing the second temporal field from the previous input frame and
  14637. the first temporal field from the next input frame. This mode relies on
  14638. the top_field_first flag. Useful for interlaced video displays with no
  14639. field synchronisation.
  14640. @example
  14641. ------> time
  14642. Input:
  14643. Frame 1 Frame 2 Frame 3 Frame 4
  14644. 11111 22222 33333 44444
  14645. 11111 22222 33333 44444
  14646. 11111 22222 33333 44444
  14647. 11111 22222 33333 44444
  14648. Output:
  14649. 11111 22222 22222 33333 33333 44444 44444
  14650. 11111 11111 22222 22222 33333 33333 44444
  14651. 11111 22222 22222 33333 33333 44444 44444
  14652. 11111 11111 22222 22222 33333 33333 44444
  14653. @end example
  14654. @item mergex2, 7
  14655. Move odd frames into the upper field, even into the lower field,
  14656. generating a double height frame at same frame rate.
  14657. @example
  14658. ------> time
  14659. Input:
  14660. Frame 1 Frame 2 Frame 3 Frame 4
  14661. 11111 22222 33333 44444
  14662. 11111 22222 33333 44444
  14663. 11111 22222 33333 44444
  14664. 11111 22222 33333 44444
  14665. Output:
  14666. 11111 33333 33333 55555
  14667. 22222 22222 44444 44444
  14668. 11111 33333 33333 55555
  14669. 22222 22222 44444 44444
  14670. 11111 33333 33333 55555
  14671. 22222 22222 44444 44444
  14672. 11111 33333 33333 55555
  14673. 22222 22222 44444 44444
  14674. @end example
  14675. @end table
  14676. Numeric values are deprecated but are accepted for backward
  14677. compatibility reasons.
  14678. Default mode is @code{merge}.
  14679. @item flags
  14680. Specify flags influencing the filter process.
  14681. Available value for @var{flags} is:
  14682. @table @option
  14683. @item low_pass_filter, vlpf
  14684. Enable linear vertical low-pass filtering in the filter.
  14685. Vertical low-pass filtering is required when creating an interlaced
  14686. destination from a progressive source which contains high-frequency
  14687. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14688. patterning.
  14689. @item complex_filter, cvlpf
  14690. Enable complex vertical low-pass filtering.
  14691. This will slightly less reduce interlace 'twitter' and Moire
  14692. patterning but better retain detail and subjective sharpness impression.
  14693. @item bypass_il
  14694. Bypass already interlaced frames, only adjust the frame rate.
  14695. @end table
  14696. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14697. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14698. @end table
  14699. @section tmedian
  14700. Pick median pixels from several successive input video frames.
  14701. The filter accepts the following options:
  14702. @table @option
  14703. @item radius
  14704. Set radius of median filter.
  14705. Default is 1. Allowed range is from 1 to 127.
  14706. @item planes
  14707. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14708. @item percentile
  14709. Set median percentile. Default value is @code{0.5}.
  14710. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14711. minimum values, and @code{1} maximum values.
  14712. @end table
  14713. @subsection Commands
  14714. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  14715. @section tmidequalizer
  14716. Apply Temporal Midway Video Equalization effect.
  14717. Midway Video Equalization adjusts a sequence of video frames to have the same
  14718. histograms, while maintaining their dynamics as much as possible. It's
  14719. useful for e.g. matching exposures from a video frames sequence.
  14720. This filter accepts the following option:
  14721. @table @option
  14722. @item radius
  14723. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  14724. @item sigma
  14725. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  14726. Setting this option to 0 effectively does nothing.
  14727. @item planes
  14728. Set which planes to process. Default is @code{15}, which is all available planes.
  14729. @end table
  14730. @section tmix
  14731. Mix successive video frames.
  14732. A description of the accepted options follows.
  14733. @table @option
  14734. @item frames
  14735. The number of successive frames to mix. If unspecified, it defaults to 3.
  14736. @item weights
  14737. Specify weight of each input video frame.
  14738. Each weight is separated by space. If number of weights is smaller than
  14739. number of @var{frames} last specified weight will be used for all remaining
  14740. unset weights.
  14741. @item scale
  14742. Specify scale, if it is set it will be multiplied with sum
  14743. of each weight multiplied with pixel values to give final destination
  14744. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14745. @end table
  14746. @subsection Examples
  14747. @itemize
  14748. @item
  14749. Average 7 successive frames:
  14750. @example
  14751. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14752. @end example
  14753. @item
  14754. Apply simple temporal convolution:
  14755. @example
  14756. tmix=frames=3:weights="-1 3 -1"
  14757. @end example
  14758. @item
  14759. Similar as above but only showing temporal differences:
  14760. @example
  14761. tmix=frames=3:weights="-1 2 -1":scale=1
  14762. @end example
  14763. @end itemize
  14764. @anchor{tonemap}
  14765. @section tonemap
  14766. Tone map colors from different dynamic ranges.
  14767. This filter expects data in single precision floating point, as it needs to
  14768. operate on (and can output) out-of-range values. Another filter, such as
  14769. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14770. The tonemapping algorithms implemented only work on linear light, so input
  14771. data should be linearized beforehand (and possibly correctly tagged).
  14772. @example
  14773. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14774. @end example
  14775. @subsection Options
  14776. The filter accepts the following options.
  14777. @table @option
  14778. @item tonemap
  14779. Set the tone map algorithm to use.
  14780. Possible values are:
  14781. @table @var
  14782. @item none
  14783. Do not apply any tone map, only desaturate overbright pixels.
  14784. @item clip
  14785. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14786. in-range values, while distorting out-of-range values.
  14787. @item linear
  14788. Stretch the entire reference gamut to a linear multiple of the display.
  14789. @item gamma
  14790. Fit a logarithmic transfer between the tone curves.
  14791. @item reinhard
  14792. Preserve overall image brightness with a simple curve, using nonlinear
  14793. contrast, which results in flattening details and degrading color accuracy.
  14794. @item hable
  14795. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14796. of slightly darkening everything. Use it when detail preservation is more
  14797. important than color and brightness accuracy.
  14798. @item mobius
  14799. Smoothly map out-of-range values, while retaining contrast and colors for
  14800. in-range material as much as possible. Use it when color accuracy is more
  14801. important than detail preservation.
  14802. @end table
  14803. Default is none.
  14804. @item param
  14805. Tune the tone mapping algorithm.
  14806. This affects the following algorithms:
  14807. @table @var
  14808. @item none
  14809. Ignored.
  14810. @item linear
  14811. Specifies the scale factor to use while stretching.
  14812. Default to 1.0.
  14813. @item gamma
  14814. Specifies the exponent of the function.
  14815. Default to 1.8.
  14816. @item clip
  14817. Specify an extra linear coefficient to multiply into the signal before clipping.
  14818. Default to 1.0.
  14819. @item reinhard
  14820. Specify the local contrast coefficient at the display peak.
  14821. Default to 0.5, which means that in-gamut values will be about half as bright
  14822. as when clipping.
  14823. @item hable
  14824. Ignored.
  14825. @item mobius
  14826. Specify the transition point from linear to mobius transform. Every value
  14827. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14828. more accurate the result will be, at the cost of losing bright details.
  14829. Default to 0.3, which due to the steep initial slope still preserves in-range
  14830. colors fairly accurately.
  14831. @end table
  14832. @item desat
  14833. Apply desaturation for highlights that exceed this level of brightness. The
  14834. higher the parameter, the more color information will be preserved. This
  14835. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14836. (smoothly) turning into white instead. This makes images feel more natural,
  14837. at the cost of reducing information about out-of-range colors.
  14838. The default of 2.0 is somewhat conservative and will mostly just apply to
  14839. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14840. This option works only if the input frame has a supported color tag.
  14841. @item peak
  14842. Override signal/nominal/reference peak with this value. Useful when the
  14843. embedded peak information in display metadata is not reliable or when tone
  14844. mapping from a lower range to a higher range.
  14845. @end table
  14846. @section tpad
  14847. Temporarily pad video frames.
  14848. The filter accepts the following options:
  14849. @table @option
  14850. @item start
  14851. Specify number of delay frames before input video stream. Default is 0.
  14852. @item stop
  14853. Specify number of padding frames after input video stream.
  14854. Set to -1 to pad indefinitely. Default is 0.
  14855. @item start_mode
  14856. Set kind of frames added to beginning of stream.
  14857. Can be either @var{add} or @var{clone}.
  14858. With @var{add} frames of solid-color are added.
  14859. With @var{clone} frames are clones of first frame.
  14860. Default is @var{add}.
  14861. @item stop_mode
  14862. Set kind of frames added to end of stream.
  14863. Can be either @var{add} or @var{clone}.
  14864. With @var{add} frames of solid-color are added.
  14865. With @var{clone} frames are clones of last frame.
  14866. Default is @var{add}.
  14867. @item start_duration, stop_duration
  14868. Specify the duration of the start/stop delay. See
  14869. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14870. for the accepted syntax.
  14871. These options override @var{start} and @var{stop}. Default is 0.
  14872. @item color
  14873. Specify the color of the padded area. For the syntax of this option,
  14874. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14875. manual,ffmpeg-utils}.
  14876. The default value of @var{color} is "black".
  14877. @end table
  14878. @anchor{transpose}
  14879. @section transpose
  14880. Transpose rows with columns in the input video and optionally flip it.
  14881. It accepts the following parameters:
  14882. @table @option
  14883. @item dir
  14884. Specify the transposition direction.
  14885. Can assume the following values:
  14886. @table @samp
  14887. @item 0, 4, cclock_flip
  14888. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14889. @example
  14890. L.R L.l
  14891. . . -> . .
  14892. l.r R.r
  14893. @end example
  14894. @item 1, 5, clock
  14895. Rotate by 90 degrees clockwise, that is:
  14896. @example
  14897. L.R l.L
  14898. . . -> . .
  14899. l.r r.R
  14900. @end example
  14901. @item 2, 6, cclock
  14902. Rotate by 90 degrees counterclockwise, that is:
  14903. @example
  14904. L.R R.r
  14905. . . -> . .
  14906. l.r L.l
  14907. @end example
  14908. @item 3, 7, clock_flip
  14909. Rotate by 90 degrees clockwise and vertically flip, that is:
  14910. @example
  14911. L.R r.R
  14912. . . -> . .
  14913. l.r l.L
  14914. @end example
  14915. @end table
  14916. For values between 4-7, the transposition is only done if the input
  14917. video geometry is portrait and not landscape. These values are
  14918. deprecated, the @code{passthrough} option should be used instead.
  14919. Numerical values are deprecated, and should be dropped in favor of
  14920. symbolic constants.
  14921. @item passthrough
  14922. Do not apply the transposition if the input geometry matches the one
  14923. specified by the specified value. It accepts the following values:
  14924. @table @samp
  14925. @item none
  14926. Always apply transposition.
  14927. @item portrait
  14928. Preserve portrait geometry (when @var{height} >= @var{width}).
  14929. @item landscape
  14930. Preserve landscape geometry (when @var{width} >= @var{height}).
  14931. @end table
  14932. Default value is @code{none}.
  14933. @end table
  14934. For example to rotate by 90 degrees clockwise and preserve portrait
  14935. layout:
  14936. @example
  14937. transpose=dir=1:passthrough=portrait
  14938. @end example
  14939. The command above can also be specified as:
  14940. @example
  14941. transpose=1:portrait
  14942. @end example
  14943. @section transpose_npp
  14944. Transpose rows with columns in the input video and optionally flip it.
  14945. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14946. It accepts the following parameters:
  14947. @table @option
  14948. @item dir
  14949. Specify the transposition direction.
  14950. Can assume the following values:
  14951. @table @samp
  14952. @item cclock_flip
  14953. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14954. @item clock
  14955. Rotate by 90 degrees clockwise.
  14956. @item cclock
  14957. Rotate by 90 degrees counterclockwise.
  14958. @item clock_flip
  14959. Rotate by 90 degrees clockwise and vertically flip.
  14960. @end table
  14961. @item passthrough
  14962. Do not apply the transposition if the input geometry matches the one
  14963. specified by the specified value. It accepts the following values:
  14964. @table @samp
  14965. @item none
  14966. Always apply transposition. (default)
  14967. @item portrait
  14968. Preserve portrait geometry (when @var{height} >= @var{width}).
  14969. @item landscape
  14970. Preserve landscape geometry (when @var{width} >= @var{height}).
  14971. @end table
  14972. @end table
  14973. @section trim
  14974. Trim the input so that the output contains one continuous subpart of the input.
  14975. It accepts the following parameters:
  14976. @table @option
  14977. @item start
  14978. Specify the time of the start of the kept section, i.e. the frame with the
  14979. timestamp @var{start} will be the first frame in the output.
  14980. @item end
  14981. Specify the time of the first frame that will be dropped, i.e. the frame
  14982. immediately preceding the one with the timestamp @var{end} will be the last
  14983. frame in the output.
  14984. @item start_pts
  14985. This is the same as @var{start}, except this option sets the start timestamp
  14986. in timebase units instead of seconds.
  14987. @item end_pts
  14988. This is the same as @var{end}, except this option sets the end timestamp
  14989. in timebase units instead of seconds.
  14990. @item duration
  14991. The maximum duration of the output in seconds.
  14992. @item start_frame
  14993. The number of the first frame that should be passed to the output.
  14994. @item end_frame
  14995. The number of the first frame that should be dropped.
  14996. @end table
  14997. @option{start}, @option{end}, and @option{duration} are expressed as time
  14998. duration specifications; see
  14999. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15000. for the accepted syntax.
  15001. Note that the first two sets of the start/end options and the @option{duration}
  15002. option look at the frame timestamp, while the _frame variants simply count the
  15003. frames that pass through the filter. Also note that this filter does not modify
  15004. the timestamps. If you wish for the output timestamps to start at zero, insert a
  15005. setpts filter after the trim filter.
  15006. If multiple start or end options are set, this filter tries to be greedy and
  15007. keep all the frames that match at least one of the specified constraints. To keep
  15008. only the part that matches all the constraints at once, chain multiple trim
  15009. filters.
  15010. The defaults are such that all the input is kept. So it is possible to set e.g.
  15011. just the end values to keep everything before the specified time.
  15012. Examples:
  15013. @itemize
  15014. @item
  15015. Drop everything except the second minute of input:
  15016. @example
  15017. ffmpeg -i INPUT -vf trim=60:120
  15018. @end example
  15019. @item
  15020. Keep only the first second:
  15021. @example
  15022. ffmpeg -i INPUT -vf trim=duration=1
  15023. @end example
  15024. @end itemize
  15025. @section unpremultiply
  15026. Apply alpha unpremultiply effect to input video stream using first plane
  15027. of second stream as alpha.
  15028. Both streams must have same dimensions and same pixel format.
  15029. The filter accepts the following option:
  15030. @table @option
  15031. @item planes
  15032. Set which planes will be processed, unprocessed planes will be copied.
  15033. By default value 0xf, all planes will be processed.
  15034. If the format has 1 or 2 components, then luma is bit 0.
  15035. If the format has 3 or 4 components:
  15036. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  15037. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  15038. If present, the alpha channel is always the last bit.
  15039. @item inplace
  15040. Do not require 2nd input for processing, instead use alpha plane from input stream.
  15041. @end table
  15042. @anchor{unsharp}
  15043. @section unsharp
  15044. Sharpen or blur the input video.
  15045. It accepts the following parameters:
  15046. @table @option
  15047. @item luma_msize_x, lx
  15048. Set the luma matrix horizontal size. It must be an odd integer between
  15049. 3 and 23. The default value is 5.
  15050. @item luma_msize_y, ly
  15051. Set the luma matrix vertical size. It must be an odd integer between 3
  15052. and 23. The default value is 5.
  15053. @item luma_amount, la
  15054. Set the luma effect strength. It must be a floating point number, reasonable
  15055. values lay between -1.5 and 1.5.
  15056. Negative values will blur the input video, while positive values will
  15057. sharpen it, a value of zero will disable the effect.
  15058. Default value is 1.0.
  15059. @item chroma_msize_x, cx
  15060. Set the chroma matrix horizontal size. It must be an odd integer
  15061. between 3 and 23. The default value is 5.
  15062. @item chroma_msize_y, cy
  15063. Set the chroma matrix vertical size. It must be an odd integer
  15064. between 3 and 23. The default value is 5.
  15065. @item chroma_amount, ca
  15066. Set the chroma effect strength. It must be a floating point number, reasonable
  15067. values lay between -1.5 and 1.5.
  15068. Negative values will blur the input video, while positive values will
  15069. sharpen it, a value of zero will disable the effect.
  15070. Default value is 0.0.
  15071. @end table
  15072. All parameters are optional and default to the equivalent of the
  15073. string '5:5:1.0:5:5:0.0'.
  15074. @subsection Examples
  15075. @itemize
  15076. @item
  15077. Apply strong luma sharpen effect:
  15078. @example
  15079. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  15080. @end example
  15081. @item
  15082. Apply a strong blur of both luma and chroma parameters:
  15083. @example
  15084. unsharp=7:7:-2:7:7:-2
  15085. @end example
  15086. @end itemize
  15087. @anchor{untile}
  15088. @section untile
  15089. Decompose a video made of tiled images into the individual images.
  15090. The frame rate of the output video is the frame rate of the input video
  15091. multiplied by the number of tiles.
  15092. This filter does the reverse of @ref{tile}.
  15093. The filter accepts the following options:
  15094. @table @option
  15095. @item layout
  15096. Set the grid size (i.e. the number of lines and columns). For the syntax of
  15097. this option, check the
  15098. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15099. @end table
  15100. @subsection Examples
  15101. @itemize
  15102. @item
  15103. Produce a 1-second video from a still image file made of 25 frames stacked
  15104. vertically, like an analogic film reel:
  15105. @example
  15106. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  15107. @end example
  15108. @end itemize
  15109. @section uspp
  15110. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  15111. the image at several (or - in the case of @option{quality} level @code{8} - all)
  15112. shifts and average the results.
  15113. The way this differs from the behavior of spp is that uspp actually encodes &
  15114. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  15115. DCT similar to MJPEG.
  15116. The filter accepts the following options:
  15117. @table @option
  15118. @item quality
  15119. Set quality. This option defines the number of levels for averaging. It accepts
  15120. an integer in the range 0-8. If set to @code{0}, the filter will have no
  15121. effect. A value of @code{8} means the higher quality. For each increment of
  15122. that value the speed drops by a factor of approximately 2. Default value is
  15123. @code{3}.
  15124. @item qp
  15125. Force a constant quantization parameter. If not set, the filter will use the QP
  15126. from the video stream (if available).
  15127. @end table
  15128. @section v360
  15129. Convert 360 videos between various formats.
  15130. The filter accepts the following options:
  15131. @table @option
  15132. @item input
  15133. @item output
  15134. Set format of the input/output video.
  15135. Available formats:
  15136. @table @samp
  15137. @item e
  15138. @item equirect
  15139. Equirectangular projection.
  15140. @item c3x2
  15141. @item c6x1
  15142. @item c1x6
  15143. Cubemap with 3x2/6x1/1x6 layout.
  15144. Format specific options:
  15145. @table @option
  15146. @item in_pad
  15147. @item out_pad
  15148. Set padding proportion for the input/output cubemap. Values in decimals.
  15149. Example values:
  15150. @table @samp
  15151. @item 0
  15152. No padding.
  15153. @item 0.01
  15154. 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)
  15155. @end table
  15156. Default value is @b{@samp{0}}.
  15157. Maximum value is @b{@samp{0.1}}.
  15158. @item fin_pad
  15159. @item fout_pad
  15160. Set fixed padding for the input/output cubemap. Values in pixels.
  15161. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  15162. @item in_forder
  15163. @item out_forder
  15164. Set order of faces for the input/output cubemap. Choose one direction for each position.
  15165. Designation of directions:
  15166. @table @samp
  15167. @item r
  15168. right
  15169. @item l
  15170. left
  15171. @item u
  15172. up
  15173. @item d
  15174. down
  15175. @item f
  15176. forward
  15177. @item b
  15178. back
  15179. @end table
  15180. Default value is @b{@samp{rludfb}}.
  15181. @item in_frot
  15182. @item out_frot
  15183. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  15184. Designation of angles:
  15185. @table @samp
  15186. @item 0
  15187. 0 degrees clockwise
  15188. @item 1
  15189. 90 degrees clockwise
  15190. @item 2
  15191. 180 degrees clockwise
  15192. @item 3
  15193. 270 degrees clockwise
  15194. @end table
  15195. Default value is @b{@samp{000000}}.
  15196. @end table
  15197. @item eac
  15198. Equi-Angular Cubemap.
  15199. @item flat
  15200. @item gnomonic
  15201. @item rectilinear
  15202. Regular video.
  15203. Format specific options:
  15204. @table @option
  15205. @item h_fov
  15206. @item v_fov
  15207. @item d_fov
  15208. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15209. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15210. @item ih_fov
  15211. @item iv_fov
  15212. @item id_fov
  15213. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15214. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15215. @end table
  15216. @item dfisheye
  15217. Dual fisheye.
  15218. Format specific options:
  15219. @table @option
  15220. @item h_fov
  15221. @item v_fov
  15222. @item d_fov
  15223. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15224. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15225. @item ih_fov
  15226. @item iv_fov
  15227. @item id_fov
  15228. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15229. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15230. @end table
  15231. @item barrel
  15232. @item fb
  15233. @item barrelsplit
  15234. Facebook's 360 formats.
  15235. @item sg
  15236. Stereographic format.
  15237. Format specific options:
  15238. @table @option
  15239. @item h_fov
  15240. @item v_fov
  15241. @item d_fov
  15242. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15243. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15244. @item ih_fov
  15245. @item iv_fov
  15246. @item id_fov
  15247. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15248. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15249. @end table
  15250. @item mercator
  15251. Mercator format.
  15252. @item ball
  15253. Ball format, gives significant distortion toward the back.
  15254. @item hammer
  15255. Hammer-Aitoff map projection format.
  15256. @item sinusoidal
  15257. Sinusoidal map projection format.
  15258. @item fisheye
  15259. Fisheye projection.
  15260. Format specific options:
  15261. @table @option
  15262. @item h_fov
  15263. @item v_fov
  15264. @item d_fov
  15265. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15266. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15267. @item ih_fov
  15268. @item iv_fov
  15269. @item id_fov
  15270. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15271. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15272. @end table
  15273. @item pannini
  15274. Pannini projection.
  15275. Format specific options:
  15276. @table @option
  15277. @item h_fov
  15278. Set output pannini parameter.
  15279. @item ih_fov
  15280. Set input pannini parameter.
  15281. @end table
  15282. @item cylindrical
  15283. Cylindrical projection.
  15284. Format specific options:
  15285. @table @option
  15286. @item h_fov
  15287. @item v_fov
  15288. @item d_fov
  15289. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15290. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15291. @item ih_fov
  15292. @item iv_fov
  15293. @item id_fov
  15294. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15295. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15296. @end table
  15297. @item perspective
  15298. Perspective projection. @i{(output only)}
  15299. Format specific options:
  15300. @table @option
  15301. @item v_fov
  15302. Set perspective parameter.
  15303. @end table
  15304. @item tetrahedron
  15305. Tetrahedron projection.
  15306. @item tsp
  15307. Truncated square pyramid projection.
  15308. @item he
  15309. @item hequirect
  15310. Half equirectangular projection.
  15311. @item equisolid
  15312. Equisolid format.
  15313. Format specific options:
  15314. @table @option
  15315. @item h_fov
  15316. @item v_fov
  15317. @item d_fov
  15318. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15319. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15320. @item ih_fov
  15321. @item iv_fov
  15322. @item id_fov
  15323. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15324. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15325. @end table
  15326. @item og
  15327. Orthographic format.
  15328. Format specific options:
  15329. @table @option
  15330. @item h_fov
  15331. @item v_fov
  15332. @item d_fov
  15333. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15334. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15335. @item ih_fov
  15336. @item iv_fov
  15337. @item id_fov
  15338. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15339. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15340. @end table
  15341. @item octahedron
  15342. Octahedron projection.
  15343. @end table
  15344. @item interp
  15345. Set interpolation method.@*
  15346. @i{Note: more complex interpolation methods require much more memory to run.}
  15347. Available methods:
  15348. @table @samp
  15349. @item near
  15350. @item nearest
  15351. Nearest neighbour.
  15352. @item line
  15353. @item linear
  15354. Bilinear interpolation.
  15355. @item lagrange9
  15356. Lagrange9 interpolation.
  15357. @item cube
  15358. @item cubic
  15359. Bicubic interpolation.
  15360. @item lanc
  15361. @item lanczos
  15362. Lanczos interpolation.
  15363. @item sp16
  15364. @item spline16
  15365. Spline16 interpolation.
  15366. @item gauss
  15367. @item gaussian
  15368. Gaussian interpolation.
  15369. @item mitchell
  15370. Mitchell interpolation.
  15371. @end table
  15372. Default value is @b{@samp{line}}.
  15373. @item w
  15374. @item h
  15375. Set the output video resolution.
  15376. Default resolution depends on formats.
  15377. @item in_stereo
  15378. @item out_stereo
  15379. Set the input/output stereo format.
  15380. @table @samp
  15381. @item 2d
  15382. 2D mono
  15383. @item sbs
  15384. Side by side
  15385. @item tb
  15386. Top bottom
  15387. @end table
  15388. Default value is @b{@samp{2d}} for input and output format.
  15389. @item yaw
  15390. @item pitch
  15391. @item roll
  15392. Set rotation for the output video. Values in degrees.
  15393. @item rorder
  15394. Set rotation order for the output video. Choose one item for each position.
  15395. @table @samp
  15396. @item y, Y
  15397. yaw
  15398. @item p, P
  15399. pitch
  15400. @item r, R
  15401. roll
  15402. @end table
  15403. Default value is @b{@samp{ypr}}.
  15404. @item h_flip
  15405. @item v_flip
  15406. @item d_flip
  15407. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  15408. @item ih_flip
  15409. @item iv_flip
  15410. Set if input video is flipped horizontally/vertically. Boolean values.
  15411. @item in_trans
  15412. Set if input video is transposed. Boolean value, by default disabled.
  15413. @item out_trans
  15414. Set if output video needs to be transposed. Boolean value, by default disabled.
  15415. @item alpha_mask
  15416. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  15417. @end table
  15418. @subsection Examples
  15419. @itemize
  15420. @item
  15421. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  15422. @example
  15423. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  15424. @end example
  15425. @item
  15426. Extract back view of Equi-Angular Cubemap:
  15427. @example
  15428. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  15429. @end example
  15430. @item
  15431. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  15432. @example
  15433. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  15434. @end example
  15435. @end itemize
  15436. @subsection Commands
  15437. This filter supports subset of above options as @ref{commands}.
  15438. @section vaguedenoiser
  15439. Apply a wavelet based denoiser.
  15440. It transforms each frame from the video input into the wavelet domain,
  15441. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15442. the obtained coefficients. It does an inverse wavelet transform after.
  15443. Due to wavelet properties, it should give a nice smoothed result, and
  15444. reduced noise, without blurring picture features.
  15445. This filter accepts the following options:
  15446. @table @option
  15447. @item threshold
  15448. The filtering strength. The higher, the more filtered the video will be.
  15449. Hard thresholding can use a higher threshold than soft thresholding
  15450. before the video looks overfiltered. Default value is 2.
  15451. @item method
  15452. The filtering method the filter will use.
  15453. It accepts the following values:
  15454. @table @samp
  15455. @item hard
  15456. All values under the threshold will be zeroed.
  15457. @item soft
  15458. All values under the threshold will be zeroed. All values above will be
  15459. reduced by the threshold.
  15460. @item garrote
  15461. Scales or nullifies coefficients - intermediary between (more) soft and
  15462. (less) hard thresholding.
  15463. @end table
  15464. Default is garrote.
  15465. @item nsteps
  15466. Number of times, the wavelet will decompose the picture. Picture can't
  15467. be decomposed beyond a particular point (typically, 8 for a 640x480
  15468. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15469. @item percent
  15470. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15471. @item planes
  15472. A list of the planes to process. By default all planes are processed.
  15473. @item type
  15474. The threshold type the filter will use.
  15475. It accepts the following values:
  15476. @table @samp
  15477. @item universal
  15478. Threshold used is same for all decompositions.
  15479. @item bayes
  15480. Threshold used depends also on each decomposition coefficients.
  15481. @end table
  15482. Default is universal.
  15483. @end table
  15484. @section vectorscope
  15485. Display 2 color component values in the two dimensional graph (which is called
  15486. a vectorscope).
  15487. This filter accepts the following options:
  15488. @table @option
  15489. @item mode, m
  15490. Set vectorscope mode.
  15491. It accepts the following values:
  15492. @table @samp
  15493. @item gray
  15494. @item tint
  15495. Gray values are displayed on graph, higher brightness means more pixels have
  15496. same component color value on location in graph. This is the default mode.
  15497. @item color
  15498. Gray values are displayed on graph. Surrounding pixels values which are not
  15499. present in video frame are drawn in gradient of 2 color components which are
  15500. set by option @code{x} and @code{y}. The 3rd color component is static.
  15501. @item color2
  15502. Actual color components values present in video frame are displayed on graph.
  15503. @item color3
  15504. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15505. on graph increases value of another color component, which is luminance by
  15506. default values of @code{x} and @code{y}.
  15507. @item color4
  15508. Actual colors present in video frame are displayed on graph. If two different
  15509. colors map to same position on graph then color with higher value of component
  15510. not present in graph is picked.
  15511. @item color5
  15512. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15513. component picked from radial gradient.
  15514. @end table
  15515. @item x
  15516. Set which color component will be represented on X-axis. Default is @code{1}.
  15517. @item y
  15518. Set which color component will be represented on Y-axis. Default is @code{2}.
  15519. @item intensity, i
  15520. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15521. of color component which represents frequency of (X, Y) location in graph.
  15522. @item envelope, e
  15523. @table @samp
  15524. @item none
  15525. No envelope, this is default.
  15526. @item instant
  15527. Instant envelope, even darkest single pixel will be clearly highlighted.
  15528. @item peak
  15529. Hold maximum and minimum values presented in graph over time. This way you
  15530. can still spot out of range values without constantly looking at vectorscope.
  15531. @item peak+instant
  15532. Peak and instant envelope combined together.
  15533. @end table
  15534. @item graticule, g
  15535. Set what kind of graticule to draw.
  15536. @table @samp
  15537. @item none
  15538. @item green
  15539. @item color
  15540. @item invert
  15541. @end table
  15542. @item opacity, o
  15543. Set graticule opacity.
  15544. @item flags, f
  15545. Set graticule flags.
  15546. @table @samp
  15547. @item white
  15548. Draw graticule for white point.
  15549. @item black
  15550. Draw graticule for black point.
  15551. @item name
  15552. Draw color points short names.
  15553. @end table
  15554. @item bgopacity, b
  15555. Set background opacity.
  15556. @item lthreshold, l
  15557. Set low threshold for color component not represented on X or Y axis.
  15558. Values lower than this value will be ignored. Default is 0.
  15559. Note this value is multiplied with actual max possible value one pixel component
  15560. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15561. is 0.1 * 255 = 25.
  15562. @item hthreshold, h
  15563. Set high threshold for color component not represented on X or Y axis.
  15564. Values higher than this value will be ignored. Default is 1.
  15565. Note this value is multiplied with actual max possible value one pixel component
  15566. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15567. is 0.9 * 255 = 230.
  15568. @item colorspace, c
  15569. Set what kind of colorspace to use when drawing graticule.
  15570. @table @samp
  15571. @item auto
  15572. @item 601
  15573. @item 709
  15574. @end table
  15575. Default is auto.
  15576. @item tint0, t0
  15577. @item tint1, t1
  15578. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15579. This means no tint, and output will remain gray.
  15580. @end table
  15581. @anchor{vidstabdetect}
  15582. @section vidstabdetect
  15583. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15584. @ref{vidstabtransform} for pass 2.
  15585. This filter generates a file with relative translation and rotation
  15586. transform information about subsequent frames, which is then used by
  15587. the @ref{vidstabtransform} filter.
  15588. To enable compilation of this filter you need to configure FFmpeg with
  15589. @code{--enable-libvidstab}.
  15590. This filter accepts the following options:
  15591. @table @option
  15592. @item result
  15593. Set the path to the file used to write the transforms information.
  15594. Default value is @file{transforms.trf}.
  15595. @item shakiness
  15596. Set how shaky the video is and how quick the camera is. It accepts an
  15597. integer in the range 1-10, a value of 1 means little shakiness, a
  15598. value of 10 means strong shakiness. Default value is 5.
  15599. @item accuracy
  15600. Set the accuracy of the detection process. It must be a value in the
  15601. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15602. accuracy. Default value is 15.
  15603. @item stepsize
  15604. Set stepsize of the search process. The region around minimum is
  15605. scanned with 1 pixel resolution. Default value is 6.
  15606. @item mincontrast
  15607. Set minimum contrast. Below this value a local measurement field is
  15608. discarded. Must be a floating point value in the range 0-1. Default
  15609. value is 0.3.
  15610. @item tripod
  15611. Set reference frame number for tripod mode.
  15612. If enabled, the motion of the frames is compared to a reference frame
  15613. in the filtered stream, identified by the specified number. The idea
  15614. is to compensate all movements in a more-or-less static scene and keep
  15615. the camera view absolutely still.
  15616. If set to 0, it is disabled. The frames are counted starting from 1.
  15617. @item show
  15618. Show fields and transforms in the resulting frames. It accepts an
  15619. integer in the range 0-2. Default value is 0, which disables any
  15620. visualization.
  15621. @end table
  15622. @subsection Examples
  15623. @itemize
  15624. @item
  15625. Use default values:
  15626. @example
  15627. vidstabdetect
  15628. @end example
  15629. @item
  15630. Analyze strongly shaky movie and put the results in file
  15631. @file{mytransforms.trf}:
  15632. @example
  15633. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15634. @end example
  15635. @item
  15636. Visualize the result of internal transformations in the resulting
  15637. video:
  15638. @example
  15639. vidstabdetect=show=1
  15640. @end example
  15641. @item
  15642. Analyze a video with medium shakiness using @command{ffmpeg}:
  15643. @example
  15644. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15645. @end example
  15646. @end itemize
  15647. @anchor{vidstabtransform}
  15648. @section vidstabtransform
  15649. Video stabilization/deshaking: pass 2 of 2,
  15650. see @ref{vidstabdetect} for pass 1.
  15651. Read a file with transform information for each frame and
  15652. apply/compensate them. Together with the @ref{vidstabdetect}
  15653. filter this can be used to deshake videos. See also
  15654. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15655. the @ref{unsharp} filter, see below.
  15656. To enable compilation of this filter you need to configure FFmpeg with
  15657. @code{--enable-libvidstab}.
  15658. @subsection Options
  15659. @table @option
  15660. @item input
  15661. Set path to the file used to read the transforms. Default value is
  15662. @file{transforms.trf}.
  15663. @item smoothing
  15664. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15665. camera movements. Default value is 10.
  15666. For example a number of 10 means that 21 frames are used (10 in the
  15667. past and 10 in the future) to smoothen the motion in the video. A
  15668. larger value leads to a smoother video, but limits the acceleration of
  15669. the camera (pan/tilt movements). 0 is a special case where a static
  15670. camera is simulated.
  15671. @item optalgo
  15672. Set the camera path optimization algorithm.
  15673. Accepted values are:
  15674. @table @samp
  15675. @item gauss
  15676. gaussian kernel low-pass filter on camera motion (default)
  15677. @item avg
  15678. averaging on transformations
  15679. @end table
  15680. @item maxshift
  15681. Set maximal number of pixels to translate frames. Default value is -1,
  15682. meaning no limit.
  15683. @item maxangle
  15684. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15685. value is -1, meaning no limit.
  15686. @item crop
  15687. Specify how to deal with borders that may be visible due to movement
  15688. compensation.
  15689. Available values are:
  15690. @table @samp
  15691. @item keep
  15692. keep image information from previous frame (default)
  15693. @item black
  15694. fill the border black
  15695. @end table
  15696. @item invert
  15697. Invert transforms if set to 1. Default value is 0.
  15698. @item relative
  15699. Consider transforms as relative to previous frame if set to 1,
  15700. absolute if set to 0. Default value is 0.
  15701. @item zoom
  15702. Set percentage to zoom. A positive value will result in a zoom-in
  15703. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15704. zoom).
  15705. @item optzoom
  15706. Set optimal zooming to avoid borders.
  15707. Accepted values are:
  15708. @table @samp
  15709. @item 0
  15710. disabled
  15711. @item 1
  15712. optimal static zoom value is determined (only very strong movements
  15713. will lead to visible borders) (default)
  15714. @item 2
  15715. optimal adaptive zoom value is determined (no borders will be
  15716. visible), see @option{zoomspeed}
  15717. @end table
  15718. Note that the value given at zoom is added to the one calculated here.
  15719. @item zoomspeed
  15720. Set percent to zoom maximally each frame (enabled when
  15721. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15722. 0.25.
  15723. @item interpol
  15724. Specify type of interpolation.
  15725. Available values are:
  15726. @table @samp
  15727. @item no
  15728. no interpolation
  15729. @item linear
  15730. linear only horizontal
  15731. @item bilinear
  15732. linear in both directions (default)
  15733. @item bicubic
  15734. cubic in both directions (slow)
  15735. @end table
  15736. @item tripod
  15737. Enable virtual tripod mode if set to 1, which is equivalent to
  15738. @code{relative=0:smoothing=0}. Default value is 0.
  15739. Use also @code{tripod} option of @ref{vidstabdetect}.
  15740. @item debug
  15741. Increase log verbosity if set to 1. Also the detected global motions
  15742. are written to the temporary file @file{global_motions.trf}. Default
  15743. value is 0.
  15744. @end table
  15745. @subsection Examples
  15746. @itemize
  15747. @item
  15748. Use @command{ffmpeg} for a typical stabilization with default values:
  15749. @example
  15750. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15751. @end example
  15752. Note the use of the @ref{unsharp} filter which is always recommended.
  15753. @item
  15754. Zoom in a bit more and load transform data from a given file:
  15755. @example
  15756. vidstabtransform=zoom=5:input="mytransforms.trf"
  15757. @end example
  15758. @item
  15759. Smoothen the video even more:
  15760. @example
  15761. vidstabtransform=smoothing=30
  15762. @end example
  15763. @end itemize
  15764. @section vflip
  15765. Flip the input video vertically.
  15766. For example, to vertically flip a video with @command{ffmpeg}:
  15767. @example
  15768. ffmpeg -i in.avi -vf "vflip" out.avi
  15769. @end example
  15770. @section vfrdet
  15771. Detect variable frame rate video.
  15772. This filter tries to detect if the input is variable or constant frame rate.
  15773. At end it will output number of frames detected as having variable delta pts,
  15774. and ones with constant delta pts.
  15775. If there was frames with variable delta, than it will also show min, max and
  15776. average delta encountered.
  15777. @section vibrance
  15778. Boost or alter saturation.
  15779. The filter accepts the following options:
  15780. @table @option
  15781. @item intensity
  15782. Set strength of boost if positive value or strength of alter if negative value.
  15783. Default is 0. Allowed range is from -2 to 2.
  15784. @item rbal
  15785. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15786. @item gbal
  15787. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15788. @item bbal
  15789. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15790. @item rlum
  15791. Set the red luma coefficient.
  15792. @item glum
  15793. Set the green luma coefficient.
  15794. @item blum
  15795. Set the blue luma coefficient.
  15796. @item alternate
  15797. If @code{intensity} is negative and this is set to 1, colors will change,
  15798. otherwise colors will be less saturated, more towards gray.
  15799. @end table
  15800. @subsection Commands
  15801. This filter supports the all above options as @ref{commands}.
  15802. @anchor{vignette}
  15803. @section vignette
  15804. Make or reverse a natural vignetting effect.
  15805. The filter accepts the following options:
  15806. @table @option
  15807. @item angle, a
  15808. Set lens angle expression as a number of radians.
  15809. The value is clipped in the @code{[0,PI/2]} range.
  15810. Default value: @code{"PI/5"}
  15811. @item x0
  15812. @item y0
  15813. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15814. by default.
  15815. @item mode
  15816. Set forward/backward mode.
  15817. Available modes are:
  15818. @table @samp
  15819. @item forward
  15820. The larger the distance from the central point, the darker the image becomes.
  15821. @item backward
  15822. The larger the distance from the central point, the brighter the image becomes.
  15823. This can be used to reverse a vignette effect, though there is no automatic
  15824. detection to extract the lens @option{angle} and other settings (yet). It can
  15825. also be used to create a burning effect.
  15826. @end table
  15827. Default value is @samp{forward}.
  15828. @item eval
  15829. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15830. It accepts the following values:
  15831. @table @samp
  15832. @item init
  15833. Evaluate expressions only once during the filter initialization.
  15834. @item frame
  15835. Evaluate expressions for each incoming frame. This is way slower than the
  15836. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15837. allows advanced dynamic expressions.
  15838. @end table
  15839. Default value is @samp{init}.
  15840. @item dither
  15841. Set dithering to reduce the circular banding effects. Default is @code{1}
  15842. (enabled).
  15843. @item aspect
  15844. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15845. Setting this value to the SAR of the input will make a rectangular vignetting
  15846. following the dimensions of the video.
  15847. Default is @code{1/1}.
  15848. @end table
  15849. @subsection Expressions
  15850. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15851. following parameters.
  15852. @table @option
  15853. @item w
  15854. @item h
  15855. input width and height
  15856. @item n
  15857. the number of input frame, starting from 0
  15858. @item pts
  15859. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15860. @var{TB} units, NAN if undefined
  15861. @item r
  15862. frame rate of the input video, NAN if the input frame rate is unknown
  15863. @item t
  15864. the PTS (Presentation TimeStamp) of the filtered video frame,
  15865. expressed in seconds, NAN if undefined
  15866. @item tb
  15867. time base of the input video
  15868. @end table
  15869. @subsection Examples
  15870. @itemize
  15871. @item
  15872. Apply simple strong vignetting effect:
  15873. @example
  15874. vignette=PI/4
  15875. @end example
  15876. @item
  15877. Make a flickering vignetting:
  15878. @example
  15879. vignette='PI/4+random(1)*PI/50':eval=frame
  15880. @end example
  15881. @end itemize
  15882. @section vmafmotion
  15883. Obtain the average VMAF motion score of a video.
  15884. It is one of the component metrics of VMAF.
  15885. The obtained average motion score is printed through the logging system.
  15886. The filter accepts the following options:
  15887. @table @option
  15888. @item stats_file
  15889. If specified, the filter will use the named file to save the motion score of
  15890. each frame with respect to the previous frame.
  15891. When filename equals "-" the data is sent to standard output.
  15892. @end table
  15893. Example:
  15894. @example
  15895. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15896. @end example
  15897. @section vstack
  15898. Stack input videos vertically.
  15899. All streams must be of same pixel format and of same width.
  15900. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15901. to create same output.
  15902. The filter accepts the following options:
  15903. @table @option
  15904. @item inputs
  15905. Set number of input streams. Default is 2.
  15906. @item shortest
  15907. If set to 1, force the output to terminate when the shortest input
  15908. terminates. Default value is 0.
  15909. @end table
  15910. @section w3fdif
  15911. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15912. Deinterlacing Filter").
  15913. Based on the process described by Martin Weston for BBC R&D, and
  15914. implemented based on the de-interlace algorithm written by Jim
  15915. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15916. uses filter coefficients calculated by BBC R&D.
  15917. This filter uses field-dominance information in frame to decide which
  15918. of each pair of fields to place first in the output.
  15919. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15920. There are two sets of filter coefficients, so called "simple"
  15921. and "complex". Which set of filter coefficients is used can
  15922. be set by passing an optional parameter:
  15923. @table @option
  15924. @item filter
  15925. Set the interlacing filter coefficients. Accepts one of the following values:
  15926. @table @samp
  15927. @item simple
  15928. Simple filter coefficient set.
  15929. @item complex
  15930. More-complex filter coefficient set.
  15931. @end table
  15932. Default value is @samp{complex}.
  15933. @item mode
  15934. The interlacing mode to adopt. It accepts one of the following values:
  15935. @table @option
  15936. @item frame
  15937. Output one frame for each frame.
  15938. @item field
  15939. Output one frame for each field.
  15940. @end table
  15941. The default value is @code{field}.
  15942. @item parity
  15943. The picture field parity assumed for the input interlaced video. It accepts one
  15944. of the following values:
  15945. @table @option
  15946. @item tff
  15947. Assume the top field is first.
  15948. @item bff
  15949. Assume the bottom field is first.
  15950. @item auto
  15951. Enable automatic detection of field parity.
  15952. @end table
  15953. The default value is @code{auto}.
  15954. If the interlacing is unknown or the decoder does not export this information,
  15955. top field first will be assumed.
  15956. @item deint
  15957. Specify which frames to deinterlace. Accepts one of the following values:
  15958. @table @samp
  15959. @item all
  15960. Deinterlace all frames,
  15961. @item interlaced
  15962. Only deinterlace frames marked as interlaced.
  15963. @end table
  15964. Default value is @samp{all}.
  15965. @end table
  15966. @subsection Commands
  15967. This filter supports same @ref{commands} as options.
  15968. @section waveform
  15969. Video waveform monitor.
  15970. The waveform monitor plots color component intensity. By default luminance
  15971. only. Each column of the waveform corresponds to a column of pixels in the
  15972. source video.
  15973. It accepts the following options:
  15974. @table @option
  15975. @item mode, m
  15976. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15977. In row mode, the graph on the left side represents color component value 0 and
  15978. the right side represents value = 255. In column mode, the top side represents
  15979. color component value = 0 and bottom side represents value = 255.
  15980. @item intensity, i
  15981. Set intensity. Smaller values are useful to find out how many values of the same
  15982. luminance are distributed across input rows/columns.
  15983. Default value is @code{0.04}. Allowed range is [0, 1].
  15984. @item mirror, r
  15985. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15986. In mirrored mode, higher values will be represented on the left
  15987. side for @code{row} mode and at the top for @code{column} mode. Default is
  15988. @code{1} (mirrored).
  15989. @item display, d
  15990. Set display mode.
  15991. It accepts the following values:
  15992. @table @samp
  15993. @item overlay
  15994. Presents information identical to that in the @code{parade}, except
  15995. that the graphs representing color components are superimposed directly
  15996. over one another.
  15997. This display mode makes it easier to spot relative differences or similarities
  15998. in overlapping areas of the color components that are supposed to be identical,
  15999. such as neutral whites, grays, or blacks.
  16000. @item stack
  16001. Display separate graph for the color components side by side in
  16002. @code{row} mode or one below the other in @code{column} mode.
  16003. @item parade
  16004. Display separate graph for the color components side by side in
  16005. @code{column} mode or one below the other in @code{row} mode.
  16006. Using this display mode makes it easy to spot color casts in the highlights
  16007. and shadows of an image, by comparing the contours of the top and the bottom
  16008. graphs of each waveform. Since whites, grays, and blacks are characterized
  16009. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  16010. should display three waveforms of roughly equal width/height. If not, the
  16011. correction is easy to perform by making level adjustments the three waveforms.
  16012. @end table
  16013. Default is @code{stack}.
  16014. @item components, c
  16015. Set which color components to display. Default is 1, which means only luminance
  16016. or red color component if input is in RGB colorspace. If is set for example to
  16017. 7 it will display all 3 (if) available color components.
  16018. @item envelope, e
  16019. @table @samp
  16020. @item none
  16021. No envelope, this is default.
  16022. @item instant
  16023. Instant envelope, minimum and maximum values presented in graph will be easily
  16024. visible even with small @code{step} value.
  16025. @item peak
  16026. Hold minimum and maximum values presented in graph across time. This way you
  16027. can still spot out of range values without constantly looking at waveforms.
  16028. @item peak+instant
  16029. Peak and instant envelope combined together.
  16030. @end table
  16031. @item filter, f
  16032. @table @samp
  16033. @item lowpass
  16034. No filtering, this is default.
  16035. @item flat
  16036. Luma and chroma combined together.
  16037. @item aflat
  16038. Similar as above, but shows difference between blue and red chroma.
  16039. @item xflat
  16040. Similar as above, but use different colors.
  16041. @item yflat
  16042. Similar as above, but again with different colors.
  16043. @item chroma
  16044. Displays only chroma.
  16045. @item color
  16046. Displays actual color value on waveform.
  16047. @item acolor
  16048. Similar as above, but with luma showing frequency of chroma values.
  16049. @end table
  16050. @item graticule, g
  16051. Set which graticule to display.
  16052. @table @samp
  16053. @item none
  16054. Do not display graticule.
  16055. @item green
  16056. Display green graticule showing legal broadcast ranges.
  16057. @item orange
  16058. Display orange graticule showing legal broadcast ranges.
  16059. @item invert
  16060. Display invert graticule showing legal broadcast ranges.
  16061. @end table
  16062. @item opacity, o
  16063. Set graticule opacity.
  16064. @item flags, fl
  16065. Set graticule flags.
  16066. @table @samp
  16067. @item numbers
  16068. Draw numbers above lines. By default enabled.
  16069. @item dots
  16070. Draw dots instead of lines.
  16071. @end table
  16072. @item scale, s
  16073. Set scale used for displaying graticule.
  16074. @table @samp
  16075. @item digital
  16076. @item millivolts
  16077. @item ire
  16078. @end table
  16079. Default is digital.
  16080. @item bgopacity, b
  16081. Set background opacity.
  16082. @item tint0, t0
  16083. @item tint1, t1
  16084. Set tint for output.
  16085. Only used with lowpass filter and when display is not overlay and input
  16086. pixel formats are not RGB.
  16087. @end table
  16088. @section weave, doubleweave
  16089. The @code{weave} takes a field-based video input and join
  16090. each two sequential fields into single frame, producing a new double
  16091. height clip with half the frame rate and half the frame count.
  16092. The @code{doubleweave} works same as @code{weave} but without
  16093. halving frame rate and frame count.
  16094. It accepts the following option:
  16095. @table @option
  16096. @item first_field
  16097. Set first field. Available values are:
  16098. @table @samp
  16099. @item top, t
  16100. Set the frame as top-field-first.
  16101. @item bottom, b
  16102. Set the frame as bottom-field-first.
  16103. @end table
  16104. @end table
  16105. @subsection Examples
  16106. @itemize
  16107. @item
  16108. Interlace video using @ref{select} and @ref{separatefields} filter:
  16109. @example
  16110. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  16111. @end example
  16112. @end itemize
  16113. @section xbr
  16114. Apply the xBR high-quality magnification filter which is designed for pixel
  16115. art. It follows a set of edge-detection rules, see
  16116. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  16117. It accepts the following option:
  16118. @table @option
  16119. @item n
  16120. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  16121. @code{3xBR} and @code{4} for @code{4xBR}.
  16122. Default is @code{3}.
  16123. @end table
  16124. @section xfade
  16125. Apply cross fade from one input video stream to another input video stream.
  16126. The cross fade is applied for specified duration.
  16127. The filter accepts the following options:
  16128. @table @option
  16129. @item transition
  16130. Set one of available transition effects:
  16131. @table @samp
  16132. @item custom
  16133. @item fade
  16134. @item wipeleft
  16135. @item wiperight
  16136. @item wipeup
  16137. @item wipedown
  16138. @item slideleft
  16139. @item slideright
  16140. @item slideup
  16141. @item slidedown
  16142. @item circlecrop
  16143. @item rectcrop
  16144. @item distance
  16145. @item fadeblack
  16146. @item fadewhite
  16147. @item radial
  16148. @item smoothleft
  16149. @item smoothright
  16150. @item smoothup
  16151. @item smoothdown
  16152. @item circleopen
  16153. @item circleclose
  16154. @item vertopen
  16155. @item vertclose
  16156. @item horzopen
  16157. @item horzclose
  16158. @item dissolve
  16159. @item pixelize
  16160. @item diagtl
  16161. @item diagtr
  16162. @item diagbl
  16163. @item diagbr
  16164. @item hlslice
  16165. @item hrslice
  16166. @item vuslice
  16167. @item vdslice
  16168. @item hblur
  16169. @item fadegrays
  16170. @item wipetl
  16171. @item wipetr
  16172. @item wipebl
  16173. @item wipebr
  16174. @item squeezeh
  16175. @item squeezev
  16176. @end table
  16177. Default transition effect is fade.
  16178. @item duration
  16179. Set cross fade duration in seconds.
  16180. Default duration is 1 second.
  16181. @item offset
  16182. Set cross fade start relative to first input stream in seconds.
  16183. Default offset is 0.
  16184. @item expr
  16185. Set expression for custom transition effect.
  16186. The expressions can use the following variables and functions:
  16187. @table @option
  16188. @item X
  16189. @item Y
  16190. The coordinates of the current sample.
  16191. @item W
  16192. @item H
  16193. The width and height of the image.
  16194. @item P
  16195. Progress of transition effect.
  16196. @item PLANE
  16197. Currently processed plane.
  16198. @item A
  16199. Return value of first input at current location and plane.
  16200. @item B
  16201. Return value of second input at current location and plane.
  16202. @item a0(x, y)
  16203. @item a1(x, y)
  16204. @item a2(x, y)
  16205. @item a3(x, y)
  16206. Return the value of the pixel at location (@var{x},@var{y}) of the
  16207. first/second/third/fourth component of first input.
  16208. @item b0(x, y)
  16209. @item b1(x, y)
  16210. @item b2(x, y)
  16211. @item b3(x, y)
  16212. Return the value of the pixel at location (@var{x},@var{y}) of the
  16213. first/second/third/fourth component of second input.
  16214. @end table
  16215. @end table
  16216. @subsection Examples
  16217. @itemize
  16218. @item
  16219. Cross fade from one input video to another input video, with fade transition and duration of transition
  16220. of 2 seconds starting at offset of 5 seconds:
  16221. @example
  16222. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  16223. @end example
  16224. @end itemize
  16225. @section xmedian
  16226. Pick median pixels from several input videos.
  16227. The filter accepts the following options:
  16228. @table @option
  16229. @item inputs
  16230. Set number of inputs.
  16231. Default is 3. Allowed range is from 3 to 255.
  16232. If number of inputs is even number, than result will be mean value between two median values.
  16233. @item planes
  16234. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  16235. @item percentile
  16236. Set median percentile. Default value is @code{0.5}.
  16237. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  16238. minimum values, and @code{1} maximum values.
  16239. @end table
  16240. @subsection Commands
  16241. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  16242. @section xstack
  16243. Stack video inputs into custom layout.
  16244. All streams must be of same pixel format.
  16245. The filter accepts the following options:
  16246. @table @option
  16247. @item inputs
  16248. Set number of input streams. Default is 2.
  16249. @item layout
  16250. Specify layout of inputs.
  16251. This option requires the desired layout configuration to be explicitly set by the user.
  16252. This sets position of each video input in output. Each input
  16253. is separated by '|'.
  16254. The first number represents the column, and the second number represents the row.
  16255. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  16256. where X is video input from which to take width or height.
  16257. Multiple values can be used when separated by '+'. In such
  16258. case values are summed together.
  16259. Note that if inputs are of different sizes gaps may appear, as not all of
  16260. the output video frame will be filled. Similarly, videos can overlap each
  16261. other if their position doesn't leave enough space for the full frame of
  16262. adjoining videos.
  16263. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  16264. a layout must be set by the user.
  16265. @item shortest
  16266. If set to 1, force the output to terminate when the shortest input
  16267. terminates. Default value is 0.
  16268. @item fill
  16269. If set to valid color, all unused pixels will be filled with that color.
  16270. By default fill is set to none, so it is disabled.
  16271. @end table
  16272. @subsection Examples
  16273. @itemize
  16274. @item
  16275. Display 4 inputs into 2x2 grid.
  16276. Layout:
  16277. @example
  16278. input1(0, 0) | input3(w0, 0)
  16279. input2(0, h0) | input4(w0, h0)
  16280. @end example
  16281. @example
  16282. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  16283. @end example
  16284. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16285. @item
  16286. Display 4 inputs into 1x4 grid.
  16287. Layout:
  16288. @example
  16289. input1(0, 0)
  16290. input2(0, h0)
  16291. input3(0, h0+h1)
  16292. input4(0, h0+h1+h2)
  16293. @end example
  16294. @example
  16295. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  16296. @end example
  16297. Note that if inputs are of different widths, unused space will appear.
  16298. @item
  16299. Display 9 inputs into 3x3 grid.
  16300. Layout:
  16301. @example
  16302. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  16303. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  16304. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  16305. @end example
  16306. @example
  16307. 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
  16308. @end example
  16309. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16310. @item
  16311. Display 16 inputs into 4x4 grid.
  16312. Layout:
  16313. @example
  16314. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  16315. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  16316. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  16317. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  16318. @end example
  16319. @example
  16320. 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|
  16321. 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
  16322. @end example
  16323. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16324. @end itemize
  16325. @anchor{yadif}
  16326. @section yadif
  16327. Deinterlace the input video ("yadif" means "yet another deinterlacing
  16328. filter").
  16329. It accepts the following parameters:
  16330. @table @option
  16331. @item mode
  16332. The interlacing mode to adopt. It accepts one of the following values:
  16333. @table @option
  16334. @item 0, send_frame
  16335. Output one frame for each frame.
  16336. @item 1, send_field
  16337. Output one frame for each field.
  16338. @item 2, send_frame_nospatial
  16339. Like @code{send_frame}, but it skips the spatial interlacing check.
  16340. @item 3, send_field_nospatial
  16341. Like @code{send_field}, but it skips the spatial interlacing check.
  16342. @end table
  16343. The default value is @code{send_frame}.
  16344. @item parity
  16345. The picture field parity assumed for the input interlaced video. It accepts one
  16346. of the following values:
  16347. @table @option
  16348. @item 0, tff
  16349. Assume the top field is first.
  16350. @item 1, bff
  16351. Assume the bottom field is first.
  16352. @item -1, auto
  16353. Enable automatic detection of field parity.
  16354. @end table
  16355. The default value is @code{auto}.
  16356. If the interlacing is unknown or the decoder does not export this information,
  16357. top field first will be assumed.
  16358. @item deint
  16359. Specify which frames to deinterlace. Accepts one of the following
  16360. values:
  16361. @table @option
  16362. @item 0, all
  16363. Deinterlace all frames.
  16364. @item 1, interlaced
  16365. Only deinterlace frames marked as interlaced.
  16366. @end table
  16367. The default value is @code{all}.
  16368. @end table
  16369. @section yadif_cuda
  16370. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  16371. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  16372. and/or nvenc.
  16373. It accepts the following parameters:
  16374. @table @option
  16375. @item mode
  16376. The interlacing mode to adopt. It accepts one of the following values:
  16377. @table @option
  16378. @item 0, send_frame
  16379. Output one frame for each frame.
  16380. @item 1, send_field
  16381. Output one frame for each field.
  16382. @item 2, send_frame_nospatial
  16383. Like @code{send_frame}, but it skips the spatial interlacing check.
  16384. @item 3, send_field_nospatial
  16385. Like @code{send_field}, but it skips the spatial interlacing check.
  16386. @end table
  16387. The default value is @code{send_frame}.
  16388. @item parity
  16389. The picture field parity assumed for the input interlaced video. It accepts one
  16390. of the following values:
  16391. @table @option
  16392. @item 0, tff
  16393. Assume the top field is first.
  16394. @item 1, bff
  16395. Assume the bottom field is first.
  16396. @item -1, auto
  16397. Enable automatic detection of field parity.
  16398. @end table
  16399. The default value is @code{auto}.
  16400. If the interlacing is unknown or the decoder does not export this information,
  16401. top field first will be assumed.
  16402. @item deint
  16403. Specify which frames to deinterlace. Accepts one of the following
  16404. values:
  16405. @table @option
  16406. @item 0, all
  16407. Deinterlace all frames.
  16408. @item 1, interlaced
  16409. Only deinterlace frames marked as interlaced.
  16410. @end table
  16411. The default value is @code{all}.
  16412. @end table
  16413. @section yaepblur
  16414. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  16415. The algorithm is described in
  16416. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  16417. It accepts the following parameters:
  16418. @table @option
  16419. @item radius, r
  16420. Set the window radius. Default value is 3.
  16421. @item planes, p
  16422. Set which planes to filter. Default is only the first plane.
  16423. @item sigma, s
  16424. Set blur strength. Default value is 128.
  16425. @end table
  16426. @subsection Commands
  16427. This filter supports same @ref{commands} as options.
  16428. @section zoompan
  16429. Apply Zoom & Pan effect.
  16430. This filter accepts the following options:
  16431. @table @option
  16432. @item zoom, z
  16433. Set the zoom expression. Range is 1-10. Default is 1.
  16434. @item x
  16435. @item y
  16436. Set the x and y expression. Default is 0.
  16437. @item d
  16438. Set the duration expression in number of frames.
  16439. This sets for how many number of frames effect will last for
  16440. single input image.
  16441. @item s
  16442. Set the output image size, default is 'hd720'.
  16443. @item fps
  16444. Set the output frame rate, default is '25'.
  16445. @end table
  16446. Each expression can contain the following constants:
  16447. @table @option
  16448. @item in_w, iw
  16449. Input width.
  16450. @item in_h, ih
  16451. Input height.
  16452. @item out_w, ow
  16453. Output width.
  16454. @item out_h, oh
  16455. Output height.
  16456. @item in
  16457. Input frame count.
  16458. @item on
  16459. Output frame count.
  16460. @item in_time, it
  16461. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16462. @item out_time, time, ot
  16463. The output timestamp expressed in seconds.
  16464. @item x
  16465. @item y
  16466. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  16467. for current input frame.
  16468. @item px
  16469. @item py
  16470. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16471. not yet such frame (first input frame).
  16472. @item zoom
  16473. Last calculated zoom from 'z' expression for current input frame.
  16474. @item pzoom
  16475. Last calculated zoom of last output frame of previous input frame.
  16476. @item duration
  16477. Number of output frames for current input frame. Calculated from 'd' expression
  16478. for each input frame.
  16479. @item pduration
  16480. number of output frames created for previous input frame
  16481. @item a
  16482. Rational number: input width / input height
  16483. @item sar
  16484. sample aspect ratio
  16485. @item dar
  16486. display aspect ratio
  16487. @end table
  16488. @subsection Examples
  16489. @itemize
  16490. @item
  16491. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16492. @example
  16493. 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
  16494. @end example
  16495. @item
  16496. Zoom in up to 1.5x and pan always at center of picture:
  16497. @example
  16498. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16499. @end example
  16500. @item
  16501. Same as above but without pausing:
  16502. @example
  16503. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16504. @end example
  16505. @item
  16506. Zoom in 2x into center of picture only for the first second of the input video:
  16507. @example
  16508. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16509. @end example
  16510. @end itemize
  16511. @anchor{zscale}
  16512. @section zscale
  16513. Scale (resize) the input video, using the z.lib library:
  16514. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16515. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16516. The zscale filter forces the output display aspect ratio to be the same
  16517. as the input, by changing the output sample aspect ratio.
  16518. If the input image format is different from the format requested by
  16519. the next filter, the zscale filter will convert the input to the
  16520. requested format.
  16521. @subsection Options
  16522. The filter accepts the following options.
  16523. @table @option
  16524. @item width, w
  16525. @item height, h
  16526. Set the output video dimension expression. Default value is the input
  16527. dimension.
  16528. If the @var{width} or @var{w} value is 0, the input width is used for
  16529. the output. If the @var{height} or @var{h} value is 0, the input height
  16530. is used for the output.
  16531. If one and only one of the values is -n with n >= 1, the zscale filter
  16532. will use a value that maintains the aspect ratio of the input image,
  16533. calculated from the other specified dimension. After that it will,
  16534. however, make sure that the calculated dimension is divisible by n and
  16535. adjust the value if necessary.
  16536. If both values are -n with n >= 1, the behavior will be identical to
  16537. both values being set to 0 as previously detailed.
  16538. See below for the list of accepted constants for use in the dimension
  16539. expression.
  16540. @item size, s
  16541. Set the video size. For the syntax of this option, check the
  16542. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16543. @item dither, d
  16544. Set the dither type.
  16545. Possible values are:
  16546. @table @var
  16547. @item none
  16548. @item ordered
  16549. @item random
  16550. @item error_diffusion
  16551. @end table
  16552. Default is none.
  16553. @item filter, f
  16554. Set the resize filter type.
  16555. Possible values are:
  16556. @table @var
  16557. @item point
  16558. @item bilinear
  16559. @item bicubic
  16560. @item spline16
  16561. @item spline36
  16562. @item lanczos
  16563. @end table
  16564. Default is bilinear.
  16565. @item range, r
  16566. Set the color range.
  16567. Possible values are:
  16568. @table @var
  16569. @item input
  16570. @item limited
  16571. @item full
  16572. @end table
  16573. Default is same as input.
  16574. @item primaries, p
  16575. Set the color primaries.
  16576. Possible values are:
  16577. @table @var
  16578. @item input
  16579. @item 709
  16580. @item unspecified
  16581. @item 170m
  16582. @item 240m
  16583. @item 2020
  16584. @end table
  16585. Default is same as input.
  16586. @item transfer, t
  16587. Set the transfer characteristics.
  16588. Possible values are:
  16589. @table @var
  16590. @item input
  16591. @item 709
  16592. @item unspecified
  16593. @item 601
  16594. @item linear
  16595. @item 2020_10
  16596. @item 2020_12
  16597. @item smpte2084
  16598. @item iec61966-2-1
  16599. @item arib-std-b67
  16600. @end table
  16601. Default is same as input.
  16602. @item matrix, m
  16603. Set the colorspace matrix.
  16604. Possible value are:
  16605. @table @var
  16606. @item input
  16607. @item 709
  16608. @item unspecified
  16609. @item 470bg
  16610. @item 170m
  16611. @item 2020_ncl
  16612. @item 2020_cl
  16613. @end table
  16614. Default is same as input.
  16615. @item rangein, rin
  16616. Set the input color range.
  16617. Possible values are:
  16618. @table @var
  16619. @item input
  16620. @item limited
  16621. @item full
  16622. @end table
  16623. Default is same as input.
  16624. @item primariesin, pin
  16625. Set the input color primaries.
  16626. Possible values are:
  16627. @table @var
  16628. @item input
  16629. @item 709
  16630. @item unspecified
  16631. @item 170m
  16632. @item 240m
  16633. @item 2020
  16634. @end table
  16635. Default is same as input.
  16636. @item transferin, tin
  16637. Set the input transfer characteristics.
  16638. Possible values are:
  16639. @table @var
  16640. @item input
  16641. @item 709
  16642. @item unspecified
  16643. @item 601
  16644. @item linear
  16645. @item 2020_10
  16646. @item 2020_12
  16647. @end table
  16648. Default is same as input.
  16649. @item matrixin, min
  16650. Set the input colorspace matrix.
  16651. Possible value are:
  16652. @table @var
  16653. @item input
  16654. @item 709
  16655. @item unspecified
  16656. @item 470bg
  16657. @item 170m
  16658. @item 2020_ncl
  16659. @item 2020_cl
  16660. @end table
  16661. @item chromal, c
  16662. Set the output chroma location.
  16663. Possible values are:
  16664. @table @var
  16665. @item input
  16666. @item left
  16667. @item center
  16668. @item topleft
  16669. @item top
  16670. @item bottomleft
  16671. @item bottom
  16672. @end table
  16673. @item chromalin, cin
  16674. Set the input chroma location.
  16675. Possible values are:
  16676. @table @var
  16677. @item input
  16678. @item left
  16679. @item center
  16680. @item topleft
  16681. @item top
  16682. @item bottomleft
  16683. @item bottom
  16684. @end table
  16685. @item npl
  16686. Set the nominal peak luminance.
  16687. @end table
  16688. The values of the @option{w} and @option{h} options are expressions
  16689. containing the following constants:
  16690. @table @var
  16691. @item in_w
  16692. @item in_h
  16693. The input width and height
  16694. @item iw
  16695. @item ih
  16696. These are the same as @var{in_w} and @var{in_h}.
  16697. @item out_w
  16698. @item out_h
  16699. The output (scaled) width and height
  16700. @item ow
  16701. @item oh
  16702. These are the same as @var{out_w} and @var{out_h}
  16703. @item a
  16704. The same as @var{iw} / @var{ih}
  16705. @item sar
  16706. input sample aspect ratio
  16707. @item dar
  16708. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16709. @item hsub
  16710. @item vsub
  16711. horizontal and vertical input chroma subsample values. For example for the
  16712. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16713. @item ohsub
  16714. @item ovsub
  16715. horizontal and vertical output chroma subsample values. For example for the
  16716. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16717. @end table
  16718. @subsection Commands
  16719. This filter supports the following commands:
  16720. @table @option
  16721. @item width, w
  16722. @item height, h
  16723. Set the output video dimension expression.
  16724. The command accepts the same syntax of the corresponding option.
  16725. If the specified expression is not valid, it is kept at its current
  16726. value.
  16727. @end table
  16728. @c man end VIDEO FILTERS
  16729. @chapter OpenCL Video Filters
  16730. @c man begin OPENCL VIDEO FILTERS
  16731. Below is a description of the currently available OpenCL video filters.
  16732. To enable compilation of these filters you need to configure FFmpeg with
  16733. @code{--enable-opencl}.
  16734. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16735. @table @option
  16736. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16737. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16738. given device parameters.
  16739. @item -filter_hw_device @var{name}
  16740. Pass the hardware device called @var{name} to all filters in any filter graph.
  16741. @end table
  16742. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16743. @itemize
  16744. @item
  16745. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16746. @example
  16747. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16748. @end example
  16749. @end itemize
  16750. 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.
  16751. @section avgblur_opencl
  16752. Apply average blur filter.
  16753. The filter accepts the following options:
  16754. @table @option
  16755. @item sizeX
  16756. Set horizontal radius size.
  16757. Range is @code{[1, 1024]} and default value is @code{1}.
  16758. @item planes
  16759. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16760. @item sizeY
  16761. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16762. @end table
  16763. @subsection Example
  16764. @itemize
  16765. @item
  16766. 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.
  16767. @example
  16768. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16769. @end example
  16770. @end itemize
  16771. @section boxblur_opencl
  16772. Apply a boxblur algorithm to the input video.
  16773. It accepts the following parameters:
  16774. @table @option
  16775. @item luma_radius, lr
  16776. @item luma_power, lp
  16777. @item chroma_radius, cr
  16778. @item chroma_power, cp
  16779. @item alpha_radius, ar
  16780. @item alpha_power, ap
  16781. @end table
  16782. A description of the accepted options follows.
  16783. @table @option
  16784. @item luma_radius, lr
  16785. @item chroma_radius, cr
  16786. @item alpha_radius, ar
  16787. Set an expression for the box radius in pixels used for blurring the
  16788. corresponding input plane.
  16789. The radius value must be a non-negative number, and must not be
  16790. greater than the value of the expression @code{min(w,h)/2} for the
  16791. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16792. planes.
  16793. Default value for @option{luma_radius} is "2". If not specified,
  16794. @option{chroma_radius} and @option{alpha_radius} default to the
  16795. corresponding value set for @option{luma_radius}.
  16796. The expressions can contain the following constants:
  16797. @table @option
  16798. @item w
  16799. @item h
  16800. The input width and height in pixels.
  16801. @item cw
  16802. @item ch
  16803. The input chroma image width and height in pixels.
  16804. @item hsub
  16805. @item vsub
  16806. The horizontal and vertical chroma subsample values. For example, for the
  16807. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16808. @end table
  16809. @item luma_power, lp
  16810. @item chroma_power, cp
  16811. @item alpha_power, ap
  16812. Specify how many times the boxblur filter is applied to the
  16813. corresponding plane.
  16814. Default value for @option{luma_power} is 2. If not specified,
  16815. @option{chroma_power} and @option{alpha_power} default to the
  16816. corresponding value set for @option{luma_power}.
  16817. A value of 0 will disable the effect.
  16818. @end table
  16819. @subsection Examples
  16820. 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.
  16821. @itemize
  16822. @item
  16823. Apply a boxblur filter with the luma, chroma, and alpha radius
  16824. 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.
  16825. @example
  16826. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16827. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16828. @end example
  16829. @item
  16830. 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.
  16831. For the luma plane, a 2x2 box radius will be run once.
  16832. For the chroma plane, a 4x4 box radius will be run 5 times.
  16833. For the alpha plane, a 3x3 box radius will be run 7 times.
  16834. @example
  16835. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16836. @end example
  16837. @end itemize
  16838. @section colorkey_opencl
  16839. RGB colorspace color keying.
  16840. The filter accepts the following options:
  16841. @table @option
  16842. @item color
  16843. The color which will be replaced with transparency.
  16844. @item similarity
  16845. Similarity percentage with the key color.
  16846. 0.01 matches only the exact key color, while 1.0 matches everything.
  16847. @item blend
  16848. Blend percentage.
  16849. 0.0 makes pixels either fully transparent, or not transparent at all.
  16850. Higher values result in semi-transparent pixels, with a higher transparency
  16851. the more similar the pixels color is to the key color.
  16852. @end table
  16853. @subsection Examples
  16854. @itemize
  16855. @item
  16856. Make every semi-green pixel in the input transparent with some slight blending:
  16857. @example
  16858. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16859. @end example
  16860. @end itemize
  16861. @section convolution_opencl
  16862. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16863. The filter accepts the following options:
  16864. @table @option
  16865. @item 0m
  16866. @item 1m
  16867. @item 2m
  16868. @item 3m
  16869. Set matrix for each plane.
  16870. Matrix is sequence of 9, 25 or 49 signed numbers.
  16871. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16872. @item 0rdiv
  16873. @item 1rdiv
  16874. @item 2rdiv
  16875. @item 3rdiv
  16876. Set multiplier for calculated value for each plane.
  16877. If unset or 0, it will be sum of all matrix elements.
  16878. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16879. @item 0bias
  16880. @item 1bias
  16881. @item 2bias
  16882. @item 3bias
  16883. Set bias for each plane. This value is added to the result of the multiplication.
  16884. Useful for making the overall image brighter or darker.
  16885. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16886. @end table
  16887. @subsection Examples
  16888. @itemize
  16889. @item
  16890. Apply sharpen:
  16891. @example
  16892. -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
  16893. @end example
  16894. @item
  16895. Apply blur:
  16896. @example
  16897. -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
  16898. @end example
  16899. @item
  16900. Apply edge enhance:
  16901. @example
  16902. -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
  16903. @end example
  16904. @item
  16905. Apply edge detect:
  16906. @example
  16907. -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
  16908. @end example
  16909. @item
  16910. Apply laplacian edge detector which includes diagonals:
  16911. @example
  16912. -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
  16913. @end example
  16914. @item
  16915. Apply emboss:
  16916. @example
  16917. -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
  16918. @end example
  16919. @end itemize
  16920. @section erosion_opencl
  16921. Apply erosion effect to the video.
  16922. This filter replaces the pixel by the local(3x3) minimum.
  16923. It accepts the following options:
  16924. @table @option
  16925. @item threshold0
  16926. @item threshold1
  16927. @item threshold2
  16928. @item threshold3
  16929. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16930. If @code{0}, plane will remain unchanged.
  16931. @item coordinates
  16932. Flag which specifies the pixel to refer to.
  16933. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16934. Flags to local 3x3 coordinates region centered on @code{x}:
  16935. 1 2 3
  16936. 4 x 5
  16937. 6 7 8
  16938. @end table
  16939. @subsection Example
  16940. @itemize
  16941. @item
  16942. 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.
  16943. @example
  16944. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16945. @end example
  16946. @end itemize
  16947. @section deshake_opencl
  16948. Feature-point based video stabilization filter.
  16949. The filter accepts the following options:
  16950. @table @option
  16951. @item tripod
  16952. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16953. @item debug
  16954. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16955. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16956. Viewing point matches in the output video is only supported for RGB input.
  16957. Defaults to @code{0}.
  16958. @item adaptive_crop
  16959. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16960. Defaults to @code{1}.
  16961. @item refine_features
  16962. Whether or not feature points should be refined at a sub-pixel level.
  16963. This can be turned off for a slight performance gain at the cost of precision.
  16964. Defaults to @code{1}.
  16965. @item smooth_strength
  16966. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16967. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16968. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16969. Defaults to @code{0.0}.
  16970. @item smooth_window_multiplier
  16971. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16972. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16973. Acceptable values range from @code{0.1} to @code{10.0}.
  16974. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16975. potentially improving smoothness, but also increase latency and memory usage.
  16976. Defaults to @code{2.0}.
  16977. @end table
  16978. @subsection Examples
  16979. @itemize
  16980. @item
  16981. Stabilize a video with a fixed, medium smoothing strength:
  16982. @example
  16983. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16984. @end example
  16985. @item
  16986. Stabilize a video with debugging (both in console and in rendered video):
  16987. @example
  16988. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16989. @end example
  16990. @end itemize
  16991. @section dilation_opencl
  16992. Apply dilation effect to the video.
  16993. This filter replaces the pixel by the local(3x3) maximum.
  16994. It accepts the following options:
  16995. @table @option
  16996. @item threshold0
  16997. @item threshold1
  16998. @item threshold2
  16999. @item threshold3
  17000. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  17001. If @code{0}, plane will remain unchanged.
  17002. @item coordinates
  17003. Flag which specifies the pixel to refer to.
  17004. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  17005. Flags to local 3x3 coordinates region centered on @code{x}:
  17006. 1 2 3
  17007. 4 x 5
  17008. 6 7 8
  17009. @end table
  17010. @subsection Example
  17011. @itemize
  17012. @item
  17013. 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.
  17014. @example
  17015. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  17016. @end example
  17017. @end itemize
  17018. @section nlmeans_opencl
  17019. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  17020. @section overlay_opencl
  17021. Overlay one video on top of another.
  17022. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  17023. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  17024. The filter accepts the following options:
  17025. @table @option
  17026. @item x
  17027. Set the x coordinate of the overlaid video on the main video.
  17028. Default value is @code{0}.
  17029. @item y
  17030. Set the y coordinate of the overlaid video on the main video.
  17031. Default value is @code{0}.
  17032. @end table
  17033. @subsection Examples
  17034. @itemize
  17035. @item
  17036. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  17037. @example
  17038. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  17039. @end example
  17040. @item
  17041. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  17042. @example
  17043. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  17044. @end example
  17045. @end itemize
  17046. @section pad_opencl
  17047. Add paddings to the input image, and place the original input at the
  17048. provided @var{x}, @var{y} coordinates.
  17049. It accepts the following options:
  17050. @table @option
  17051. @item width, w
  17052. @item height, h
  17053. Specify an expression for the size of the output image with the
  17054. paddings added. If the value for @var{width} or @var{height} is 0, the
  17055. corresponding input size is used for the output.
  17056. The @var{width} expression can reference the value set by the
  17057. @var{height} expression, and vice versa.
  17058. The default value of @var{width} and @var{height} is 0.
  17059. @item x
  17060. @item y
  17061. Specify the offsets to place the input image at within the padded area,
  17062. with respect to the top/left border of the output image.
  17063. The @var{x} expression can reference the value set by the @var{y}
  17064. expression, and vice versa.
  17065. The default value of @var{x} and @var{y} is 0.
  17066. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  17067. so the input image is centered on the padded area.
  17068. @item color
  17069. Specify the color of the padded area. For the syntax of this option,
  17070. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  17071. manual,ffmpeg-utils}.
  17072. @item aspect
  17073. Pad to an aspect instead to a resolution.
  17074. @end table
  17075. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  17076. options are expressions containing the following constants:
  17077. @table @option
  17078. @item in_w
  17079. @item in_h
  17080. The input video width and height.
  17081. @item iw
  17082. @item ih
  17083. These are the same as @var{in_w} and @var{in_h}.
  17084. @item out_w
  17085. @item out_h
  17086. The output width and height (the size of the padded area), as
  17087. specified by the @var{width} and @var{height} expressions.
  17088. @item ow
  17089. @item oh
  17090. These are the same as @var{out_w} and @var{out_h}.
  17091. @item x
  17092. @item y
  17093. The x and y offsets as specified by the @var{x} and @var{y}
  17094. expressions, or NAN if not yet specified.
  17095. @item a
  17096. same as @var{iw} / @var{ih}
  17097. @item sar
  17098. input sample aspect ratio
  17099. @item dar
  17100. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  17101. @end table
  17102. @section prewitt_opencl
  17103. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  17104. The filter accepts the following option:
  17105. @table @option
  17106. @item planes
  17107. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17108. @item scale
  17109. Set value which will be multiplied with filtered result.
  17110. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17111. @item delta
  17112. Set value which will be added to filtered result.
  17113. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17114. @end table
  17115. @subsection Example
  17116. @itemize
  17117. @item
  17118. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  17119. @example
  17120. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17121. @end example
  17122. @end itemize
  17123. @anchor{program_opencl}
  17124. @section program_opencl
  17125. Filter video using an OpenCL program.
  17126. @table @option
  17127. @item source
  17128. OpenCL program source file.
  17129. @item kernel
  17130. Kernel name in program.
  17131. @item inputs
  17132. Number of inputs to the filter. Defaults to 1.
  17133. @item size, s
  17134. Size of output frames. Defaults to the same as the first input.
  17135. @end table
  17136. The @code{program_opencl} filter also supports the @ref{framesync} options.
  17137. The program source file must contain a kernel function with the given name,
  17138. which will be run once for each plane of the output. Each run on a plane
  17139. gets enqueued as a separate 2D global NDRange with one work-item for each
  17140. pixel to be generated. The global ID offset for each work-item is therefore
  17141. the coordinates of a pixel in the destination image.
  17142. The kernel function needs to take the following arguments:
  17143. @itemize
  17144. @item
  17145. Destination image, @var{__write_only image2d_t}.
  17146. This image will become the output; the kernel should write all of it.
  17147. @item
  17148. Frame index, @var{unsigned int}.
  17149. This is a counter starting from zero and increasing by one for each frame.
  17150. @item
  17151. Source images, @var{__read_only image2d_t}.
  17152. These are the most recent images on each input. The kernel may read from
  17153. them to generate the output, but they can't be written to.
  17154. @end itemize
  17155. Example programs:
  17156. @itemize
  17157. @item
  17158. Copy the input to the output (output must be the same size as the input).
  17159. @verbatim
  17160. __kernel void copy(__write_only image2d_t destination,
  17161. unsigned int index,
  17162. __read_only image2d_t source)
  17163. {
  17164. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  17165. int2 location = (int2)(get_global_id(0), get_global_id(1));
  17166. float4 value = read_imagef(source, sampler, location);
  17167. write_imagef(destination, location, value);
  17168. }
  17169. @end verbatim
  17170. @item
  17171. Apply a simple transformation, rotating the input by an amount increasing
  17172. with the index counter. Pixel values are linearly interpolated by the
  17173. sampler, and the output need not have the same dimensions as the input.
  17174. @verbatim
  17175. __kernel void rotate_image(__write_only image2d_t dst,
  17176. unsigned int index,
  17177. __read_only image2d_t src)
  17178. {
  17179. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17180. CLK_FILTER_LINEAR);
  17181. float angle = (float)index / 100.0f;
  17182. float2 dst_dim = convert_float2(get_image_dim(dst));
  17183. float2 src_dim = convert_float2(get_image_dim(src));
  17184. float2 dst_cen = dst_dim / 2.0f;
  17185. float2 src_cen = src_dim / 2.0f;
  17186. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17187. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  17188. float2 src_pos = {
  17189. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  17190. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  17191. };
  17192. src_pos = src_pos * src_dim / dst_dim;
  17193. float2 src_loc = src_pos + src_cen;
  17194. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  17195. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  17196. write_imagef(dst, dst_loc, 0.5f);
  17197. else
  17198. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  17199. }
  17200. @end verbatim
  17201. @item
  17202. Blend two inputs together, with the amount of each input used varying
  17203. with the index counter.
  17204. @verbatim
  17205. __kernel void blend_images(__write_only image2d_t dst,
  17206. unsigned int index,
  17207. __read_only image2d_t src1,
  17208. __read_only image2d_t src2)
  17209. {
  17210. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17211. CLK_FILTER_LINEAR);
  17212. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  17213. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17214. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  17215. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  17216. float4 val1 = read_imagef(src1, sampler, src1_loc);
  17217. float4 val2 = read_imagef(src2, sampler, src2_loc);
  17218. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  17219. }
  17220. @end verbatim
  17221. @end itemize
  17222. @section roberts_opencl
  17223. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  17224. The filter accepts the following option:
  17225. @table @option
  17226. @item planes
  17227. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17228. @item scale
  17229. Set value which will be multiplied with filtered result.
  17230. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17231. @item delta
  17232. Set value which will be added to filtered result.
  17233. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17234. @end table
  17235. @subsection Example
  17236. @itemize
  17237. @item
  17238. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  17239. @example
  17240. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17241. @end example
  17242. @end itemize
  17243. @section sobel_opencl
  17244. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  17245. The filter accepts the following option:
  17246. @table @option
  17247. @item planes
  17248. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17249. @item scale
  17250. Set value which will be multiplied with filtered result.
  17251. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17252. @item delta
  17253. Set value which will be added to filtered result.
  17254. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17255. @end table
  17256. @subsection Example
  17257. @itemize
  17258. @item
  17259. Apply sobel operator with scale set to 2 and delta set to 10
  17260. @example
  17261. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17262. @end example
  17263. @end itemize
  17264. @section tonemap_opencl
  17265. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  17266. It accepts the following parameters:
  17267. @table @option
  17268. @item tonemap
  17269. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  17270. @item param
  17271. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  17272. @item desat
  17273. Apply desaturation for highlights that exceed this level of brightness. The
  17274. higher the parameter, the more color information will be preserved. This
  17275. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17276. (smoothly) turning into white instead. This makes images feel more natural,
  17277. at the cost of reducing information about out-of-range colors.
  17278. The default value is 0.5, and the algorithm here is a little different from
  17279. the cpu version tonemap currently. A setting of 0.0 disables this option.
  17280. @item threshold
  17281. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  17282. is used to detect whether the scene has changed or not. If the distance between
  17283. the current frame average brightness and the current running average exceeds
  17284. a threshold value, we would re-calculate scene average and peak brightness.
  17285. The default value is 0.2.
  17286. @item format
  17287. Specify the output pixel format.
  17288. Currently supported formats are:
  17289. @table @var
  17290. @item p010
  17291. @item nv12
  17292. @end table
  17293. @item range, r
  17294. Set the output color range.
  17295. Possible values are:
  17296. @table @var
  17297. @item tv/mpeg
  17298. @item pc/jpeg
  17299. @end table
  17300. Default is same as input.
  17301. @item primaries, p
  17302. Set the output color primaries.
  17303. Possible values are:
  17304. @table @var
  17305. @item bt709
  17306. @item bt2020
  17307. @end table
  17308. Default is same as input.
  17309. @item transfer, t
  17310. Set the output transfer characteristics.
  17311. Possible values are:
  17312. @table @var
  17313. @item bt709
  17314. @item bt2020
  17315. @end table
  17316. Default is bt709.
  17317. @item matrix, m
  17318. Set the output colorspace matrix.
  17319. Possible value are:
  17320. @table @var
  17321. @item bt709
  17322. @item bt2020
  17323. @end table
  17324. Default is same as input.
  17325. @end table
  17326. @subsection Example
  17327. @itemize
  17328. @item
  17329. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  17330. @example
  17331. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  17332. @end example
  17333. @end itemize
  17334. @section unsharp_opencl
  17335. Sharpen or blur the input video.
  17336. It accepts the following parameters:
  17337. @table @option
  17338. @item luma_msize_x, lx
  17339. Set the luma matrix horizontal size.
  17340. Range is @code{[1, 23]} and default value is @code{5}.
  17341. @item luma_msize_y, ly
  17342. Set the luma matrix vertical size.
  17343. Range is @code{[1, 23]} and default value is @code{5}.
  17344. @item luma_amount, la
  17345. Set the luma effect strength.
  17346. Range is @code{[-10, 10]} and default value is @code{1.0}.
  17347. Negative values will blur the input video, while positive values will
  17348. sharpen it, a value of zero will disable the effect.
  17349. @item chroma_msize_x, cx
  17350. Set the chroma matrix horizontal size.
  17351. Range is @code{[1, 23]} and default value is @code{5}.
  17352. @item chroma_msize_y, cy
  17353. Set the chroma matrix vertical size.
  17354. Range is @code{[1, 23]} and default value is @code{5}.
  17355. @item chroma_amount, ca
  17356. Set the chroma effect strength.
  17357. Range is @code{[-10, 10]} and default value is @code{0.0}.
  17358. Negative values will blur the input video, while positive values will
  17359. sharpen it, a value of zero will disable the effect.
  17360. @end table
  17361. All parameters are optional and default to the equivalent of the
  17362. string '5:5:1.0:5:5:0.0'.
  17363. @subsection Examples
  17364. @itemize
  17365. @item
  17366. Apply strong luma sharpen effect:
  17367. @example
  17368. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  17369. @end example
  17370. @item
  17371. Apply a strong blur of both luma and chroma parameters:
  17372. @example
  17373. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  17374. @end example
  17375. @end itemize
  17376. @section xfade_opencl
  17377. Cross fade two videos with custom transition effect by using OpenCL.
  17378. It accepts the following options:
  17379. @table @option
  17380. @item transition
  17381. Set one of possible transition effects.
  17382. @table @option
  17383. @item custom
  17384. Select custom transition effect, the actual transition description
  17385. will be picked from source and kernel options.
  17386. @item fade
  17387. @item wipeleft
  17388. @item wiperight
  17389. @item wipeup
  17390. @item wipedown
  17391. @item slideleft
  17392. @item slideright
  17393. @item slideup
  17394. @item slidedown
  17395. Default transition is fade.
  17396. @end table
  17397. @item source
  17398. OpenCL program source file for custom transition.
  17399. @item kernel
  17400. Set name of kernel to use for custom transition from program source file.
  17401. @item duration
  17402. Set duration of video transition.
  17403. @item offset
  17404. Set time of start of transition relative to first video.
  17405. @end table
  17406. The program source file must contain a kernel function with the given name,
  17407. which will be run once for each plane of the output. Each run on a plane
  17408. gets enqueued as a separate 2D global NDRange with one work-item for each
  17409. pixel to be generated. The global ID offset for each work-item is therefore
  17410. the coordinates of a pixel in the destination image.
  17411. The kernel function needs to take the following arguments:
  17412. @itemize
  17413. @item
  17414. Destination image, @var{__write_only image2d_t}.
  17415. This image will become the output; the kernel should write all of it.
  17416. @item
  17417. First Source image, @var{__read_only image2d_t}.
  17418. Second Source image, @var{__read_only image2d_t}.
  17419. These are the most recent images on each input. The kernel may read from
  17420. them to generate the output, but they can't be written to.
  17421. @item
  17422. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  17423. @end itemize
  17424. Example programs:
  17425. @itemize
  17426. @item
  17427. Apply dots curtain transition effect:
  17428. @verbatim
  17429. __kernel void blend_images(__write_only image2d_t dst,
  17430. __read_only image2d_t src1,
  17431. __read_only image2d_t src2,
  17432. float progress)
  17433. {
  17434. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17435. CLK_FILTER_LINEAR);
  17436. int2 p = (int2)(get_global_id(0), get_global_id(1));
  17437. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  17438. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  17439. rp = rp / dim;
  17440. float2 dots = (float2)(20.0, 20.0);
  17441. float2 center = (float2)(0,0);
  17442. float2 unused;
  17443. float4 val1 = read_imagef(src1, sampler, p);
  17444. float4 val2 = read_imagef(src2, sampler, p);
  17445. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  17446. write_imagef(dst, p, next ? val1 : val2);
  17447. }
  17448. @end verbatim
  17449. @end itemize
  17450. @c man end OPENCL VIDEO FILTERS
  17451. @chapter VAAPI Video Filters
  17452. @c man begin VAAPI VIDEO FILTERS
  17453. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  17454. To enable compilation of these filters you need to configure FFmpeg with
  17455. @code{--enable-vaapi}.
  17456. 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}
  17457. @section tonemap_vaapi
  17458. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  17459. It maps the dynamic range of HDR10 content to the SDR content.
  17460. It currently only accepts HDR10 as input.
  17461. It accepts the following parameters:
  17462. @table @option
  17463. @item format
  17464. Specify the output pixel format.
  17465. Currently supported formats are:
  17466. @table @var
  17467. @item p010
  17468. @item nv12
  17469. @end table
  17470. Default is nv12.
  17471. @item primaries, p
  17472. Set the output color primaries.
  17473. Default is same as input.
  17474. @item transfer, t
  17475. Set the output transfer characteristics.
  17476. Default is bt709.
  17477. @item matrix, m
  17478. Set the output colorspace matrix.
  17479. Default is same as input.
  17480. @end table
  17481. @subsection Example
  17482. @itemize
  17483. @item
  17484. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17485. @example
  17486. tonemap_vaapi=format=p010:t=bt2020-10
  17487. @end example
  17488. @end itemize
  17489. @c man end VAAPI VIDEO FILTERS
  17490. @chapter Video Sources
  17491. @c man begin VIDEO SOURCES
  17492. Below is a description of the currently available video sources.
  17493. @section buffer
  17494. Buffer video frames, and make them available to the filter chain.
  17495. This source is mainly intended for a programmatic use, in particular
  17496. through the interface defined in @file{libavfilter/buffersrc.h}.
  17497. It accepts the following parameters:
  17498. @table @option
  17499. @item video_size
  17500. Specify the size (width and height) of the buffered video frames. For the
  17501. syntax of this option, check the
  17502. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17503. @item width
  17504. The input video width.
  17505. @item height
  17506. The input video height.
  17507. @item pix_fmt
  17508. A string representing the pixel format of the buffered video frames.
  17509. It may be a number corresponding to a pixel format, or a pixel format
  17510. name.
  17511. @item time_base
  17512. Specify the timebase assumed by the timestamps of the buffered frames.
  17513. @item frame_rate
  17514. Specify the frame rate expected for the video stream.
  17515. @item pixel_aspect, sar
  17516. The sample (pixel) aspect ratio of the input video.
  17517. @item sws_param
  17518. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17519. to the filtergraph description to specify swscale flags for automatically
  17520. inserted scalers. See @ref{Filtergraph syntax}.
  17521. @item hw_frames_ctx
  17522. When using a hardware pixel format, this should be a reference to an
  17523. AVHWFramesContext describing input frames.
  17524. @end table
  17525. For example:
  17526. @example
  17527. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17528. @end example
  17529. will instruct the source to accept video frames with size 320x240 and
  17530. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17531. square pixels (1:1 sample aspect ratio).
  17532. Since the pixel format with name "yuv410p" corresponds to the number 6
  17533. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17534. this example corresponds to:
  17535. @example
  17536. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17537. @end example
  17538. Alternatively, the options can be specified as a flat string, but this
  17539. syntax is deprecated:
  17540. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17541. @section cellauto
  17542. Create a pattern generated by an elementary cellular automaton.
  17543. The initial state of the cellular automaton can be defined through the
  17544. @option{filename} and @option{pattern} options. If such options are
  17545. not specified an initial state is created randomly.
  17546. At each new frame a new row in the video is filled with the result of
  17547. the cellular automaton next generation. The behavior when the whole
  17548. frame is filled is defined by the @option{scroll} option.
  17549. This source accepts the following options:
  17550. @table @option
  17551. @item filename, f
  17552. Read the initial cellular automaton state, i.e. the starting row, from
  17553. the specified file.
  17554. In the file, each non-whitespace character is considered an alive
  17555. cell, a newline will terminate the row, and further characters in the
  17556. file will be ignored.
  17557. @item pattern, p
  17558. Read the initial cellular automaton state, i.e. the starting row, from
  17559. the specified string.
  17560. Each non-whitespace character in the string is considered an alive
  17561. cell, a newline will terminate the row, and further characters in the
  17562. string will be ignored.
  17563. @item rate, r
  17564. Set the video rate, that is the number of frames generated per second.
  17565. Default is 25.
  17566. @item random_fill_ratio, ratio
  17567. Set the random fill ratio for the initial cellular automaton row. It
  17568. is a floating point number value ranging from 0 to 1, defaults to
  17569. 1/PHI.
  17570. This option is ignored when a file or a pattern is specified.
  17571. @item random_seed, seed
  17572. Set the seed for filling randomly the initial row, must be an integer
  17573. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17574. set to -1, the filter will try to use a good random seed on a best
  17575. effort basis.
  17576. @item rule
  17577. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17578. Default value is 110.
  17579. @item size, s
  17580. Set the size of the output video. For the syntax of this option, check the
  17581. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17582. If @option{filename} or @option{pattern} is specified, the size is set
  17583. by default to the width of the specified initial state row, and the
  17584. height is set to @var{width} * PHI.
  17585. If @option{size} is set, it must contain the width of the specified
  17586. pattern string, and the specified pattern will be centered in the
  17587. larger row.
  17588. If a filename or a pattern string is not specified, the size value
  17589. defaults to "320x518" (used for a randomly generated initial state).
  17590. @item scroll
  17591. If set to 1, scroll the output upward when all the rows in the output
  17592. have been already filled. If set to 0, the new generated row will be
  17593. written over the top row just after the bottom row is filled.
  17594. Defaults to 1.
  17595. @item start_full, full
  17596. If set to 1, completely fill the output with generated rows before
  17597. outputting the first frame.
  17598. This is the default behavior, for disabling set the value to 0.
  17599. @item stitch
  17600. If set to 1, stitch the left and right row edges together.
  17601. This is the default behavior, for disabling set the value to 0.
  17602. @end table
  17603. @subsection Examples
  17604. @itemize
  17605. @item
  17606. Read the initial state from @file{pattern}, and specify an output of
  17607. size 200x400.
  17608. @example
  17609. cellauto=f=pattern:s=200x400
  17610. @end example
  17611. @item
  17612. Generate a random initial row with a width of 200 cells, with a fill
  17613. ratio of 2/3:
  17614. @example
  17615. cellauto=ratio=2/3:s=200x200
  17616. @end example
  17617. @item
  17618. Create a pattern generated by rule 18 starting by a single alive cell
  17619. centered on an initial row with width 100:
  17620. @example
  17621. cellauto=p=@@:s=100x400:full=0:rule=18
  17622. @end example
  17623. @item
  17624. Specify a more elaborated initial pattern:
  17625. @example
  17626. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17627. @end example
  17628. @end itemize
  17629. @anchor{coreimagesrc}
  17630. @section coreimagesrc
  17631. Video source generated on GPU using Apple's CoreImage API on OSX.
  17632. This video source is a specialized version of the @ref{coreimage} video filter.
  17633. Use a core image generator at the beginning of the applied filterchain to
  17634. generate the content.
  17635. The coreimagesrc video source accepts the following options:
  17636. @table @option
  17637. @item list_generators
  17638. List all available generators along with all their respective options as well as
  17639. possible minimum and maximum values along with the default values.
  17640. @example
  17641. list_generators=true
  17642. @end example
  17643. @item size, s
  17644. Specify the size of the sourced video. For the syntax of this option, check the
  17645. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17646. The default value is @code{320x240}.
  17647. @item rate, r
  17648. Specify the frame rate of the sourced video, as the number of frames
  17649. generated per second. It has to be a string in the format
  17650. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17651. number or a valid video frame rate abbreviation. The default value is
  17652. "25".
  17653. @item sar
  17654. Set the sample aspect ratio of the sourced video.
  17655. @item duration, d
  17656. Set the duration of the sourced video. See
  17657. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17658. for the accepted syntax.
  17659. If not specified, or the expressed duration is negative, the video is
  17660. supposed to be generated forever.
  17661. @end table
  17662. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17663. A complete filterchain can be used for further processing of the
  17664. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17665. and examples for details.
  17666. @subsection Examples
  17667. @itemize
  17668. @item
  17669. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17670. given as complete and escaped command-line for Apple's standard bash shell:
  17671. @example
  17672. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17673. @end example
  17674. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17675. need for a nullsrc video source.
  17676. @end itemize
  17677. @section gradients
  17678. Generate several gradients.
  17679. @table @option
  17680. @item size, s
  17681. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17682. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17683. @item rate, r
  17684. Set frame rate, expressed as number of frames per second. Default
  17685. value is "25".
  17686. @item c0, c1, c2, c3, c4, c5, c6, c7
  17687. Set 8 colors. Default values for colors is to pick random one.
  17688. @item x0, y0, y0, y1
  17689. Set gradient line source and destination points. If negative or out of range, random ones
  17690. are picked.
  17691. @item nb_colors, n
  17692. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17693. @item seed
  17694. Set seed for picking gradient line points.
  17695. @item duration, d
  17696. Set the duration of the sourced video. See
  17697. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17698. for the accepted syntax.
  17699. If not specified, or the expressed duration is negative, the video is
  17700. supposed to be generated forever.
  17701. @item speed
  17702. Set speed of gradients rotation.
  17703. @end table
  17704. @section mandelbrot
  17705. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17706. point specified with @var{start_x} and @var{start_y}.
  17707. This source accepts the following options:
  17708. @table @option
  17709. @item end_pts
  17710. Set the terminal pts value. Default value is 400.
  17711. @item end_scale
  17712. Set the terminal scale value.
  17713. Must be a floating point value. Default value is 0.3.
  17714. @item inner
  17715. Set the inner coloring mode, that is the algorithm used to draw the
  17716. Mandelbrot fractal internal region.
  17717. It shall assume one of the following values:
  17718. @table @option
  17719. @item black
  17720. Set black mode.
  17721. @item convergence
  17722. Show time until convergence.
  17723. @item mincol
  17724. Set color based on point closest to the origin of the iterations.
  17725. @item period
  17726. Set period mode.
  17727. @end table
  17728. Default value is @var{mincol}.
  17729. @item bailout
  17730. Set the bailout value. Default value is 10.0.
  17731. @item maxiter
  17732. Set the maximum of iterations performed by the rendering
  17733. algorithm. Default value is 7189.
  17734. @item outer
  17735. Set outer coloring mode.
  17736. It shall assume one of following values:
  17737. @table @option
  17738. @item iteration_count
  17739. Set iteration count mode.
  17740. @item normalized_iteration_count
  17741. set normalized iteration count mode.
  17742. @end table
  17743. Default value is @var{normalized_iteration_count}.
  17744. @item rate, r
  17745. Set frame rate, expressed as number of frames per second. Default
  17746. value is "25".
  17747. @item size, s
  17748. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17749. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17750. @item start_scale
  17751. Set the initial scale value. Default value is 3.0.
  17752. @item start_x
  17753. Set the initial x position. Must be a floating point value between
  17754. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17755. @item start_y
  17756. Set the initial y position. Must be a floating point value between
  17757. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17758. @end table
  17759. @section mptestsrc
  17760. Generate various test patterns, as generated by the MPlayer test filter.
  17761. The size of the generated video is fixed, and is 256x256.
  17762. This source is useful in particular for testing encoding features.
  17763. This source accepts the following options:
  17764. @table @option
  17765. @item rate, r
  17766. Specify the frame rate of the sourced video, as the number of frames
  17767. generated per second. It has to be a string in the format
  17768. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17769. number or a valid video frame rate abbreviation. The default value is
  17770. "25".
  17771. @item duration, d
  17772. Set the duration of the sourced video. See
  17773. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17774. for the accepted syntax.
  17775. If not specified, or the expressed duration is negative, the video is
  17776. supposed to be generated forever.
  17777. @item test, t
  17778. Set the number or the name of the test to perform. Supported tests are:
  17779. @table @option
  17780. @item dc_luma
  17781. @item dc_chroma
  17782. @item freq_luma
  17783. @item freq_chroma
  17784. @item amp_luma
  17785. @item amp_chroma
  17786. @item cbp
  17787. @item mv
  17788. @item ring1
  17789. @item ring2
  17790. @item all
  17791. @item max_frames, m
  17792. Set the maximum number of frames generated for each test, default value is 30.
  17793. @end table
  17794. Default value is "all", which will cycle through the list of all tests.
  17795. @end table
  17796. Some examples:
  17797. @example
  17798. mptestsrc=t=dc_luma
  17799. @end example
  17800. will generate a "dc_luma" test pattern.
  17801. @section frei0r_src
  17802. Provide a frei0r source.
  17803. To enable compilation of this filter you need to install the frei0r
  17804. header and configure FFmpeg with @code{--enable-frei0r}.
  17805. This source accepts the following parameters:
  17806. @table @option
  17807. @item size
  17808. The size of the video to generate. For the syntax of this option, check the
  17809. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17810. @item framerate
  17811. The framerate of the generated video. It may be a string of the form
  17812. @var{num}/@var{den} or a frame rate abbreviation.
  17813. @item filter_name
  17814. The name to the frei0r source to load. For more information regarding frei0r and
  17815. how to set the parameters, read the @ref{frei0r} section in the video filters
  17816. documentation.
  17817. @item filter_params
  17818. A '|'-separated list of parameters to pass to the frei0r source.
  17819. @end table
  17820. For example, to generate a frei0r partik0l source with size 200x200
  17821. and frame rate 10 which is overlaid on the overlay filter main input:
  17822. @example
  17823. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17824. @end example
  17825. @section life
  17826. Generate a life pattern.
  17827. This source is based on a generalization of John Conway's life game.
  17828. The sourced input represents a life grid, each pixel represents a cell
  17829. which can be in one of two possible states, alive or dead. Every cell
  17830. interacts with its eight neighbours, which are the cells that are
  17831. horizontally, vertically, or diagonally adjacent.
  17832. At each interaction the grid evolves according to the adopted rule,
  17833. which specifies the number of neighbor alive cells which will make a
  17834. cell stay alive or born. The @option{rule} option allows one to specify
  17835. the rule to adopt.
  17836. This source accepts the following options:
  17837. @table @option
  17838. @item filename, f
  17839. Set the file from which to read the initial grid state. In the file,
  17840. each non-whitespace character is considered an alive cell, and newline
  17841. is used to delimit the end of each row.
  17842. If this option is not specified, the initial grid is generated
  17843. randomly.
  17844. @item rate, r
  17845. Set the video rate, that is the number of frames generated per second.
  17846. Default is 25.
  17847. @item random_fill_ratio, ratio
  17848. Set the random fill ratio for the initial random grid. It is a
  17849. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17850. It is ignored when a file is specified.
  17851. @item random_seed, seed
  17852. Set the seed for filling the initial random grid, must be an integer
  17853. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17854. set to -1, the filter will try to use a good random seed on a best
  17855. effort basis.
  17856. @item rule
  17857. Set the life rule.
  17858. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17859. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17860. @var{NS} specifies the number of alive neighbor cells which make a
  17861. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17862. which make a dead cell to become alive (i.e. to "born").
  17863. "s" and "b" can be used in place of "S" and "B", respectively.
  17864. Alternatively a rule can be specified by an 18-bits integer. The 9
  17865. high order bits are used to encode the next cell state if it is alive
  17866. for each number of neighbor alive cells, the low order bits specify
  17867. the rule for "borning" new cells. Higher order bits encode for an
  17868. higher number of neighbor cells.
  17869. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17870. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17871. Default value is "S23/B3", which is the original Conway's game of life
  17872. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17873. cells, and will born a new cell if there are three alive cells around
  17874. a dead cell.
  17875. @item size, s
  17876. Set the size of the output video. For the syntax of this option, check the
  17877. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17878. If @option{filename} is specified, the size is set by default to the
  17879. same size of the input file. If @option{size} is set, it must contain
  17880. the size specified in the input file, and the initial grid defined in
  17881. that file is centered in the larger resulting area.
  17882. If a filename is not specified, the size value defaults to "320x240"
  17883. (used for a randomly generated initial grid).
  17884. @item stitch
  17885. If set to 1, stitch the left and right grid edges together, and the
  17886. top and bottom edges also. Defaults to 1.
  17887. @item mold
  17888. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17889. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17890. value from 0 to 255.
  17891. @item life_color
  17892. Set the color of living (or new born) cells.
  17893. @item death_color
  17894. Set the color of dead cells. If @option{mold} is set, this is the first color
  17895. used to represent a dead cell.
  17896. @item mold_color
  17897. Set mold color, for definitely dead and moldy cells.
  17898. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17899. ffmpeg-utils manual,ffmpeg-utils}.
  17900. @end table
  17901. @subsection Examples
  17902. @itemize
  17903. @item
  17904. Read a grid from @file{pattern}, and center it on a grid of size
  17905. 300x300 pixels:
  17906. @example
  17907. life=f=pattern:s=300x300
  17908. @end example
  17909. @item
  17910. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17911. @example
  17912. life=ratio=2/3:s=200x200
  17913. @end example
  17914. @item
  17915. Specify a custom rule for evolving a randomly generated grid:
  17916. @example
  17917. life=rule=S14/B34
  17918. @end example
  17919. @item
  17920. Full example with slow death effect (mold) using @command{ffplay}:
  17921. @example
  17922. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17923. @end example
  17924. @end itemize
  17925. @anchor{allrgb}
  17926. @anchor{allyuv}
  17927. @anchor{color}
  17928. @anchor{haldclutsrc}
  17929. @anchor{nullsrc}
  17930. @anchor{pal75bars}
  17931. @anchor{pal100bars}
  17932. @anchor{rgbtestsrc}
  17933. @anchor{smptebars}
  17934. @anchor{smptehdbars}
  17935. @anchor{testsrc}
  17936. @anchor{testsrc2}
  17937. @anchor{yuvtestsrc}
  17938. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17939. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17940. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17941. The @code{color} source provides an uniformly colored input.
  17942. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17943. @ref{haldclut} filter.
  17944. The @code{nullsrc} source returns unprocessed video frames. It is
  17945. mainly useful to be employed in analysis / debugging tools, or as the
  17946. source for filters which ignore the input data.
  17947. The @code{pal75bars} source generates a color bars pattern, based on
  17948. EBU PAL recommendations with 75% color levels.
  17949. The @code{pal100bars} source generates a color bars pattern, based on
  17950. EBU PAL recommendations with 100% color levels.
  17951. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17952. detecting RGB vs BGR issues. You should see a red, green and blue
  17953. stripe from top to bottom.
  17954. The @code{smptebars} source generates a color bars pattern, based on
  17955. the SMPTE Engineering Guideline EG 1-1990.
  17956. The @code{smptehdbars} source generates a color bars pattern, based on
  17957. the SMPTE RP 219-2002.
  17958. The @code{testsrc} source generates a test video pattern, showing a
  17959. color pattern, a scrolling gradient and a timestamp. This is mainly
  17960. intended for testing purposes.
  17961. The @code{testsrc2} source is similar to testsrc, but supports more
  17962. pixel formats instead of just @code{rgb24}. This allows using it as an
  17963. input for other tests without requiring a format conversion.
  17964. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17965. see a y, cb and cr stripe from top to bottom.
  17966. The sources accept the following parameters:
  17967. @table @option
  17968. @item level
  17969. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17970. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17971. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17972. coded on a @code{1/(N*N)} scale.
  17973. @item color, c
  17974. Specify the color of the source, only available in the @code{color}
  17975. source. For the syntax of this option, check the
  17976. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17977. @item size, s
  17978. Specify the size of the sourced video. For the syntax of this option, check the
  17979. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17980. The default value is @code{320x240}.
  17981. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17982. @code{haldclutsrc} filters.
  17983. @item rate, r
  17984. Specify the frame rate of the sourced video, as the number of frames
  17985. generated per second. It has to be a string in the format
  17986. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17987. number or a valid video frame rate abbreviation. The default value is
  17988. "25".
  17989. @item duration, d
  17990. Set the duration of the sourced video. See
  17991. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17992. for the accepted syntax.
  17993. If not specified, or the expressed duration is negative, the video is
  17994. supposed to be generated forever.
  17995. Since the frame rate is used as time base, all frames including the last one
  17996. will have their full duration. If the specified duration is not a multiple
  17997. of the frame duration, it will be rounded up.
  17998. @item sar
  17999. Set the sample aspect ratio of the sourced video.
  18000. @item alpha
  18001. Specify the alpha (opacity) of the background, only available in the
  18002. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  18003. 255 (fully opaque, the default).
  18004. @item decimals, n
  18005. Set the number of decimals to show in the timestamp, only available in the
  18006. @code{testsrc} source.
  18007. The displayed timestamp value will correspond to the original
  18008. timestamp value multiplied by the power of 10 of the specified
  18009. value. Default value is 0.
  18010. @end table
  18011. @subsection Examples
  18012. @itemize
  18013. @item
  18014. Generate a video with a duration of 5.3 seconds, with size
  18015. 176x144 and a frame rate of 10 frames per second:
  18016. @example
  18017. testsrc=duration=5.3:size=qcif:rate=10
  18018. @end example
  18019. @item
  18020. The following graph description will generate a red source
  18021. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  18022. frames per second:
  18023. @example
  18024. color=c=red@@0.2:s=qcif:r=10
  18025. @end example
  18026. @item
  18027. If the input content is to be ignored, @code{nullsrc} can be used. The
  18028. following command generates noise in the luminance plane by employing
  18029. the @code{geq} filter:
  18030. @example
  18031. nullsrc=s=256x256, geq=random(1)*255:128:128
  18032. @end example
  18033. @end itemize
  18034. @subsection Commands
  18035. The @code{color} source supports the following commands:
  18036. @table @option
  18037. @item c, color
  18038. Set the color of the created image. Accepts the same syntax of the
  18039. corresponding @option{color} option.
  18040. @end table
  18041. @section openclsrc
  18042. Generate video using an OpenCL program.
  18043. @table @option
  18044. @item source
  18045. OpenCL program source file.
  18046. @item kernel
  18047. Kernel name in program.
  18048. @item size, s
  18049. Size of frames to generate. This must be set.
  18050. @item format
  18051. Pixel format to use for the generated frames. This must be set.
  18052. @item rate, r
  18053. Number of frames generated every second. Default value is '25'.
  18054. @end table
  18055. For details of how the program loading works, see the @ref{program_opencl}
  18056. filter.
  18057. Example programs:
  18058. @itemize
  18059. @item
  18060. Generate a colour ramp by setting pixel values from the position of the pixel
  18061. in the output image. (Note that this will work with all pixel formats, but
  18062. the generated output will not be the same.)
  18063. @verbatim
  18064. __kernel void ramp(__write_only image2d_t dst,
  18065. unsigned int index)
  18066. {
  18067. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  18068. float4 val;
  18069. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  18070. write_imagef(dst, loc, val);
  18071. }
  18072. @end verbatim
  18073. @item
  18074. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  18075. @verbatim
  18076. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  18077. unsigned int index)
  18078. {
  18079. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  18080. float4 value = 0.0f;
  18081. int x = loc.x + index;
  18082. int y = loc.y + index;
  18083. while (x > 0 || y > 0) {
  18084. if (x % 3 == 1 && y % 3 == 1) {
  18085. value = 1.0f;
  18086. break;
  18087. }
  18088. x /= 3;
  18089. y /= 3;
  18090. }
  18091. write_imagef(dst, loc, value);
  18092. }
  18093. @end verbatim
  18094. @end itemize
  18095. @section sierpinski
  18096. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  18097. This source accepts the following options:
  18098. @table @option
  18099. @item size, s
  18100. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  18101. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  18102. @item rate, r
  18103. Set frame rate, expressed as number of frames per second. Default
  18104. value is "25".
  18105. @item seed
  18106. Set seed which is used for random panning.
  18107. @item jump
  18108. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  18109. @item type
  18110. Set fractal type, can be default @code{carpet} or @code{triangle}.
  18111. @end table
  18112. @c man end VIDEO SOURCES
  18113. @chapter Video Sinks
  18114. @c man begin VIDEO SINKS
  18115. Below is a description of the currently available video sinks.
  18116. @section buffersink
  18117. Buffer video frames, and make them available to the end of the filter
  18118. graph.
  18119. This sink is mainly intended for programmatic use, in particular
  18120. through the interface defined in @file{libavfilter/buffersink.h}
  18121. or the options system.
  18122. It accepts a pointer to an AVBufferSinkContext structure, which
  18123. defines the incoming buffers' formats, to be passed as the opaque
  18124. parameter to @code{avfilter_init_filter} for initialization.
  18125. @section nullsink
  18126. Null video sink: do absolutely nothing with the input video. It is
  18127. mainly useful as a template and for use in analysis / debugging
  18128. tools.
  18129. @c man end VIDEO SINKS
  18130. @chapter Multimedia Filters
  18131. @c man begin MULTIMEDIA FILTERS
  18132. Below is a description of the currently available multimedia filters.
  18133. @section abitscope
  18134. Convert input audio to a video output, displaying the audio bit scope.
  18135. The filter accepts the following options:
  18136. @table @option
  18137. @item rate, r
  18138. Set frame rate, expressed as number of frames per second. Default
  18139. value is "25".
  18140. @item size, s
  18141. Specify the video size for the output. For the syntax of this option, check the
  18142. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18143. Default value is @code{1024x256}.
  18144. @item colors
  18145. Specify list of colors separated by space or by '|' which will be used to
  18146. draw channels. Unrecognized or missing colors will be replaced
  18147. by white color.
  18148. @end table
  18149. @section adrawgraph
  18150. Draw a graph using input audio metadata.
  18151. See @ref{drawgraph}
  18152. @section agraphmonitor
  18153. See @ref{graphmonitor}.
  18154. @section ahistogram
  18155. Convert input audio to a video output, displaying the volume histogram.
  18156. The filter accepts the following options:
  18157. @table @option
  18158. @item dmode
  18159. Specify how histogram is calculated.
  18160. It accepts the following values:
  18161. @table @samp
  18162. @item single
  18163. Use single histogram for all channels.
  18164. @item separate
  18165. Use separate histogram for each channel.
  18166. @end table
  18167. Default is @code{single}.
  18168. @item rate, r
  18169. Set frame rate, expressed as number of frames per second. Default
  18170. value is "25".
  18171. @item size, s
  18172. Specify the video size for the output. For the syntax of this option, check the
  18173. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18174. Default value is @code{hd720}.
  18175. @item scale
  18176. Set display scale.
  18177. It accepts the following values:
  18178. @table @samp
  18179. @item log
  18180. logarithmic
  18181. @item sqrt
  18182. square root
  18183. @item cbrt
  18184. cubic root
  18185. @item lin
  18186. linear
  18187. @item rlog
  18188. reverse logarithmic
  18189. @end table
  18190. Default is @code{log}.
  18191. @item ascale
  18192. Set amplitude scale.
  18193. It accepts the following values:
  18194. @table @samp
  18195. @item log
  18196. logarithmic
  18197. @item lin
  18198. linear
  18199. @end table
  18200. Default is @code{log}.
  18201. @item acount
  18202. Set how much frames to accumulate in histogram.
  18203. Default is 1. Setting this to -1 accumulates all frames.
  18204. @item rheight
  18205. Set histogram ratio of window height.
  18206. @item slide
  18207. Set sonogram sliding.
  18208. It accepts the following values:
  18209. @table @samp
  18210. @item replace
  18211. replace old rows with new ones.
  18212. @item scroll
  18213. scroll from top to bottom.
  18214. @end table
  18215. Default is @code{replace}.
  18216. @end table
  18217. @section aphasemeter
  18218. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  18219. representing mean phase of current audio frame. A video output can also be produced and is
  18220. enabled by default. The audio is passed through as first output.
  18221. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  18222. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  18223. and @code{1} means channels are in phase.
  18224. The filter accepts the following options, all related to its video output:
  18225. @table @option
  18226. @item rate, r
  18227. Set the output frame rate. Default value is @code{25}.
  18228. @item size, s
  18229. Set the video size for the output. For the syntax of this option, check the
  18230. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18231. Default value is @code{800x400}.
  18232. @item rc
  18233. @item gc
  18234. @item bc
  18235. Specify the red, green, blue contrast. Default values are @code{2},
  18236. @code{7} and @code{1}.
  18237. Allowed range is @code{[0, 255]}.
  18238. @item mpc
  18239. Set color which will be used for drawing median phase. If color is
  18240. @code{none} which is default, no median phase value will be drawn.
  18241. @item video
  18242. Enable video output. Default is enabled.
  18243. @end table
  18244. @subsection phasing detection
  18245. The filter also detects out of phase and mono sequences in stereo streams.
  18246. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  18247. The filter accepts the following options for this detection:
  18248. @table @option
  18249. @item phasing
  18250. Enable mono and out of phase detection. Default is disabled.
  18251. @item tolerance, t
  18252. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  18253. Allowed range is @code{[0, 1]}.
  18254. @item angle, a
  18255. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  18256. Allowed range is @code{[90, 180]}.
  18257. @item duration, d
  18258. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  18259. @end table
  18260. @subsection Examples
  18261. @itemize
  18262. @item
  18263. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  18264. @example
  18265. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  18266. @end example
  18267. @end itemize
  18268. @section avectorscope
  18269. Convert input audio to a video output, representing the audio vector
  18270. scope.
  18271. The filter is used to measure the difference between channels of stereo
  18272. audio stream. A monaural signal, consisting of identical left and right
  18273. signal, results in straight vertical line. Any stereo separation is visible
  18274. as a deviation from this line, creating a Lissajous figure.
  18275. If the straight (or deviation from it) but horizontal line appears this
  18276. indicates that the left and right channels are out of phase.
  18277. The filter accepts the following options:
  18278. @table @option
  18279. @item mode, m
  18280. Set the vectorscope mode.
  18281. Available values are:
  18282. @table @samp
  18283. @item lissajous
  18284. Lissajous rotated by 45 degrees.
  18285. @item lissajous_xy
  18286. Same as above but not rotated.
  18287. @item polar
  18288. Shape resembling half of circle.
  18289. @end table
  18290. Default value is @samp{lissajous}.
  18291. @item size, s
  18292. Set the video size for the output. For the syntax of this option, check the
  18293. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18294. Default value is @code{400x400}.
  18295. @item rate, r
  18296. Set the output frame rate. Default value is @code{25}.
  18297. @item rc
  18298. @item gc
  18299. @item bc
  18300. @item ac
  18301. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  18302. @code{160}, @code{80} and @code{255}.
  18303. Allowed range is @code{[0, 255]}.
  18304. @item rf
  18305. @item gf
  18306. @item bf
  18307. @item af
  18308. Specify the red, green, blue and alpha fade. Default values are @code{15},
  18309. @code{10}, @code{5} and @code{5}.
  18310. Allowed range is @code{[0, 255]}.
  18311. @item zoom
  18312. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  18313. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  18314. @item draw
  18315. Set the vectorscope drawing mode.
  18316. Available values are:
  18317. @table @samp
  18318. @item dot
  18319. Draw dot for each sample.
  18320. @item line
  18321. Draw line between previous and current sample.
  18322. @end table
  18323. Default value is @samp{dot}.
  18324. @item scale
  18325. Specify amplitude scale of audio samples.
  18326. Available values are:
  18327. @table @samp
  18328. @item lin
  18329. Linear.
  18330. @item sqrt
  18331. Square root.
  18332. @item cbrt
  18333. Cubic root.
  18334. @item log
  18335. Logarithmic.
  18336. @end table
  18337. @item swap
  18338. Swap left channel axis with right channel axis.
  18339. @item mirror
  18340. Mirror axis.
  18341. @table @samp
  18342. @item none
  18343. No mirror.
  18344. @item x
  18345. Mirror only x axis.
  18346. @item y
  18347. Mirror only y axis.
  18348. @item xy
  18349. Mirror both axis.
  18350. @end table
  18351. @end table
  18352. @subsection Examples
  18353. @itemize
  18354. @item
  18355. Complete example using @command{ffplay}:
  18356. @example
  18357. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18358. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  18359. @end example
  18360. @end itemize
  18361. @section bench, abench
  18362. Benchmark part of a filtergraph.
  18363. The filter accepts the following options:
  18364. @table @option
  18365. @item action
  18366. Start or stop a timer.
  18367. Available values are:
  18368. @table @samp
  18369. @item start
  18370. Get the current time, set it as frame metadata (using the key
  18371. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  18372. @item stop
  18373. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  18374. the input frame metadata to get the time difference. Time difference, average,
  18375. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  18376. @code{min}) are then printed. The timestamps are expressed in seconds.
  18377. @end table
  18378. @end table
  18379. @subsection Examples
  18380. @itemize
  18381. @item
  18382. Benchmark @ref{selectivecolor} filter:
  18383. @example
  18384. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  18385. @end example
  18386. @end itemize
  18387. @section concat
  18388. Concatenate audio and video streams, joining them together one after the
  18389. other.
  18390. The filter works on segments of synchronized video and audio streams. All
  18391. segments must have the same number of streams of each type, and that will
  18392. also be the number of streams at output.
  18393. The filter accepts the following options:
  18394. @table @option
  18395. @item n
  18396. Set the number of segments. Default is 2.
  18397. @item v
  18398. Set the number of output video streams, that is also the number of video
  18399. streams in each segment. Default is 1.
  18400. @item a
  18401. Set the number of output audio streams, that is also the number of audio
  18402. streams in each segment. Default is 0.
  18403. @item unsafe
  18404. Activate unsafe mode: do not fail if segments have a different format.
  18405. @end table
  18406. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  18407. @var{a} audio outputs.
  18408. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  18409. segment, in the same order as the outputs, then the inputs for the second
  18410. segment, etc.
  18411. Related streams do not always have exactly the same duration, for various
  18412. reasons including codec frame size or sloppy authoring. For that reason,
  18413. related synchronized streams (e.g. a video and its audio track) should be
  18414. concatenated at once. The concat filter will use the duration of the longest
  18415. stream in each segment (except the last one), and if necessary pad shorter
  18416. audio streams with silence.
  18417. For this filter to work correctly, all segments must start at timestamp 0.
  18418. All corresponding streams must have the same parameters in all segments; the
  18419. filtering system will automatically select a common pixel format for video
  18420. streams, and a common sample format, sample rate and channel layout for
  18421. audio streams, but other settings, such as resolution, must be converted
  18422. explicitly by the user.
  18423. Different frame rates are acceptable but will result in variable frame rate
  18424. at output; be sure to configure the output file to handle it.
  18425. @subsection Examples
  18426. @itemize
  18427. @item
  18428. Concatenate an opening, an episode and an ending, all in bilingual version
  18429. (video in stream 0, audio in streams 1 and 2):
  18430. @example
  18431. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  18432. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  18433. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  18434. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  18435. @end example
  18436. @item
  18437. Concatenate two parts, handling audio and video separately, using the
  18438. (a)movie sources, and adjusting the resolution:
  18439. @example
  18440. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  18441. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  18442. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  18443. @end example
  18444. Note that a desync will happen at the stitch if the audio and video streams
  18445. do not have exactly the same duration in the first file.
  18446. @end itemize
  18447. @subsection Commands
  18448. This filter supports the following commands:
  18449. @table @option
  18450. @item next
  18451. Close the current segment and step to the next one
  18452. @end table
  18453. @anchor{ebur128}
  18454. @section ebur128
  18455. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  18456. level. By default, it logs a message at a frequency of 10Hz with the
  18457. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  18458. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  18459. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  18460. sample format is double-precision floating point. The input stream will be converted to
  18461. this specification, if needed. Users may need to insert aformat and/or aresample filters
  18462. after this filter to obtain the original parameters.
  18463. The filter also has a video output (see the @var{video} option) with a real
  18464. time graph to observe the loudness evolution. The graphic contains the logged
  18465. message mentioned above, so it is not printed anymore when this option is set,
  18466. unless the verbose logging is set. The main graphing area contains the
  18467. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  18468. the momentary loudness (400 milliseconds), but can optionally be configured
  18469. to instead display short-term loudness (see @var{gauge}).
  18470. The green area marks a +/- 1LU target range around the target loudness
  18471. (-23LUFS by default, unless modified through @var{target}).
  18472. More information about the Loudness Recommendation EBU R128 on
  18473. @url{http://tech.ebu.ch/loudness}.
  18474. The filter accepts the following options:
  18475. @table @option
  18476. @item video
  18477. Activate the video output. The audio stream is passed unchanged whether this
  18478. option is set or no. The video stream will be the first output stream if
  18479. activated. Default is @code{0}.
  18480. @item size
  18481. Set the video size. This option is for video only. For the syntax of this
  18482. option, check the
  18483. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18484. Default and minimum resolution is @code{640x480}.
  18485. @item meter
  18486. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18487. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18488. other integer value between this range is allowed.
  18489. @item metadata
  18490. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18491. into 100ms output frames, each of them containing various loudness information
  18492. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18493. Default is @code{0}.
  18494. @item framelog
  18495. Force the frame logging level.
  18496. Available values are:
  18497. @table @samp
  18498. @item info
  18499. information logging level
  18500. @item verbose
  18501. verbose logging level
  18502. @end table
  18503. By default, the logging level is set to @var{info}. If the @option{video} or
  18504. the @option{metadata} options are set, it switches to @var{verbose}.
  18505. @item peak
  18506. Set peak mode(s).
  18507. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18508. values are:
  18509. @table @samp
  18510. @item none
  18511. Disable any peak mode (default).
  18512. @item sample
  18513. Enable sample-peak mode.
  18514. Simple peak mode looking for the higher sample value. It logs a message
  18515. for sample-peak (identified by @code{SPK}).
  18516. @item true
  18517. Enable true-peak mode.
  18518. If enabled, the peak lookup is done on an over-sampled version of the input
  18519. stream for better peak accuracy. It logs a message for true-peak.
  18520. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18521. This mode requires a build with @code{libswresample}.
  18522. @end table
  18523. @item dualmono
  18524. Treat mono input files as "dual mono". If a mono file is intended for playback
  18525. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18526. If set to @code{true}, this option will compensate for this effect.
  18527. Multi-channel input files are not affected by this option.
  18528. @item panlaw
  18529. Set a specific pan law to be used for the measurement of dual mono files.
  18530. This parameter is optional, and has a default value of -3.01dB.
  18531. @item target
  18532. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18533. This parameter is optional and has a default value of -23LUFS as specified
  18534. by EBU R128. However, material published online may prefer a level of -16LUFS
  18535. (e.g. for use with podcasts or video platforms).
  18536. @item gauge
  18537. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18538. @code{shortterm}. By default the momentary value will be used, but in certain
  18539. scenarios it may be more useful to observe the short term value instead (e.g.
  18540. live mixing).
  18541. @item scale
  18542. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18543. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18544. video output, not the summary or continuous log output.
  18545. @end table
  18546. @subsection Examples
  18547. @itemize
  18548. @item
  18549. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18550. @example
  18551. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18552. @end example
  18553. @item
  18554. Run an analysis with @command{ffmpeg}:
  18555. @example
  18556. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18557. @end example
  18558. @end itemize
  18559. @section interleave, ainterleave
  18560. Temporally interleave frames from several inputs.
  18561. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18562. These filters read frames from several inputs and send the oldest
  18563. queued frame to the output.
  18564. Input streams must have well defined, monotonically increasing frame
  18565. timestamp values.
  18566. In order to submit one frame to output, these filters need to enqueue
  18567. at least one frame for each input, so they cannot work in case one
  18568. input is not yet terminated and will not receive incoming frames.
  18569. For example consider the case when one input is a @code{select} filter
  18570. which always drops input frames. The @code{interleave} filter will keep
  18571. reading from that input, but it will never be able to send new frames
  18572. to output until the input sends an end-of-stream signal.
  18573. Also, depending on inputs synchronization, the filters will drop
  18574. frames in case one input receives more frames than the other ones, and
  18575. the queue is already filled.
  18576. These filters accept the following options:
  18577. @table @option
  18578. @item nb_inputs, n
  18579. Set the number of different inputs, it is 2 by default.
  18580. @item duration
  18581. How to determine the end-of-stream.
  18582. @table @option
  18583. @item longest
  18584. The duration of the longest input. (default)
  18585. @item shortest
  18586. The duration of the shortest input.
  18587. @item first
  18588. The duration of the first input.
  18589. @end table
  18590. @end table
  18591. @subsection Examples
  18592. @itemize
  18593. @item
  18594. Interleave frames belonging to different streams using @command{ffmpeg}:
  18595. @example
  18596. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18597. @end example
  18598. @item
  18599. Add flickering blur effect:
  18600. @example
  18601. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18602. @end example
  18603. @end itemize
  18604. @section metadata, ametadata
  18605. Manipulate frame metadata.
  18606. This filter accepts the following options:
  18607. @table @option
  18608. @item mode
  18609. Set mode of operation of the filter.
  18610. Can be one of the following:
  18611. @table @samp
  18612. @item select
  18613. If both @code{value} and @code{key} is set, select frames
  18614. which have such metadata. If only @code{key} is set, select
  18615. every frame that has such key in metadata.
  18616. @item add
  18617. Add new metadata @code{key} and @code{value}. If key is already available
  18618. do nothing.
  18619. @item modify
  18620. Modify value of already present key.
  18621. @item delete
  18622. If @code{value} is set, delete only keys that have such value.
  18623. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18624. the frame.
  18625. @item print
  18626. Print key and its value if metadata was found. If @code{key} is not set print all
  18627. metadata values available in frame.
  18628. @end table
  18629. @item key
  18630. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18631. @item value
  18632. Set metadata value which will be used. This option is mandatory for
  18633. @code{modify} and @code{add} mode.
  18634. @item function
  18635. Which function to use when comparing metadata value and @code{value}.
  18636. Can be one of following:
  18637. @table @samp
  18638. @item same_str
  18639. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18640. @item starts_with
  18641. Values are interpreted as strings, returns true if metadata value starts with
  18642. the @code{value} option string.
  18643. @item less
  18644. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18645. @item equal
  18646. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18647. @item greater
  18648. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18649. @item expr
  18650. Values are interpreted as floats, returns true if expression from option @code{expr}
  18651. evaluates to true.
  18652. @item ends_with
  18653. Values are interpreted as strings, returns true if metadata value ends with
  18654. the @code{value} option string.
  18655. @end table
  18656. @item expr
  18657. Set expression which is used when @code{function} is set to @code{expr}.
  18658. The expression is evaluated through the eval API and can contain the following
  18659. constants:
  18660. @table @option
  18661. @item VALUE1
  18662. Float representation of @code{value} from metadata key.
  18663. @item VALUE2
  18664. Float representation of @code{value} as supplied by user in @code{value} option.
  18665. @end table
  18666. @item file
  18667. If specified in @code{print} mode, output is written to the named file. Instead of
  18668. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18669. for standard output. If @code{file} option is not set, output is written to the log
  18670. with AV_LOG_INFO loglevel.
  18671. @item direct
  18672. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18673. @end table
  18674. @subsection Examples
  18675. @itemize
  18676. @item
  18677. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18678. between 0 and 1.
  18679. @example
  18680. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18681. @end example
  18682. @item
  18683. Print silencedetect output to file @file{metadata.txt}.
  18684. @example
  18685. silencedetect,ametadata=mode=print:file=metadata.txt
  18686. @end example
  18687. @item
  18688. Direct all metadata to a pipe with file descriptor 4.
  18689. @example
  18690. metadata=mode=print:file='pipe\:4'
  18691. @end example
  18692. @end itemize
  18693. @section perms, aperms
  18694. Set read/write permissions for the output frames.
  18695. These filters are mainly aimed at developers to test direct path in the
  18696. following filter in the filtergraph.
  18697. The filters accept the following options:
  18698. @table @option
  18699. @item mode
  18700. Select the permissions mode.
  18701. It accepts the following values:
  18702. @table @samp
  18703. @item none
  18704. Do nothing. This is the default.
  18705. @item ro
  18706. Set all the output frames read-only.
  18707. @item rw
  18708. Set all the output frames directly writable.
  18709. @item toggle
  18710. Make the frame read-only if writable, and writable if read-only.
  18711. @item random
  18712. Set each output frame read-only or writable randomly.
  18713. @end table
  18714. @item seed
  18715. Set the seed for the @var{random} mode, must be an integer included between
  18716. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18717. @code{-1}, the filter will try to use a good random seed on a best effort
  18718. basis.
  18719. @end table
  18720. Note: in case of auto-inserted filter between the permission filter and the
  18721. following one, the permission might not be received as expected in that
  18722. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18723. perms/aperms filter can avoid this problem.
  18724. @section realtime, arealtime
  18725. Slow down filtering to match real time approximately.
  18726. These filters will pause the filtering for a variable amount of time to
  18727. match the output rate with the input timestamps.
  18728. They are similar to the @option{re} option to @code{ffmpeg}.
  18729. They accept the following options:
  18730. @table @option
  18731. @item limit
  18732. Time limit for the pauses. Any pause longer than that will be considered
  18733. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18734. @item speed
  18735. Speed factor for processing. The value must be a float larger than zero.
  18736. Values larger than 1.0 will result in faster than realtime processing,
  18737. smaller will slow processing down. The @var{limit} is automatically adapted
  18738. accordingly. Default is 1.0.
  18739. A processing speed faster than what is possible without these filters cannot
  18740. be achieved.
  18741. @end table
  18742. @anchor{select}
  18743. @section select, aselect
  18744. Select frames to pass in output.
  18745. This filter accepts the following options:
  18746. @table @option
  18747. @item expr, e
  18748. Set expression, which is evaluated for each input frame.
  18749. If the expression is evaluated to zero, the frame is discarded.
  18750. If the evaluation result is negative or NaN, the frame is sent to the
  18751. first output; otherwise it is sent to the output with index
  18752. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18753. For example a value of @code{1.2} corresponds to the output with index
  18754. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18755. @item outputs, n
  18756. Set the number of outputs. The output to which to send the selected
  18757. frame is based on the result of the evaluation. Default value is 1.
  18758. @end table
  18759. The expression can contain the following constants:
  18760. @table @option
  18761. @item n
  18762. The (sequential) number of the filtered frame, starting from 0.
  18763. @item selected_n
  18764. The (sequential) number of the selected frame, starting from 0.
  18765. @item prev_selected_n
  18766. The sequential number of the last selected frame. It's NAN if undefined.
  18767. @item TB
  18768. The timebase of the input timestamps.
  18769. @item pts
  18770. The PTS (Presentation TimeStamp) of the filtered video frame,
  18771. expressed in @var{TB} units. It's NAN if undefined.
  18772. @item t
  18773. The PTS of the filtered video frame,
  18774. expressed in seconds. It's NAN if undefined.
  18775. @item prev_pts
  18776. The PTS of the previously filtered video frame. It's NAN if undefined.
  18777. @item prev_selected_pts
  18778. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18779. @item prev_selected_t
  18780. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18781. @item start_pts
  18782. The PTS of the first video frame in the video. It's NAN if undefined.
  18783. @item start_t
  18784. The time of the first video frame in the video. It's NAN if undefined.
  18785. @item pict_type @emph{(video only)}
  18786. The type of the filtered frame. It can assume one of the following
  18787. values:
  18788. @table @option
  18789. @item I
  18790. @item P
  18791. @item B
  18792. @item S
  18793. @item SI
  18794. @item SP
  18795. @item BI
  18796. @end table
  18797. @item interlace_type @emph{(video only)}
  18798. The frame interlace type. It can assume one of the following values:
  18799. @table @option
  18800. @item PROGRESSIVE
  18801. The frame is progressive (not interlaced).
  18802. @item TOPFIRST
  18803. The frame is top-field-first.
  18804. @item BOTTOMFIRST
  18805. The frame is bottom-field-first.
  18806. @end table
  18807. @item consumed_sample_n @emph{(audio only)}
  18808. the number of selected samples before the current frame
  18809. @item samples_n @emph{(audio only)}
  18810. the number of samples in the current frame
  18811. @item sample_rate @emph{(audio only)}
  18812. the input sample rate
  18813. @item key
  18814. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18815. @item pos
  18816. the position in the file of the filtered frame, -1 if the information
  18817. is not available (e.g. for synthetic video)
  18818. @item scene @emph{(video only)}
  18819. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18820. probability for the current frame to introduce a new scene, while a higher
  18821. value means the current frame is more likely to be one (see the example below)
  18822. @item concatdec_select
  18823. The concat demuxer can select only part of a concat input file by setting an
  18824. inpoint and an outpoint, but the output packets may not be entirely contained
  18825. in the selected interval. By using this variable, it is possible to skip frames
  18826. generated by the concat demuxer which are not exactly contained in the selected
  18827. interval.
  18828. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18829. and the @var{lavf.concat.duration} packet metadata values which are also
  18830. present in the decoded frames.
  18831. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18832. start_time and either the duration metadata is missing or the frame pts is less
  18833. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18834. missing.
  18835. That basically means that an input frame is selected if its pts is within the
  18836. interval set by the concat demuxer.
  18837. @end table
  18838. The default value of the select expression is "1".
  18839. @subsection Examples
  18840. @itemize
  18841. @item
  18842. Select all frames in input:
  18843. @example
  18844. select
  18845. @end example
  18846. The example above is the same as:
  18847. @example
  18848. select=1
  18849. @end example
  18850. @item
  18851. Skip all frames:
  18852. @example
  18853. select=0
  18854. @end example
  18855. @item
  18856. Select only I-frames:
  18857. @example
  18858. select='eq(pict_type\,I)'
  18859. @end example
  18860. @item
  18861. Select one frame every 100:
  18862. @example
  18863. select='not(mod(n\,100))'
  18864. @end example
  18865. @item
  18866. Select only frames contained in the 10-20 time interval:
  18867. @example
  18868. select=between(t\,10\,20)
  18869. @end example
  18870. @item
  18871. Select only I-frames contained in the 10-20 time interval:
  18872. @example
  18873. select=between(t\,10\,20)*eq(pict_type\,I)
  18874. @end example
  18875. @item
  18876. Select frames with a minimum distance of 10 seconds:
  18877. @example
  18878. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18879. @end example
  18880. @item
  18881. Use aselect to select only audio frames with samples number > 100:
  18882. @example
  18883. aselect='gt(samples_n\,100)'
  18884. @end example
  18885. @item
  18886. Create a mosaic of the first scenes:
  18887. @example
  18888. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18889. @end example
  18890. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18891. choice.
  18892. @item
  18893. Send even and odd frames to separate outputs, and compose them:
  18894. @example
  18895. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18896. @end example
  18897. @item
  18898. Select useful frames from an ffconcat file which is using inpoints and
  18899. outpoints but where the source files are not intra frame only.
  18900. @example
  18901. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18902. @end example
  18903. @end itemize
  18904. @section sendcmd, asendcmd
  18905. Send commands to filters in the filtergraph.
  18906. These filters read commands to be sent to other filters in the
  18907. filtergraph.
  18908. @code{sendcmd} must be inserted between two video filters,
  18909. @code{asendcmd} must be inserted between two audio filters, but apart
  18910. from that they act the same way.
  18911. The specification of commands can be provided in the filter arguments
  18912. with the @var{commands} option, or in a file specified by the
  18913. @var{filename} option.
  18914. These filters accept the following options:
  18915. @table @option
  18916. @item commands, c
  18917. Set the commands to be read and sent to the other filters.
  18918. @item filename, f
  18919. Set the filename of the commands to be read and sent to the other
  18920. filters.
  18921. @end table
  18922. @subsection Commands syntax
  18923. A commands description consists of a sequence of interval
  18924. specifications, comprising a list of commands to be executed when a
  18925. particular event related to that interval occurs. The occurring event
  18926. is typically the current frame time entering or leaving a given time
  18927. interval.
  18928. An interval is specified by the following syntax:
  18929. @example
  18930. @var{START}[-@var{END}] @var{COMMANDS};
  18931. @end example
  18932. The time interval is specified by the @var{START} and @var{END} times.
  18933. @var{END} is optional and defaults to the maximum time.
  18934. The current frame time is considered within the specified interval if
  18935. it is included in the interval [@var{START}, @var{END}), that is when
  18936. the time is greater or equal to @var{START} and is lesser than
  18937. @var{END}.
  18938. @var{COMMANDS} consists of a sequence of one or more command
  18939. specifications, separated by ",", relating to that interval. The
  18940. syntax of a command specification is given by:
  18941. @example
  18942. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18943. @end example
  18944. @var{FLAGS} is optional and specifies the type of events relating to
  18945. the time interval which enable sending the specified command, and must
  18946. be a non-null sequence of identifier flags separated by "+" or "|" and
  18947. enclosed between "[" and "]".
  18948. The following flags are recognized:
  18949. @table @option
  18950. @item enter
  18951. The command is sent when the current frame timestamp enters the
  18952. specified interval. In other words, the command is sent when the
  18953. previous frame timestamp was not in the given interval, and the
  18954. current is.
  18955. @item leave
  18956. The command is sent when the current frame timestamp leaves the
  18957. specified interval. In other words, the command is sent when the
  18958. previous frame timestamp was in the given interval, and the
  18959. current is not.
  18960. @item expr
  18961. The command @var{ARG} is interpreted as expression and result of
  18962. expression is passed as @var{ARG}.
  18963. The expression is evaluated through the eval API and can contain the following
  18964. constants:
  18965. @table @option
  18966. @item POS
  18967. Original position in the file of the frame, or undefined if undefined
  18968. for the current frame.
  18969. @item PTS
  18970. The presentation timestamp in input.
  18971. @item N
  18972. The count of the input frame for video or audio, starting from 0.
  18973. @item T
  18974. The time in seconds of the current frame.
  18975. @item TS
  18976. The start time in seconds of the current command interval.
  18977. @item TE
  18978. The end time in seconds of the current command interval.
  18979. @item TI
  18980. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18981. @end table
  18982. @end table
  18983. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18984. assumed.
  18985. @var{TARGET} specifies the target of the command, usually the name of
  18986. the filter class or a specific filter instance name.
  18987. @var{COMMAND} specifies the name of the command for the target filter.
  18988. @var{ARG} is optional and specifies the optional list of argument for
  18989. the given @var{COMMAND}.
  18990. Between one interval specification and another, whitespaces, or
  18991. sequences of characters starting with @code{#} until the end of line,
  18992. are ignored and can be used to annotate comments.
  18993. A simplified BNF description of the commands specification syntax
  18994. follows:
  18995. @example
  18996. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18997. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18998. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18999. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  19000. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  19001. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  19002. @end example
  19003. @subsection Examples
  19004. @itemize
  19005. @item
  19006. Specify audio tempo change at second 4:
  19007. @example
  19008. asendcmd=c='4.0 atempo tempo 1.5',atempo
  19009. @end example
  19010. @item
  19011. Target a specific filter instance:
  19012. @example
  19013. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  19014. @end example
  19015. @item
  19016. Specify a list of drawtext and hue commands in a file.
  19017. @example
  19018. # show text in the interval 5-10
  19019. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  19020. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  19021. # desaturate the image in the interval 15-20
  19022. 15.0-20.0 [enter] hue s 0,
  19023. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  19024. [leave] hue s 1,
  19025. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  19026. # apply an exponential saturation fade-out effect, starting from time 25
  19027. 25 [enter] hue s exp(25-t)
  19028. @end example
  19029. A filtergraph allowing to read and process the above command list
  19030. stored in a file @file{test.cmd}, can be specified with:
  19031. @example
  19032. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  19033. @end example
  19034. @end itemize
  19035. @anchor{setpts}
  19036. @section setpts, asetpts
  19037. Change the PTS (presentation timestamp) of the input frames.
  19038. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  19039. This filter accepts the following options:
  19040. @table @option
  19041. @item expr
  19042. The expression which is evaluated for each frame to construct its timestamp.
  19043. @end table
  19044. The expression is evaluated through the eval API and can contain the following
  19045. constants:
  19046. @table @option
  19047. @item FRAME_RATE, FR
  19048. frame rate, only defined for constant frame-rate video
  19049. @item PTS
  19050. The presentation timestamp in input
  19051. @item N
  19052. The count of the input frame for video or the number of consumed samples,
  19053. not including the current frame for audio, starting from 0.
  19054. @item NB_CONSUMED_SAMPLES
  19055. The number of consumed samples, not including the current frame (only
  19056. audio)
  19057. @item NB_SAMPLES, S
  19058. The number of samples in the current frame (only audio)
  19059. @item SAMPLE_RATE, SR
  19060. The audio sample rate.
  19061. @item STARTPTS
  19062. The PTS of the first frame.
  19063. @item STARTT
  19064. the time in seconds of the first frame
  19065. @item INTERLACED
  19066. State whether the current frame is interlaced.
  19067. @item T
  19068. the time in seconds of the current frame
  19069. @item POS
  19070. original position in the file of the frame, or undefined if undefined
  19071. for the current frame
  19072. @item PREV_INPTS
  19073. The previous input PTS.
  19074. @item PREV_INT
  19075. previous input time in seconds
  19076. @item PREV_OUTPTS
  19077. The previous output PTS.
  19078. @item PREV_OUTT
  19079. previous output time in seconds
  19080. @item RTCTIME
  19081. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  19082. instead.
  19083. @item RTCSTART
  19084. The wallclock (RTC) time at the start of the movie in microseconds.
  19085. @item TB
  19086. The timebase of the input timestamps.
  19087. @end table
  19088. @subsection Examples
  19089. @itemize
  19090. @item
  19091. Start counting PTS from zero
  19092. @example
  19093. setpts=PTS-STARTPTS
  19094. @end example
  19095. @item
  19096. Apply fast motion effect:
  19097. @example
  19098. setpts=0.5*PTS
  19099. @end example
  19100. @item
  19101. Apply slow motion effect:
  19102. @example
  19103. setpts=2.0*PTS
  19104. @end example
  19105. @item
  19106. Set fixed rate of 25 frames per second:
  19107. @example
  19108. setpts=N/(25*TB)
  19109. @end example
  19110. @item
  19111. Set fixed rate 25 fps with some jitter:
  19112. @example
  19113. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  19114. @end example
  19115. @item
  19116. Apply an offset of 10 seconds to the input PTS:
  19117. @example
  19118. setpts=PTS+10/TB
  19119. @end example
  19120. @item
  19121. Generate timestamps from a "live source" and rebase onto the current timebase:
  19122. @example
  19123. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  19124. @end example
  19125. @item
  19126. Generate timestamps by counting samples:
  19127. @example
  19128. asetpts=N/SR/TB
  19129. @end example
  19130. @end itemize
  19131. @section setrange
  19132. Force color range for the output video frame.
  19133. The @code{setrange} filter marks the color range property for the
  19134. output frames. It does not change the input frame, but only sets the
  19135. corresponding property, which affects how the frame is treated by
  19136. following filters.
  19137. The filter accepts the following options:
  19138. @table @option
  19139. @item range
  19140. Available values are:
  19141. @table @samp
  19142. @item auto
  19143. Keep the same color range property.
  19144. @item unspecified, unknown
  19145. Set the color range as unspecified.
  19146. @item limited, tv, mpeg
  19147. Set the color range as limited.
  19148. @item full, pc, jpeg
  19149. Set the color range as full.
  19150. @end table
  19151. @end table
  19152. @section settb, asettb
  19153. Set the timebase to use for the output frames timestamps.
  19154. It is mainly useful for testing timebase configuration.
  19155. It accepts the following parameters:
  19156. @table @option
  19157. @item expr, tb
  19158. The expression which is evaluated into the output timebase.
  19159. @end table
  19160. The value for @option{tb} is an arithmetic expression representing a
  19161. rational. The expression can contain the constants "AVTB" (the default
  19162. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  19163. audio only). Default value is "intb".
  19164. @subsection Examples
  19165. @itemize
  19166. @item
  19167. Set the timebase to 1/25:
  19168. @example
  19169. settb=expr=1/25
  19170. @end example
  19171. @item
  19172. Set the timebase to 1/10:
  19173. @example
  19174. settb=expr=0.1
  19175. @end example
  19176. @item
  19177. Set the timebase to 1001/1000:
  19178. @example
  19179. settb=1+0.001
  19180. @end example
  19181. @item
  19182. Set the timebase to 2*intb:
  19183. @example
  19184. settb=2*intb
  19185. @end example
  19186. @item
  19187. Set the default timebase value:
  19188. @example
  19189. settb=AVTB
  19190. @end example
  19191. @end itemize
  19192. @section showcqt
  19193. Convert input audio to a video output representing frequency spectrum
  19194. logarithmically using Brown-Puckette constant Q transform algorithm with
  19195. direct frequency domain coefficient calculation (but the transform itself
  19196. is not really constant Q, instead the Q factor is actually variable/clamped),
  19197. with musical tone scale, from E0 to D#10.
  19198. The filter accepts the following options:
  19199. @table @option
  19200. @item size, s
  19201. Specify the video size for the output. It must be even. For the syntax of this option,
  19202. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19203. Default value is @code{1920x1080}.
  19204. @item fps, rate, r
  19205. Set the output frame rate. Default value is @code{25}.
  19206. @item bar_h
  19207. Set the bargraph height. It must be even. Default value is @code{-1} which
  19208. computes the bargraph height automatically.
  19209. @item axis_h
  19210. Set the axis height. It must be even. Default value is @code{-1} which computes
  19211. the axis height automatically.
  19212. @item sono_h
  19213. Set the sonogram height. It must be even. Default value is @code{-1} which
  19214. computes the sonogram height automatically.
  19215. @item fullhd
  19216. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  19217. instead. Default value is @code{1}.
  19218. @item sono_v, volume
  19219. Specify the sonogram volume expression. It can contain variables:
  19220. @table @option
  19221. @item bar_v
  19222. the @var{bar_v} evaluated expression
  19223. @item frequency, freq, f
  19224. the frequency where it is evaluated
  19225. @item timeclamp, tc
  19226. the value of @var{timeclamp} option
  19227. @end table
  19228. and functions:
  19229. @table @option
  19230. @item a_weighting(f)
  19231. A-weighting of equal loudness
  19232. @item b_weighting(f)
  19233. B-weighting of equal loudness
  19234. @item c_weighting(f)
  19235. C-weighting of equal loudness.
  19236. @end table
  19237. Default value is @code{16}.
  19238. @item bar_v, volume2
  19239. Specify the bargraph volume expression. It can contain variables:
  19240. @table @option
  19241. @item sono_v
  19242. the @var{sono_v} evaluated expression
  19243. @item frequency, freq, f
  19244. the frequency where it is evaluated
  19245. @item timeclamp, tc
  19246. the value of @var{timeclamp} option
  19247. @end table
  19248. and functions:
  19249. @table @option
  19250. @item a_weighting(f)
  19251. A-weighting of equal loudness
  19252. @item b_weighting(f)
  19253. B-weighting of equal loudness
  19254. @item c_weighting(f)
  19255. C-weighting of equal loudness.
  19256. @end table
  19257. Default value is @code{sono_v}.
  19258. @item sono_g, gamma
  19259. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  19260. higher gamma makes the spectrum having more range. Default value is @code{3}.
  19261. Acceptable range is @code{[1, 7]}.
  19262. @item bar_g, gamma2
  19263. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  19264. @code{[1, 7]}.
  19265. @item bar_t
  19266. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  19267. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  19268. @item timeclamp, tc
  19269. Specify the transform timeclamp. At low frequency, there is trade-off between
  19270. accuracy in time domain and frequency domain. If timeclamp is lower,
  19271. event in time domain is represented more accurately (such as fast bass drum),
  19272. otherwise event in frequency domain is represented more accurately
  19273. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  19274. @item attack
  19275. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  19276. limits future samples by applying asymmetric windowing in time domain, useful
  19277. when low latency is required. Accepted range is @code{[0, 1]}.
  19278. @item basefreq
  19279. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  19280. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  19281. @item endfreq
  19282. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  19283. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  19284. @item coeffclamp
  19285. This option is deprecated and ignored.
  19286. @item tlength
  19287. Specify the transform length in time domain. Use this option to control accuracy
  19288. trade-off between time domain and frequency domain at every frequency sample.
  19289. It can contain variables:
  19290. @table @option
  19291. @item frequency, freq, f
  19292. the frequency where it is evaluated
  19293. @item timeclamp, tc
  19294. the value of @var{timeclamp} option.
  19295. @end table
  19296. Default value is @code{384*tc/(384+tc*f)}.
  19297. @item count
  19298. Specify the transform count for every video frame. Default value is @code{6}.
  19299. Acceptable range is @code{[1, 30]}.
  19300. @item fcount
  19301. Specify the transform count for every single pixel. Default value is @code{0},
  19302. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  19303. @item fontfile
  19304. Specify font file for use with freetype to draw the axis. If not specified,
  19305. use embedded font. Note that drawing with font file or embedded font is not
  19306. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  19307. option instead.
  19308. @item font
  19309. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  19310. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  19311. escaping.
  19312. @item fontcolor
  19313. Specify font color expression. This is arithmetic expression that should return
  19314. integer value 0xRRGGBB. It can contain variables:
  19315. @table @option
  19316. @item frequency, freq, f
  19317. the frequency where it is evaluated
  19318. @item timeclamp, tc
  19319. the value of @var{timeclamp} option
  19320. @end table
  19321. and functions:
  19322. @table @option
  19323. @item midi(f)
  19324. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  19325. @item r(x), g(x), b(x)
  19326. red, green, and blue value of intensity x.
  19327. @end table
  19328. Default value is @code{st(0, (midi(f)-59.5)/12);
  19329. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  19330. r(1-ld(1)) + b(ld(1))}.
  19331. @item axisfile
  19332. Specify image file to draw the axis. This option override @var{fontfile} and
  19333. @var{fontcolor} option.
  19334. @item axis, text
  19335. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  19336. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  19337. Default value is @code{1}.
  19338. @item csp
  19339. Set colorspace. The accepted values are:
  19340. @table @samp
  19341. @item unspecified
  19342. Unspecified (default)
  19343. @item bt709
  19344. BT.709
  19345. @item fcc
  19346. FCC
  19347. @item bt470bg
  19348. BT.470BG or BT.601-6 625
  19349. @item smpte170m
  19350. SMPTE-170M or BT.601-6 525
  19351. @item smpte240m
  19352. SMPTE-240M
  19353. @item bt2020ncl
  19354. BT.2020 with non-constant luminance
  19355. @end table
  19356. @item cscheme
  19357. Set spectrogram color scheme. This is list of floating point values with format
  19358. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  19359. The default is @code{1|0.5|0|0|0.5|1}.
  19360. @end table
  19361. @subsection Examples
  19362. @itemize
  19363. @item
  19364. Playing audio while showing the spectrum:
  19365. @example
  19366. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  19367. @end example
  19368. @item
  19369. Same as above, but with frame rate 30 fps:
  19370. @example
  19371. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  19372. @end example
  19373. @item
  19374. Playing at 1280x720:
  19375. @example
  19376. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  19377. @end example
  19378. @item
  19379. Disable sonogram display:
  19380. @example
  19381. sono_h=0
  19382. @end example
  19383. @item
  19384. A1 and its harmonics: A1, A2, (near)E3, A3:
  19385. @example
  19386. 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),
  19387. asplit[a][out1]; [a] showcqt [out0]'
  19388. @end example
  19389. @item
  19390. Same as above, but with more accuracy in frequency domain:
  19391. @example
  19392. 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),
  19393. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  19394. @end example
  19395. @item
  19396. Custom volume:
  19397. @example
  19398. bar_v=10:sono_v=bar_v*a_weighting(f)
  19399. @end example
  19400. @item
  19401. Custom gamma, now spectrum is linear to the amplitude.
  19402. @example
  19403. bar_g=2:sono_g=2
  19404. @end example
  19405. @item
  19406. Custom tlength equation:
  19407. @example
  19408. 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)))'
  19409. @end example
  19410. @item
  19411. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  19412. @example
  19413. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  19414. @end example
  19415. @item
  19416. Custom font using fontconfig:
  19417. @example
  19418. font='Courier New,Monospace,mono|bold'
  19419. @end example
  19420. @item
  19421. Custom frequency range with custom axis using image file:
  19422. @example
  19423. axisfile=myaxis.png:basefreq=40:endfreq=10000
  19424. @end example
  19425. @end itemize
  19426. @section showfreqs
  19427. Convert input audio to video output representing the audio power spectrum.
  19428. Audio amplitude is on Y-axis while frequency is on X-axis.
  19429. The filter accepts the following options:
  19430. @table @option
  19431. @item size, s
  19432. Specify size of video. For the syntax of this option, check the
  19433. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19434. Default is @code{1024x512}.
  19435. @item mode
  19436. Set display mode.
  19437. This set how each frequency bin will be represented.
  19438. It accepts the following values:
  19439. @table @samp
  19440. @item line
  19441. @item bar
  19442. @item dot
  19443. @end table
  19444. Default is @code{bar}.
  19445. @item ascale
  19446. Set amplitude scale.
  19447. It accepts the following values:
  19448. @table @samp
  19449. @item lin
  19450. Linear scale.
  19451. @item sqrt
  19452. Square root scale.
  19453. @item cbrt
  19454. Cubic root scale.
  19455. @item log
  19456. Logarithmic scale.
  19457. @end table
  19458. Default is @code{log}.
  19459. @item fscale
  19460. Set frequency scale.
  19461. It accepts the following values:
  19462. @table @samp
  19463. @item lin
  19464. Linear scale.
  19465. @item log
  19466. Logarithmic scale.
  19467. @item rlog
  19468. Reverse logarithmic scale.
  19469. @end table
  19470. Default is @code{lin}.
  19471. @item win_size
  19472. Set window size. Allowed range is from 16 to 65536.
  19473. Default is @code{2048}
  19474. @item win_func
  19475. Set windowing function.
  19476. It accepts the following values:
  19477. @table @samp
  19478. @item rect
  19479. @item bartlett
  19480. @item hanning
  19481. @item hamming
  19482. @item blackman
  19483. @item welch
  19484. @item flattop
  19485. @item bharris
  19486. @item bnuttall
  19487. @item bhann
  19488. @item sine
  19489. @item nuttall
  19490. @item lanczos
  19491. @item gauss
  19492. @item tukey
  19493. @item dolph
  19494. @item cauchy
  19495. @item parzen
  19496. @item poisson
  19497. @item bohman
  19498. @end table
  19499. Default is @code{hanning}.
  19500. @item overlap
  19501. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19502. which means optimal overlap for selected window function will be picked.
  19503. @item averaging
  19504. Set time averaging. Setting this to 0 will display current maximal peaks.
  19505. Default is @code{1}, which means time averaging is disabled.
  19506. @item colors
  19507. Specify list of colors separated by space or by '|' which will be used to
  19508. draw channel frequencies. Unrecognized or missing colors will be replaced
  19509. by white color.
  19510. @item cmode
  19511. Set channel display mode.
  19512. It accepts the following values:
  19513. @table @samp
  19514. @item combined
  19515. @item separate
  19516. @end table
  19517. Default is @code{combined}.
  19518. @item minamp
  19519. Set minimum amplitude used in @code{log} amplitude scaler.
  19520. @item data
  19521. Set data display mode.
  19522. It accepts the following values:
  19523. @table @samp
  19524. @item magnitude
  19525. @item phase
  19526. @item delay
  19527. @end table
  19528. Default is @code{magnitude}.
  19529. @end table
  19530. @section showspatial
  19531. Convert stereo input audio to a video output, representing the spatial relationship
  19532. between two channels.
  19533. The filter accepts the following options:
  19534. @table @option
  19535. @item size, s
  19536. Specify the video size for the output. For the syntax of this option, check the
  19537. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19538. Default value is @code{512x512}.
  19539. @item win_size
  19540. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19541. @item win_func
  19542. Set window function.
  19543. It accepts the following values:
  19544. @table @samp
  19545. @item rect
  19546. @item bartlett
  19547. @item hann
  19548. @item hanning
  19549. @item hamming
  19550. @item blackman
  19551. @item welch
  19552. @item flattop
  19553. @item bharris
  19554. @item bnuttall
  19555. @item bhann
  19556. @item sine
  19557. @item nuttall
  19558. @item lanczos
  19559. @item gauss
  19560. @item tukey
  19561. @item dolph
  19562. @item cauchy
  19563. @item parzen
  19564. @item poisson
  19565. @item bohman
  19566. @end table
  19567. Default value is @code{hann}.
  19568. @item overlap
  19569. Set ratio of overlap window. Default value is @code{0.5}.
  19570. When value is @code{1} overlap is set to recommended size for specific
  19571. window function currently used.
  19572. @end table
  19573. @anchor{showspectrum}
  19574. @section showspectrum
  19575. Convert input audio to a video output, representing the audio frequency
  19576. spectrum.
  19577. The filter accepts the following options:
  19578. @table @option
  19579. @item size, s
  19580. Specify the video size for the output. For the syntax of this option, check the
  19581. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19582. Default value is @code{640x512}.
  19583. @item slide
  19584. Specify how the spectrum should slide along the window.
  19585. It accepts the following values:
  19586. @table @samp
  19587. @item replace
  19588. the samples start again on the left when they reach the right
  19589. @item scroll
  19590. the samples scroll from right to left
  19591. @item fullframe
  19592. frames are only produced when the samples reach the right
  19593. @item rscroll
  19594. the samples scroll from left to right
  19595. @end table
  19596. Default value is @code{replace}.
  19597. @item mode
  19598. Specify display mode.
  19599. It accepts the following values:
  19600. @table @samp
  19601. @item combined
  19602. all channels are displayed in the same row
  19603. @item separate
  19604. all channels are displayed in separate rows
  19605. @end table
  19606. Default value is @samp{combined}.
  19607. @item color
  19608. Specify display color mode.
  19609. It accepts the following values:
  19610. @table @samp
  19611. @item channel
  19612. each channel is displayed in a separate color
  19613. @item intensity
  19614. each channel is displayed using the same color scheme
  19615. @item rainbow
  19616. each channel is displayed using the rainbow color scheme
  19617. @item moreland
  19618. each channel is displayed using the moreland color scheme
  19619. @item nebulae
  19620. each channel is displayed using the nebulae color scheme
  19621. @item fire
  19622. each channel is displayed using the fire color scheme
  19623. @item fiery
  19624. each channel is displayed using the fiery color scheme
  19625. @item fruit
  19626. each channel is displayed using the fruit color scheme
  19627. @item cool
  19628. each channel is displayed using the cool color scheme
  19629. @item magma
  19630. each channel is displayed using the magma color scheme
  19631. @item green
  19632. each channel is displayed using the green color scheme
  19633. @item viridis
  19634. each channel is displayed using the viridis color scheme
  19635. @item plasma
  19636. each channel is displayed using the plasma color scheme
  19637. @item cividis
  19638. each channel is displayed using the cividis color scheme
  19639. @item terrain
  19640. each channel is displayed using the terrain color scheme
  19641. @end table
  19642. Default value is @samp{channel}.
  19643. @item scale
  19644. Specify scale used for calculating intensity color values.
  19645. It accepts the following values:
  19646. @table @samp
  19647. @item lin
  19648. linear
  19649. @item sqrt
  19650. square root, default
  19651. @item cbrt
  19652. cubic root
  19653. @item log
  19654. logarithmic
  19655. @item 4thrt
  19656. 4th root
  19657. @item 5thrt
  19658. 5th root
  19659. @end table
  19660. Default value is @samp{sqrt}.
  19661. @item fscale
  19662. Specify frequency scale.
  19663. It accepts the following values:
  19664. @table @samp
  19665. @item lin
  19666. linear
  19667. @item log
  19668. logarithmic
  19669. @end table
  19670. Default value is @samp{lin}.
  19671. @item saturation
  19672. Set saturation modifier for displayed colors. Negative values provide
  19673. alternative color scheme. @code{0} is no saturation at all.
  19674. Saturation must be in [-10.0, 10.0] range.
  19675. Default value is @code{1}.
  19676. @item win_func
  19677. Set window function.
  19678. It accepts the following values:
  19679. @table @samp
  19680. @item rect
  19681. @item bartlett
  19682. @item hann
  19683. @item hanning
  19684. @item hamming
  19685. @item blackman
  19686. @item welch
  19687. @item flattop
  19688. @item bharris
  19689. @item bnuttall
  19690. @item bhann
  19691. @item sine
  19692. @item nuttall
  19693. @item lanczos
  19694. @item gauss
  19695. @item tukey
  19696. @item dolph
  19697. @item cauchy
  19698. @item parzen
  19699. @item poisson
  19700. @item bohman
  19701. @end table
  19702. Default value is @code{hann}.
  19703. @item orientation
  19704. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19705. @code{horizontal}. Default is @code{vertical}.
  19706. @item overlap
  19707. Set ratio of overlap window. Default value is @code{0}.
  19708. When value is @code{1} overlap is set to recommended size for specific
  19709. window function currently used.
  19710. @item gain
  19711. Set scale gain for calculating intensity color values.
  19712. Default value is @code{1}.
  19713. @item data
  19714. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19715. @item rotation
  19716. Set color rotation, must be in [-1.0, 1.0] range.
  19717. Default value is @code{0}.
  19718. @item start
  19719. Set start frequency from which to display spectrogram. Default is @code{0}.
  19720. @item stop
  19721. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19722. @item fps
  19723. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19724. @item legend
  19725. Draw time and frequency axes and legends. Default is disabled.
  19726. @end table
  19727. The usage is very similar to the showwaves filter; see the examples in that
  19728. section.
  19729. @subsection Examples
  19730. @itemize
  19731. @item
  19732. Large window with logarithmic color scaling:
  19733. @example
  19734. showspectrum=s=1280x480:scale=log
  19735. @end example
  19736. @item
  19737. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19738. @example
  19739. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19740. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19741. @end example
  19742. @end itemize
  19743. @section showspectrumpic
  19744. Convert input audio to a single video frame, representing the audio frequency
  19745. spectrum.
  19746. The filter accepts the following options:
  19747. @table @option
  19748. @item size, s
  19749. Specify the video size for the output. For the syntax of this option, check the
  19750. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19751. Default value is @code{4096x2048}.
  19752. @item mode
  19753. Specify display mode.
  19754. It accepts the following values:
  19755. @table @samp
  19756. @item combined
  19757. all channels are displayed in the same row
  19758. @item separate
  19759. all channels are displayed in separate rows
  19760. @end table
  19761. Default value is @samp{combined}.
  19762. @item color
  19763. Specify display color mode.
  19764. It accepts the following values:
  19765. @table @samp
  19766. @item channel
  19767. each channel is displayed in a separate color
  19768. @item intensity
  19769. each channel is displayed using the same color scheme
  19770. @item rainbow
  19771. each channel is displayed using the rainbow color scheme
  19772. @item moreland
  19773. each channel is displayed using the moreland color scheme
  19774. @item nebulae
  19775. each channel is displayed using the nebulae color scheme
  19776. @item fire
  19777. each channel is displayed using the fire color scheme
  19778. @item fiery
  19779. each channel is displayed using the fiery color scheme
  19780. @item fruit
  19781. each channel is displayed using the fruit color scheme
  19782. @item cool
  19783. each channel is displayed using the cool color scheme
  19784. @item magma
  19785. each channel is displayed using the magma color scheme
  19786. @item green
  19787. each channel is displayed using the green color scheme
  19788. @item viridis
  19789. each channel is displayed using the viridis color scheme
  19790. @item plasma
  19791. each channel is displayed using the plasma color scheme
  19792. @item cividis
  19793. each channel is displayed using the cividis color scheme
  19794. @item terrain
  19795. each channel is displayed using the terrain color scheme
  19796. @end table
  19797. Default value is @samp{intensity}.
  19798. @item scale
  19799. Specify scale used for calculating intensity color values.
  19800. It accepts the following values:
  19801. @table @samp
  19802. @item lin
  19803. linear
  19804. @item sqrt
  19805. square root, default
  19806. @item cbrt
  19807. cubic root
  19808. @item log
  19809. logarithmic
  19810. @item 4thrt
  19811. 4th root
  19812. @item 5thrt
  19813. 5th root
  19814. @end table
  19815. Default value is @samp{log}.
  19816. @item fscale
  19817. Specify frequency scale.
  19818. It accepts the following values:
  19819. @table @samp
  19820. @item lin
  19821. linear
  19822. @item log
  19823. logarithmic
  19824. @end table
  19825. Default value is @samp{lin}.
  19826. @item saturation
  19827. Set saturation modifier for displayed colors. Negative values provide
  19828. alternative color scheme. @code{0} is no saturation at all.
  19829. Saturation must be in [-10.0, 10.0] range.
  19830. Default value is @code{1}.
  19831. @item win_func
  19832. Set window function.
  19833. It accepts the following values:
  19834. @table @samp
  19835. @item rect
  19836. @item bartlett
  19837. @item hann
  19838. @item hanning
  19839. @item hamming
  19840. @item blackman
  19841. @item welch
  19842. @item flattop
  19843. @item bharris
  19844. @item bnuttall
  19845. @item bhann
  19846. @item sine
  19847. @item nuttall
  19848. @item lanczos
  19849. @item gauss
  19850. @item tukey
  19851. @item dolph
  19852. @item cauchy
  19853. @item parzen
  19854. @item poisson
  19855. @item bohman
  19856. @end table
  19857. Default value is @code{hann}.
  19858. @item orientation
  19859. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19860. @code{horizontal}. Default is @code{vertical}.
  19861. @item gain
  19862. Set scale gain for calculating intensity color values.
  19863. Default value is @code{1}.
  19864. @item legend
  19865. Draw time and frequency axes and legends. Default is enabled.
  19866. @item rotation
  19867. Set color rotation, must be in [-1.0, 1.0] range.
  19868. Default value is @code{0}.
  19869. @item start
  19870. Set start frequency from which to display spectrogram. Default is @code{0}.
  19871. @item stop
  19872. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19873. @end table
  19874. @subsection Examples
  19875. @itemize
  19876. @item
  19877. Extract an audio spectrogram of a whole audio track
  19878. in a 1024x1024 picture using @command{ffmpeg}:
  19879. @example
  19880. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19881. @end example
  19882. @end itemize
  19883. @section showvolume
  19884. Convert input audio volume to a video output.
  19885. The filter accepts the following options:
  19886. @table @option
  19887. @item rate, r
  19888. Set video rate.
  19889. @item b
  19890. Set border width, allowed range is [0, 5]. Default is 1.
  19891. @item w
  19892. Set channel width, allowed range is [80, 8192]. Default is 400.
  19893. @item h
  19894. Set channel height, allowed range is [1, 900]. Default is 20.
  19895. @item f
  19896. Set fade, allowed range is [0, 1]. Default is 0.95.
  19897. @item c
  19898. Set volume color expression.
  19899. The expression can use the following variables:
  19900. @table @option
  19901. @item VOLUME
  19902. Current max volume of channel in dB.
  19903. @item PEAK
  19904. Current peak.
  19905. @item CHANNEL
  19906. Current channel number, starting from 0.
  19907. @end table
  19908. @item t
  19909. If set, displays channel names. Default is enabled.
  19910. @item v
  19911. If set, displays volume values. Default is enabled.
  19912. @item o
  19913. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19914. default is @code{h}.
  19915. @item s
  19916. Set step size, allowed range is [0, 5]. Default is 0, which means
  19917. step is disabled.
  19918. @item p
  19919. Set background opacity, allowed range is [0, 1]. Default is 0.
  19920. @item m
  19921. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19922. default is @code{p}.
  19923. @item ds
  19924. Set display scale, can be linear: @code{lin} or log: @code{log},
  19925. default is @code{lin}.
  19926. @item dm
  19927. In second.
  19928. If set to > 0., display a line for the max level
  19929. in the previous seconds.
  19930. default is disabled: @code{0.}
  19931. @item dmc
  19932. The color of the max line. Use when @code{dm} option is set to > 0.
  19933. default is: @code{orange}
  19934. @end table
  19935. @section showwaves
  19936. Convert input audio to a video output, representing the samples waves.
  19937. The filter accepts the following options:
  19938. @table @option
  19939. @item size, s
  19940. Specify the video size for the output. For the syntax of this option, check the
  19941. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19942. Default value is @code{600x240}.
  19943. @item mode
  19944. Set display mode.
  19945. Available values are:
  19946. @table @samp
  19947. @item point
  19948. Draw a point for each sample.
  19949. @item line
  19950. Draw a vertical line for each sample.
  19951. @item p2p
  19952. Draw a point for each sample and a line between them.
  19953. @item cline
  19954. Draw a centered vertical line for each sample.
  19955. @end table
  19956. Default value is @code{point}.
  19957. @item n
  19958. Set the number of samples which are printed on the same column. A
  19959. larger value will decrease the frame rate. Must be a positive
  19960. integer. This option can be set only if the value for @var{rate}
  19961. is not explicitly specified.
  19962. @item rate, r
  19963. Set the (approximate) output frame rate. This is done by setting the
  19964. option @var{n}. Default value is "25".
  19965. @item split_channels
  19966. Set if channels should be drawn separately or overlap. Default value is 0.
  19967. @item colors
  19968. Set colors separated by '|' which are going to be used for drawing of each channel.
  19969. @item scale
  19970. Set amplitude scale.
  19971. Available values are:
  19972. @table @samp
  19973. @item lin
  19974. Linear.
  19975. @item log
  19976. Logarithmic.
  19977. @item sqrt
  19978. Square root.
  19979. @item cbrt
  19980. Cubic root.
  19981. @end table
  19982. Default is linear.
  19983. @item draw
  19984. Set the draw mode. This is mostly useful to set for high @var{n}.
  19985. Available values are:
  19986. @table @samp
  19987. @item scale
  19988. Scale pixel values for each drawn sample.
  19989. @item full
  19990. Draw every sample directly.
  19991. @end table
  19992. Default value is @code{scale}.
  19993. @end table
  19994. @subsection Examples
  19995. @itemize
  19996. @item
  19997. Output the input file audio and the corresponding video representation
  19998. at the same time:
  19999. @example
  20000. amovie=a.mp3,asplit[out0],showwaves[out1]
  20001. @end example
  20002. @item
  20003. Create a synthetic signal and show it with showwaves, forcing a
  20004. frame rate of 30 frames per second:
  20005. @example
  20006. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  20007. @end example
  20008. @end itemize
  20009. @section showwavespic
  20010. Convert input audio to a single video frame, representing the samples waves.
  20011. The filter accepts the following options:
  20012. @table @option
  20013. @item size, s
  20014. Specify the video size for the output. For the syntax of this option, check the
  20015. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20016. Default value is @code{600x240}.
  20017. @item split_channels
  20018. Set if channels should be drawn separately or overlap. Default value is 0.
  20019. @item colors
  20020. Set colors separated by '|' which are going to be used for drawing of each channel.
  20021. @item scale
  20022. Set amplitude scale.
  20023. Available values are:
  20024. @table @samp
  20025. @item lin
  20026. Linear.
  20027. @item log
  20028. Logarithmic.
  20029. @item sqrt
  20030. Square root.
  20031. @item cbrt
  20032. Cubic root.
  20033. @end table
  20034. Default is linear.
  20035. @item draw
  20036. Set the draw mode.
  20037. Available values are:
  20038. @table @samp
  20039. @item scale
  20040. Scale pixel values for each drawn sample.
  20041. @item full
  20042. Draw every sample directly.
  20043. @end table
  20044. Default value is @code{scale}.
  20045. @item filter
  20046. Set the filter mode.
  20047. Available values are:
  20048. @table @samp
  20049. @item average
  20050. Use average samples values for each drawn sample.
  20051. @item peak
  20052. Use peak samples values for each drawn sample.
  20053. @end table
  20054. Default value is @code{average}.
  20055. @end table
  20056. @subsection Examples
  20057. @itemize
  20058. @item
  20059. Extract a channel split representation of the wave form of a whole audio track
  20060. in a 1024x800 picture using @command{ffmpeg}:
  20061. @example
  20062. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  20063. @end example
  20064. @end itemize
  20065. @section sidedata, asidedata
  20066. Delete frame side data, or select frames based on it.
  20067. This filter accepts the following options:
  20068. @table @option
  20069. @item mode
  20070. Set mode of operation of the filter.
  20071. Can be one of the following:
  20072. @table @samp
  20073. @item select
  20074. Select every frame with side data of @code{type}.
  20075. @item delete
  20076. Delete side data of @code{type}. If @code{type} is not set, delete all side
  20077. data in the frame.
  20078. @end table
  20079. @item type
  20080. Set side data type used with all modes. Must be set for @code{select} mode. For
  20081. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  20082. in @file{libavutil/frame.h}. For example, to choose
  20083. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  20084. @end table
  20085. @section spectrumsynth
  20086. Synthesize audio from 2 input video spectrums, first input stream represents
  20087. magnitude across time and second represents phase across time.
  20088. The filter will transform from frequency domain as displayed in videos back
  20089. to time domain as presented in audio output.
  20090. This filter is primarily created for reversing processed @ref{showspectrum}
  20091. filter outputs, but can synthesize sound from other spectrograms too.
  20092. But in such case results are going to be poor if the phase data is not
  20093. available, because in such cases phase data need to be recreated, usually
  20094. it's just recreated from random noise.
  20095. For best results use gray only output (@code{channel} color mode in
  20096. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  20097. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  20098. @code{data} option. Inputs videos should generally use @code{fullframe}
  20099. slide mode as that saves resources needed for decoding video.
  20100. The filter accepts the following options:
  20101. @table @option
  20102. @item sample_rate
  20103. Specify sample rate of output audio, the sample rate of audio from which
  20104. spectrum was generated may differ.
  20105. @item channels
  20106. Set number of channels represented in input video spectrums.
  20107. @item scale
  20108. Set scale which was used when generating magnitude input spectrum.
  20109. Can be @code{lin} or @code{log}. Default is @code{log}.
  20110. @item slide
  20111. Set slide which was used when generating inputs spectrums.
  20112. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  20113. Default is @code{fullframe}.
  20114. @item win_func
  20115. Set window function used for resynthesis.
  20116. @item overlap
  20117. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  20118. which means optimal overlap for selected window function will be picked.
  20119. @item orientation
  20120. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  20121. Default is @code{vertical}.
  20122. @end table
  20123. @subsection Examples
  20124. @itemize
  20125. @item
  20126. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  20127. then resynthesize videos back to audio with spectrumsynth:
  20128. @example
  20129. 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
  20130. 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
  20131. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  20132. @end example
  20133. @end itemize
  20134. @section split, asplit
  20135. Split input into several identical outputs.
  20136. @code{asplit} works with audio input, @code{split} with video.
  20137. The filter accepts a single parameter which specifies the number of outputs. If
  20138. unspecified, it defaults to 2.
  20139. @subsection Examples
  20140. @itemize
  20141. @item
  20142. Create two separate outputs from the same input:
  20143. @example
  20144. [in] split [out0][out1]
  20145. @end example
  20146. @item
  20147. To create 3 or more outputs, you need to specify the number of
  20148. outputs, like in:
  20149. @example
  20150. [in] asplit=3 [out0][out1][out2]
  20151. @end example
  20152. @item
  20153. Create two separate outputs from the same input, one cropped and
  20154. one padded:
  20155. @example
  20156. [in] split [splitout1][splitout2];
  20157. [splitout1] crop=100:100:0:0 [cropout];
  20158. [splitout2] pad=200:200:100:100 [padout];
  20159. @end example
  20160. @item
  20161. Create 5 copies of the input audio with @command{ffmpeg}:
  20162. @example
  20163. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  20164. @end example
  20165. @end itemize
  20166. @section zmq, azmq
  20167. Receive commands sent through a libzmq client, and forward them to
  20168. filters in the filtergraph.
  20169. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  20170. must be inserted between two video filters, @code{azmq} between two
  20171. audio filters. Both are capable to send messages to any filter type.
  20172. To enable these filters you need to install the libzmq library and
  20173. headers and configure FFmpeg with @code{--enable-libzmq}.
  20174. For more information about libzmq see:
  20175. @url{http://www.zeromq.org/}
  20176. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  20177. receives messages sent through a network interface defined by the
  20178. @option{bind_address} (or the abbreviation "@option{b}") option.
  20179. Default value of this option is @file{tcp://localhost:5555}. You may
  20180. want to alter this value to your needs, but do not forget to escape any
  20181. ':' signs (see @ref{filtergraph escaping}).
  20182. The received message must be in the form:
  20183. @example
  20184. @var{TARGET} @var{COMMAND} [@var{ARG}]
  20185. @end example
  20186. @var{TARGET} specifies the target of the command, usually the name of
  20187. the filter class or a specific filter instance name. The default
  20188. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  20189. but you can override this by using the @samp{filter_name@@id} syntax
  20190. (see @ref{Filtergraph syntax}).
  20191. @var{COMMAND} specifies the name of the command for the target filter.
  20192. @var{ARG} is optional and specifies the optional argument list for the
  20193. given @var{COMMAND}.
  20194. Upon reception, the message is processed and the corresponding command
  20195. is injected into the filtergraph. Depending on the result, the filter
  20196. will send a reply to the client, adopting the format:
  20197. @example
  20198. @var{ERROR_CODE} @var{ERROR_REASON}
  20199. @var{MESSAGE}
  20200. @end example
  20201. @var{MESSAGE} is optional.
  20202. @subsection Examples
  20203. Look at @file{tools/zmqsend} for an example of a zmq client which can
  20204. be used to send commands processed by these filters.
  20205. Consider the following filtergraph generated by @command{ffplay}.
  20206. In this example the last overlay filter has an instance name. All other
  20207. filters will have default instance names.
  20208. @example
  20209. ffplay -dumpgraph 1 -f lavfi "
  20210. color=s=100x100:c=red [l];
  20211. color=s=100x100:c=blue [r];
  20212. nullsrc=s=200x100, zmq [bg];
  20213. [bg][l] overlay [bg+l];
  20214. [bg+l][r] overlay@@my=x=100 "
  20215. @end example
  20216. To change the color of the left side of the video, the following
  20217. command can be used:
  20218. @example
  20219. echo Parsed_color_0 c yellow | tools/zmqsend
  20220. @end example
  20221. To change the right side:
  20222. @example
  20223. echo Parsed_color_1 c pink | tools/zmqsend
  20224. @end example
  20225. To change the position of the right side:
  20226. @example
  20227. echo overlay@@my x 150 | tools/zmqsend
  20228. @end example
  20229. @c man end MULTIMEDIA FILTERS
  20230. @chapter Multimedia Sources
  20231. @c man begin MULTIMEDIA SOURCES
  20232. Below is a description of the currently available multimedia sources.
  20233. @section amovie
  20234. This is the same as @ref{movie} source, except it selects an audio
  20235. stream by default.
  20236. @anchor{movie}
  20237. @section movie
  20238. Read audio and/or video stream(s) from a movie container.
  20239. It accepts the following parameters:
  20240. @table @option
  20241. @item filename
  20242. The name of the resource to read (not necessarily a file; it can also be a
  20243. device or a stream accessed through some protocol).
  20244. @item format_name, f
  20245. Specifies the format assumed for the movie to read, and can be either
  20246. the name of a container or an input device. If not specified, the
  20247. format is guessed from @var{movie_name} or by probing.
  20248. @item seek_point, sp
  20249. Specifies the seek point in seconds. The frames will be output
  20250. starting from this seek point. The parameter is evaluated with
  20251. @code{av_strtod}, so the numerical value may be suffixed by an IS
  20252. postfix. The default value is "0".
  20253. @item streams, s
  20254. Specifies the streams to read. Several streams can be specified,
  20255. separated by "+". The source will then have as many outputs, in the
  20256. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  20257. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  20258. respectively the default (best suited) video and audio stream. Default
  20259. is "dv", or "da" if the filter is called as "amovie".
  20260. @item stream_index, si
  20261. Specifies the index of the video stream to read. If the value is -1,
  20262. the most suitable video stream will be automatically selected. The default
  20263. value is "-1". Deprecated. If the filter is called "amovie", it will select
  20264. audio instead of video.
  20265. @item loop
  20266. Specifies how many times to read the stream in sequence.
  20267. If the value is 0, the stream will be looped infinitely.
  20268. Default value is "1".
  20269. Note that when the movie is looped the source timestamps are not
  20270. changed, so it will generate non monotonically increasing timestamps.
  20271. @item discontinuity
  20272. Specifies the time difference between frames above which the point is
  20273. considered a timestamp discontinuity which is removed by adjusting the later
  20274. timestamps.
  20275. @end table
  20276. It allows overlaying a second video on top of the main input of
  20277. a filtergraph, as shown in this graph:
  20278. @example
  20279. input -----------> deltapts0 --> overlay --> output
  20280. ^
  20281. |
  20282. movie --> scale--> deltapts1 -------+
  20283. @end example
  20284. @subsection Examples
  20285. @itemize
  20286. @item
  20287. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  20288. on top of the input labelled "in":
  20289. @example
  20290. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20291. [in] setpts=PTS-STARTPTS [main];
  20292. [main][over] overlay=16:16 [out]
  20293. @end example
  20294. @item
  20295. Read from a video4linux2 device, and overlay it on top of the input
  20296. labelled "in":
  20297. @example
  20298. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20299. [in] setpts=PTS-STARTPTS [main];
  20300. [main][over] overlay=16:16 [out]
  20301. @end example
  20302. @item
  20303. Read the first video stream and the audio stream with id 0x81 from
  20304. dvd.vob; the video is connected to the pad named "video" and the audio is
  20305. connected to the pad named "audio":
  20306. @example
  20307. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  20308. @end example
  20309. @end itemize
  20310. @subsection Commands
  20311. Both movie and amovie support the following commands:
  20312. @table @option
  20313. @item seek
  20314. Perform seek using "av_seek_frame".
  20315. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  20316. @itemize
  20317. @item
  20318. @var{stream_index}: If stream_index is -1, a default
  20319. stream is selected, and @var{timestamp} is automatically converted
  20320. from AV_TIME_BASE units to the stream specific time_base.
  20321. @item
  20322. @var{timestamp}: Timestamp in AVStream.time_base units
  20323. or, if no stream is specified, in AV_TIME_BASE units.
  20324. @item
  20325. @var{flags}: Flags which select direction and seeking mode.
  20326. @end itemize
  20327. @item get_duration
  20328. Get movie duration in AV_TIME_BASE units.
  20329. @end table
  20330. @c man end MULTIMEDIA SOURCES